# Rest API

## About

This API allows the developer to access and interact with Updraft data remotely.

### Getting started

Getting started with the REST API of Updraft is easy, and can be done via the command line interface.

The user authentication token is required for all requests below.

## Get Authorization token

<mark style="color:green;">`POST`</mark> `https://app.getupdraft.com/api/user/login/`

This endpoint allows you to get an authorisation token.

If 2FA code is required for login, it can be sent with Token, which is an optional parameter.&#x20;

#### Body data/JSON

| Name                                       | Type   | Description           |
| ------------------------------------------ | ------ | --------------------- |
| username<mark style="color:red;">\*</mark> | string | Organisation email    |
| password<mark style="color:red;">\*</mark> | string | Organisation password |
| token                                      | string | 2FA token             |

{% tabs %}
{% tab title="200 Authorisation token." %}

```json
{
    "token": "authorization token"
}
```

{% endtab %}
{% endtabs %}

## Get list of Apps

<mark style="color:blue;">`GET`</mark> `https://mydomain.getupdraft.com/api/applications/?title=&org={id}`

This endpoint allows you to get a list of  apps within your organisation.

#### Path Parameters

| Name       | Type   | Description     |
| ---------- | ------ | --------------- |
| Org`={id}` | string | Organisation id |

#### Headers

| Name          | Type   | Description                                                                 |
| ------------- | ------ | --------------------------------------------------------------------------- |
| Authorization | string | Authentication token, note: might require adding "Token" to the value field |

{% tabs %}
{% tab title="200 List of Apps." %}

```javascript
{
    "id": 1687,
    "project_title": "title",
    "ipa_app": 1716,
    "apk_app": 1705,
    "first_app_id": 1705,
    "env_details": [{
        "id": 1705,
        "environment": "Staging",
        "app_type": 0,
        "title": "title"
    }, {
        "id": 1706,
        "environment": "Production",
        "app_type": 0,
        "title": "title"
    }, {
        "id": 1707,
        "environment": "Store",
        "app_type": 0,
        "title": "title"
    }, {
        "id": 1716,
        "environment": "Staging",
        "app_type": 1,
        "title": "title"
    }, {
        "id": 1743,
        "environment": "Production",
        "app_type": 1,
        "title": "title"
    }],
    "icon": "/media/icon/2020-01-14%2009%3A52%3A20.781544__ic_launcher.png",
    "user_detail": [{
        "user_id": 602,
        "username": "email",
        "first_name": "test",
        "last_name": "test"
    }],
    "users": [602]


```

{% endtab %}
{% endtabs %}

## Get list of Users

<mark style="color:blue;">`GET`</mark> `https://mydomain.getupdraft.com/api/profiles/`

This endpoint allows you to get a list of users within your organization.

#### Headers

| Name          | Type   | Description                                                                 |
| ------------- | ------ | --------------------------------------------------------------------------- |
| Authorization | string | Authentication token, note: might require adding "Token" to the value field |

{% tabs %}
{% tab title="200 " %}

```
{
    "user_id": 4,
    "username": "username,
    "first_name": "Max",
    "last_name": "Cake",
    "email": "email",
    "profile": {
        "is_subscribe": true,
        "is_firstlogin": false,
        "is_show_demotour": true,
        "gender": null,
        "sending_emails": false,
        "enable_instruction": false,
        "last_mobile": 1,
        "last_whatsnew": 5
    }
```

{% endtab %}
{% endtabs %}

## Delete an app version (build)

<mark style="color:red;">`DELETE`</mark> `https://mydomain.getupdraft.com/api/versions/{id}/`

User can delete an already uploaded build from an application.&#x20;

#### Path Parameters

| Name | Type    | Description                                         |
| ---- | ------- | --------------------------------------------------- |
| id   | integer | A unique integer value identifying your app version |

#### Headers

| Name          | Type   | Description                                                                 |
| ------------- | ------ | --------------------------------------------------------------------------- |
| Authorization | string | Authentication token, note: might require adding "Token" to the value field |

{% tabs %}
{% tab title="204 No Content " %}

```
```

{% endtab %}
{% endtabs %}

## Create new App project

<mark style="color:red;">`POST`</mark> `https://mydomain.getupdraft.com/api/applications/`

#### Headers

| Name          | Type   |                                                                             |
| ------------- | ------ | --------------------------------------------------------------------------- |
| Authorization | string | Authentication token, note: might require adding "Token" to the value field |

#### Body data/JSON

```json
{
    "id": null,
    "title": "",
    "project_title": "App Project name",
    "organization": {Organisation id},
    "slack_webhook": "",
    "app_type": null,
    "slack_channel": "",
    "ready_to_sale": true,
    "base_app": null,
    "environment": "",
    "description": "",
    "project_app": null,
    "is_public_app": true
}
```

## Get last version of the app

<mark style="color:red;">`POST`</mark> `https://mydomain.getupdraft.com/api/get_last_version/`

#### Headers

| Name          | Type   |                                                                             |
| ------------- | ------ | --------------------------------------------------------------------------- |
| Authorization | string | Authentication token, note: might require adding "Token" to the value field |

#### Body data/JSON

```json
{
"sdk_key": "Organisation SDK key",
"app_key": "Project App key"
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getupdraft.com/api/rest-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
