> For the complete documentation index, see [llms.txt](https://docs.watbot.ru/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.watbot.ru/rabota-s-api/kontakty.md).

# Контакты

## Получить список контактов

<mark style="color:blue;">`GET`</mark> `https://watbot.ru/api/v1/getContacts`

Этот метод позволяет получить список контактов указанного бота.

#### Path Parameters

| Name       | Type    | Description                                                    |
| ---------- | ------- | -------------------------------------------------------------- |
| date\_from | integer | Фильтр по дате создания контакта в формате Unix Time           |
| date\_to   | integer | Фильтр по дате создания контакта в формате Unix Time           |
| count      | integer | Количество контактов для получения. Максимальное значение: 500 |
| bot\_id    | integer | ID бота.                                                       |
| page       | integer | Порядковый номер страницы                                      |

{% tabs %}
{% tab title="200 Запрос успешно обработан." %}

```javascript
{
  "data": [
    {
      "id": 1,
      "bot_id": 1,
      "phone": "79991234567",
      "email": "info@example.com",
      "name": "Иван Иванов",
      "messenger": "whatsapp",
      "address": "г. Москва, ул. Пушкина, д. 5",
      "utm": {
        "utm_source": "landing",
        "utm_medium": "...",
        "utm_campaign": "...",
        "utm_term": "...",
        "utm_content": "..."
      },
      "created_at": "2019-05-10T10:38:28+00:00"
    },
    {
      "id": 2,
      "bot_id": 1,
      "phone": "792712312321",
      "email": null,
      "name": "Петр Петров",
      "messenger": "telegram",
      "telegram_id": "123456",
      "telegram_username": "superman",
      "address": null,
      "utm": null,
      "created_at": "2019-04-02T12:16:16+00:00"
    },
    {
      "id": 3,
      "bot_id": 2,
      "phone": null,
      "email": null,
      "name": "Василий Васильев",
      "messenger": "viber",
      "viber_id": "1123456789dD20=",
      "address": null,
      "utm": null,
      "created_at": "2019-05-11T15:31:34+00:00"
    },
  ],
  "links": {
    "first": "http:\/\/watbot.ru\/api\/v1\/getContacts?page=1",
    "last": "http:\/\/watbot.ru\/api\/v1\/getContacts?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "path": "http:\/\/watbot.ru\/api\/v1\/getContacts",
    "per_page": 500,
    "to": 3,
    "total": 3
  }
}
```

{% endtab %}
{% endtabs %}

## Создать или обновить контакт

<mark style="color:green;">`POST`</mark> `https://watbot.ru/api/v1/createOrUpdateContact`

Этот метод позволяет создать или обновить контакт указанного бота.

#### Request Body

| Name                                        | Type    | Description                                                                                                 |
| ------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |
| bot\_id<mark style="color:red;">\*</mark>   | integer | ID бота.                                                                                                    |
| messenger<mark style="color:red;">\*</mark> | string  | Тип мессенджера. Возможные значения: `whatsapp`, `telegram`, `viber`, `vk`                                  |
| name<mark style="color:red;">\*</mark>      | string  | Имя контакта                                                                                                |
| email                                       | string  | Email контакта                                                                                              |
| address                                     | string  | Адрес контакта                                                                                              |
| phone                                       | string  | Номер телефона контакта в международном формате (+79991234567). Обязателен когда `messenger == "whatsapp"`. |
| telegram\_id                                | int     | ID пользователя в Телеграм.  Обязателен когда `messenger == "telegram"`                                     |
| telegram\_username                          | string  | Username пользователя Телеграм                                                                              |
| viber\_id                                   | string  | ID пользователя в Viber.  Обязателен когда `messenger == "viber"`                                           |
| vk\_id                                      | int     | ID пользователя в ВКонтакте.  Обязателен когда `messenger == "vk"`                                          |
| tags                                        | array   | Массив тегов контакта. Пример: \["Тег 1", "Тег 2"]                                                          |

{% tabs %}
{% tab title="200 Запрос успешно обработан." %}

```javascript
{
  "data": {
      "id"                => 1,
      "bot_id"            => 1,
      'phone"             => "79991234567",
      'email"             => "mail@example.com",
      'name"              => "Ivan Ivanov",
      'address"           => "Moscow",
      'messenger"         => "whatsapp",
      'utm"               => [],
      'avatar:            => null,
      'telegram_id"       => null,
      'telegram_username" => null,
      'vk_user_id"        => null,
      'viber_id"          => null,
      'created_at"        => "2019-05-10T10:38:28+00:00"
      'unsubscribed_at"   => null,
      'tags'              => ["Тег 1", "Тег 2"],
      'variables'         => [],
  }
}
```

{% endtab %}
{% endtabs %}

## Установить статус для контакта в Ysell

<mark style="color:green;">`POST`</mark> `https://watbot.ru/api/v1/setYsellStatus`

Этот метод позволяет установить статус Ysell для указанного контакта.

#### Request Body

| Name                                          | Type    | Description                   |
| --------------------------------------------- | ------- | ----------------------------- |
| contact\_id<mark style="color:red;">\*</mark> | integer | ID контакта.                  |
| status<mark style="color:red;">\*</mark>      | string  | Статус. Не более 64 символов. |

{% tabs %}
{% tab title="204: No Content Статус обновлен" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.watbot.ru/rabota-s-api/kontakty.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.
