# Apps

## List Apps

<mark style="color:blue;">`GET`</mark> `https://app.inspector.dev/api/apps`

#### Headers

| Name                                             | Type   | Description |
| ------------------------------------------------ | ------ | ----------- |
| Authentication<mark style="color:red;">\*</mark> | string | API key.    |

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

```json
[
    {
        "id": 123,
        "name": "App Demo",
        "favorite": false,
        "client_version": "4.7.33",
        "key": "xxxxxxxxxxxxxxxxx",
        "serverless": false,
        "weekly_report": true,
        "platform": {
            "id": 1,
            "name": "Laravel",
            "language": "PHP"
        },
        "users": [1, 2],
        "created_at": "2024-03-01 10:52",
        "updated_at": "2024-03-01 10:52"
    },
    {
        "id": 456,
        "name": "Demo 2",
        "favorite": false,
        "key": "xxxxxxxxxxxxxxxxx",
        
        ...
    }
]
```

{% endtab %}
{% endtabs %}

## App Details

<mark style="color:blue;">`GET`</mark> `https://app.inspector.dev/api/apps/:id`

#### Path Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | integer | App's ID    |

#### Headers

| Name                                             | Type   | Description |
| ------------------------------------------------ | ------ | ----------- |
| Authentication<mark style="color:red;">\*</mark> | string | API key     |

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

```json
{
    "id": 123,
    "name": "App Demo",
    "favorite": false,
    "client_version": "4.7.33",
    "key": "xxxxxxxxxxxxxxxxx",
    "serverless": false,
    "weekly_report": true,
    "platform": {
        "id": 1,
        "name": "Laravel",
        "language": "PHP"
    },
    "users": [1, 2],
    "created_at": "2024-03-01 10:52",
    "updated_at": "2024-03-01 10:52"
}
```

{% endtab %}

{% tab title="404 " %}

```
{
    "message": "Resource not found."
}
```

{% endtab %}
{% endtabs %}

## Create App

<mark style="color:green;">`POST`</mark> `https://app.inspector.dev/api/apps`

Create a new project will generate a new ingestion key.

#### Headers

| Name                                             | Type   | Description |
| ------------------------------------------------ | ------ | ----------- |
| Authentication<mark style="color:red;">\*</mark> | string | API key     |

#### Request Body

| Name                                           | Type    | Description                                         |
| ---------------------------------------------- | ------- | --------------------------------------------------- |
| name<mark style="color:red;">\*</mark>         | string  | The name of the project                             |
| platform\_id<mark style="color:red;">\*</mark> | integer | The ID of the technology stack used for the project |

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

```json
{
    "id": 123,
    "name": "App Demo",
    "favorite": false,
    "client_version": "4.7.33",
    "key": "xxxxxxxxxxxxxxxxx",
    "serverless": false,
    "weekly_report": true,
    "platform": {
        "id": 1,
        "name": "Laravel",
        "language": "PHP"
    },
    "users": [1, 2],
    "created_at": "2024-03-01 10:52",
    "updated_at": "2024-03-01 10:52"
}
```

{% endtab %}

{% tab title="422 If some data is incorrect." %}

```json
{
    "message": "The given data are incorrect",
    "errors": {
        "name": [
            "The name field is required",
            "The name field should contains more than 3 characters"
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Update App

<mark style="color:orange;">`PUT`</mark> `https://app.inspector.dev/api/apps/:id`

#### Path Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | integer | App's ID    |

#### Headers

| Name                                             | Type   | Description |
| ------------------------------------------------ | ------ | ----------- |
| Authentication<mark style="color:red;">\*</mark> | string | API key     |

#### Request Body

| Name                                           | Type    | Description                                                    |
| ---------------------------------------------- | ------- | -------------------------------------------------------------- |
| weekly\_report                                 | boolean | Determine if you want to receive the weekly summary via email. |
| platform\_id<mark style="color:red;">\*</mark> | integer | The tech stack.                                                |
| name<mark style="color:red;">\*</mark>         | string  | Name of the project                                            |

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

```json
{
    "id": 123,
    "name": "App Demo",
    "favorite": false,
    "client_version": "4.7.33",
    "key": "xxxxxxxxxxxxxxxxx",
    "serverless": false,
    "weekly_report": true,
    "platform": {
        "id": 1,
        "name": "Laravel",
        "language": "PHP"
    },
    "users": [1, 2],
    "created_at": "2024-03-01 10:52",
    "updated_at": "2024-03-01 10:52"
}
```

{% endtab %}
{% endtabs %}

## Delete App

<mark style="color:red;">`DELETE`</mark> `https://app.inspector.dev/api/apps/:id`

#### Path Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | integer | App's ID    |

#### Headers

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| Authorization<mark style="color:red;">\*</mark> | string | API key     |

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

```json
{
    "id": 123,
    "name": "App Demo",
    "favorite": false,
    "client_version": "4.7.33",
    "key": "xxxxxxxxxxxxxxxxx",
    "serverless": false,
    "weekly_report": true,
    "platform": {
        "id": 1,
        "name": "Laravel",
        "language": "PHP"
    },
    "users": [1, 2],
    "created_at": "2024-03-01 10:52",
    "updated_at": "2024-03-01 10:52"
}
```

{% endtab %}
{% endtabs %}

## Enable/Disable Data Transfer

<mark style="color:green;">`POST`</mark> `/https://app.inspector.dev/api/apps/:id/lock`

The endpoint works as a toggle. To know if your application is currently locked or not you can check the `locked_at` field in the app object. If it exists that means the application monitoring is currently off, and the next call to the lock endpoint will turn it on.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

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

```json
{
  "id": 123,
    "name": "App Demo",
    "favorite": false,
    "client_version": "4.7.33",
    "key": "xxxxxxxxxxxxxxxxx",
    "serverless": false,
    "weekly_report": true,
    "platform": {
        "id": 1,
        "name": "Laravel",
        "language": "PHP"
    },
    "users": [1, 2],
    "locked_at": "2025-01-29 11:53",
    "created_at": "2024-03-01 10:52",
    "updated_at": "2024-03-01 10:52"
}
```

{% endtab %}

{% tab title="401" %}

```json
{
  "error": "Unauthorized action."
}
```

{% endtab %}
{% endtabs %}
