> For the complete documentation index, see [llms.txt](https://help.blinger.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.blinger.io/documentation/widget-api/agent.md).

# Agent

## Get All Agents

<mark style="color:blue;">`GET`</mark> `https://widget.blinger.io/api/external/v1/agents`

This endpoint allows you to get free cakes.

#### Headers

| Name          | Type   | Description          |
| ------------- | ------ | -------------------- |
| Authorization | string | Authorization token. |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```javascript
{
    "status": 200,
    "data": [
        {
            "id": "5475272c-3bc0-40e9-83c4-0a1cd50bc721",
            "serviceUserId": "12345",
            "name": "Vadim Belorusov",
            "status": "online",
            "avatar": {
                "id": "856a906b-b55e-493a-b04c-df019fff6c8f",
                "type": "image",
                "meta": {
                    "width": 400,
                    "height": 400
                },
                "info": {
                    "ext": "jpeg",
                    "name": "5d1dbd5e921f6",
                    "path": "/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg",
                    "size": 5106,
                    "mimeType": "image/jpeg"
                },
                "url": {
                    "120x120": "http://static.widget.blinger.io/120x120/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg",
                    "520x400": "http://static.widget.blinger.io/520x400/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg",
                    "default": "http://static.widget.blinger.io/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg"
                },
                "createdAt": 1562198400,
                "updatedAt": 1562198400
            },
            "active": true,
            "createdAt": 1562230110,
            "updatedAt": 1562230110
        },
        {
            "id": "c671d030-584e-4422-8710-9215c04b6a64",
            "serviceUserId": "123456",
            "name": "Vadim Belorusov",
            "status": "online",
            "avatar": {
                "id": "76d94b6b-a45c-4d62-8010-bd2f52d8c846",
                "type": "image",
                "meta": {
                    "width": 400,
                    "height": 400
                },
                "info": {
                    "ext": "jpeg",
                    "name": "5d1db8373db3a",
                    "path": "/c2/b1/62/be16b35869e9491a6761c013cbae7548f23b17abb225eaa82efd214264779825.jpeg",
                    "size": 5106,
                    "mimeType": "image/jpeg"
                },
                "url": {
                    "120x120": "http://static.widget.blinger.io/120x120/c2/b1/62/be16b35869e9491a6761c013cbae7548f23b17abb225eaa82efd214264779825.jpeg",
                    "520x400": "http://static.widget.blinger.io/520x400/c2/b1/62/be16b35869e9491a6761c013cbae7548f23b17abb225eaa82efd214264779825.jpeg",
                    "default": "http://static.widget.blinger.io/c2/b1/62/be16b35869e9491a6761c013cbae7548f23b17abb225eaa82efd214264779825.jpeg"
                },
                "createdAt": 1562198400,
                "updatedAt": 1562198400
            },
            "active": true,
            "createdAt": 1562228791,
            "updatedAt": 1562228791
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Get Agent

<mark style="color:blue;">`GET`</mark> `https://widget.blinger.io/api/external/v1/agents/:id`

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| id   | string | ID of the agent. |

#### Headers

| Name          | Type   | Description          |
| ------------- | ------ | -------------------- |
| Authorization | string | Authorization token. |

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

```javascript
{
    "status": 200,
    "data": {
        "id": "5475272c-3bc0-40e9-83c4-0a1cd50bc721",
        "serviceUserId": "12345",
        "name": "Vadim Belorusov",
        "status": "online",
        "avatar": {
            "id": "856a906b-b55e-493a-b04c-df019fff6c8f",
            "type": "image",
            "meta": {
                "width": 400,
                "height": 400
            },
            "info": {
                "ext": "jpeg",
                "name": "5d1dbd5e921f6",
                "path": "/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg",
                "size": 5106,
                "mimeType": "image/jpeg"
            },
            "url": {
                "120x120": "http://static.widget.blinger.io/120x120/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg",
                "520x400": "http://static.widget.blinger.io/520x400/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg",
                "default": "http://static.widget.blinger.io/91/44/41/96b85c57f9ae26a2376154c82dd55b9f6cb33ea2b038db8057b8db04a559c7f0.jpeg"
            },
            "createdAt": 1562198400,
            "updatedAt": 1562198400
        },
        "active": true,
        "createdAt": 1562230110,
        "updatedAt": 1562230110
    }
}
```

{% endtab %}
{% endtabs %}

## Create Agent

<mark style="color:green;">`POST`</mark> `https://widget.blinger.io/api/external/v1/agents`

#### Headers

| Name          | Type   | Description          |
| ------------- | ------ | -------------------- |
| Authorization | string | Authorization token. |

#### Request Body

| Name          | Type    | Description                                                        |
| ------------- | ------- | ------------------------------------------------------------------ |
| active        | boolean | Is agent active or not.                                            |
| serviceUserId | string  | Simple string identificates your service.                          |
| name          | string  | Agent's Name.                                                      |
| avatar        | string  | Url of the Agent's Avatar.                                         |
| status        | string  | <p>Status of the agent. Possible values:<br>offline or online.</p> |

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

```javascript
{
    "status": 200,
    "data": {
        "id": "c2e53dee-ad8d-45dc-909a-465746932f11",
        "serviceUserId": "12345",
        "name": "Vadim Belorusov",
        "status": "online",
        "avatar": {
            "id": "366baf52-920e-4483-96b1-36955d49f65f",
            "type": "image",
            "meta": {
                "width": 400,
                "height": 400
            },
            "info": {
                "name": "5d1df34c0a573",
                "ext": "jpeg",
                "mimeType": "image/jpeg",
                "size": 5106,
                "path": "/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg"
            },
            "url": {
                "120x120": "http://static.widget.blinger.io/120x120/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg",
                "520x400": "http://static.widget.blinger.io/520x400/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg",
                "default": "http://static.widget.blinger.io/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg"
            },
            "createdAt": 1562243916,
            "updatedAt": 1562243916
        },
        "active": true,
        "createdAt": 1562243916,
        "updatedAt": 1562243916
    }
}
```

{% endtab %}
{% endtabs %}

## Update agent

<mark style="color:orange;">`PUT`</mark> `https://widget.blinger.io/api/external/v1/agents/:id`

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| id   | string | ID of the agent. |

#### Headers

| Name          | Type   | Description          |
| ------------- | ------ | -------------------- |
| Authorization | string | Authorization token. |

#### Request Body

| Name          | Type    | Description                                                        |
| ------------- | ------- | ------------------------------------------------------------------ |
| active        | boolean | Is agent active or not.                                            |
| serviceUserId | string  | Simple string identificates your service.                          |
| name          | string  | Agent's Name.                                                      |
| avatar        | string  | Url of the Agent's Avatar.                                         |
| status        | string  | <p>Status of the agent. Possible values:<br>offline or online.</p> |

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

```javascript
{
    "status": 200,
    "data": {
        "id": "c2e53dee-ad8d-45dc-909a-465746932f11",
        "serviceUserId": "12345",
        "name": "Vadim Belorusov",
        "status": "online",
        "avatar": {
            "id": "366baf52-920e-4483-96b1-36955d49f65f",
            "type": "image",
            "meta": {
                "width": 400,
                "height": 400
            },
            "info": {
                "name": "5d1df34c0a573",
                "ext": "jpeg",
                "mimeType": "image/jpeg",
                "size": 5106,
                "path": "/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg"
            },
            "url": {
                "120x120": "http://static.widget.blinger.io/120x120/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg",
                "520x400": "http://static.widget.blinger.io/520x400/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg",
                "default": "http://static.widget.blinger.io/1c/a8/7a/405bb573328256eebf41c6c99fc1c445271acb9a594bb91fddabc963d1e6ba70.jpeg"
            },
            "createdAt": 1562243916,
            "updatedAt": 1562243916
        },
        "active": true,
        "createdAt": 1562243916,
        "updatedAt": 1562243916
    }
}
```

{% endtab %}
{% endtabs %}
