# Получение рассылок

## Получение рассылок

<mark style="color:blue;">`GET`</mark> `https://direct.i-dgtl.ru/api/v1/dispatch`

Метод позволяет получить массив рассылок, подходящих под условия параметров.

#### Query Parameters

| Name                | Type    | Description                                                                              |
| ------------------- | ------- | ---------------------------------------------------------------------------------------- |
| created\_from       | string  | <p>Минимальная дата создания рассылки в формате<br><code>yyyy-mm-ddThh:MM:ssZ</code></p> |
| created\_to         | string  | Максимальная дата создания рассылки                                                      |
| status              | string  | Статус рассылки                                                                          |
| dispatch\_id        | integer | Идентификатор рассылки                                                                   |
| dispatch\_name      | string  | Название рассылки                                                                        |
| traffic\_center\_id | integer | Идентификатор ЦРТ                                                                        |

#### Headers

| Name                                            | Type   | Description       |
| ----------------------------------------------- | ------ | ----------------- |
| Authorization<mark style="color:red;">\*</mark> | string | `Basic {TOKEN_1}` |

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

```
{
  "total": 1,
  "items": [
    {
      "dispatchId": 1234,
      "dispatchName": "имя рассылки",
      "created": "2020-07-07T20:00:00Z",
      "localSendTime": "2020-07-08 10:00:00",
      "localCompletionTime": "2020-07-08 20:00:00",
      "useLocalTime": true,
      "status": "sending",
      "source": "sendername",
      "message": "текст сообщения",
      "trafficCenterId": 12,
      "trafficCenterName": "ЦРТ для рассылок",
      "base": {
        "included": {
          "type": "FILE",
          "name": "имя_файла.xlsx"
        },
        "excluded": {
          "type": "FILE",
          "name": "исключаемые_абоненты.xlsx"
        }
      },
      "parts": {
        "total": 1235,
        "delivered": 1000,
        "undelivered": 100,
        "unsent": 30,
        "sent": 45,
        "sending": 60
      },
      "messages": {
        "total": 1235,
        "delivered": 1000,
        "undelivered": 100,
        "unsent": 30,
        "sent": 45,
        "sending": 60
      }
    }
  ]
}
```

{% endtab %}

{% tab title="401" %}
Использование невалидного токена.

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

```
{
    "error": {
        "code": 4012,
        "msg": "Bad credentials"
    }
}
```

{% endtab %}

{% tab title="4010" %}

```
{
    "error": {
        "code": 4010,
        "msg": "Not Authenticated"
    }
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="403" %}
Использование неподходящего токена.

```
{
    "error": {
        "code": 4030,
        "msg": "Access Denied"
    }
}
```

{% endtab %}
{% endtabs %}

Возможные варианты перечислений:

| Параметр | Варианты                                                 |
| -------- | -------------------------------------------------------- |
| status   | [Статусы рассылок](/extra/references.md#dispatch-states) |

## Параметры объекта ответа

| Параметр                   | Тип     | Описание                                                                                                                                                      |
| -------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| total                      | integer | Количество найденных рассылок                                                                                                                                 |
| items                      | array   | Массив найденных рассылок                                                                                                                                     |
| items.dispatchId           | integer | Идентификатор рассылки                                                                                                                                        |
| items.dispatchName         | string  | Название рассылки                                                                                                                                             |
| items.created              | string  | Дата создания рассылки                                                                                                                                        |
| items.localSendTime        | string  | Дата начала рассылки                                                                                                                                          |
| items.localCompletionTime  | string  | Дата завершения рассылки                                                                                                                                      |
| items.useLocalTime         | boolean | Учитывается ли местное время получателей                                                                                                                      |
| items.status               | string  | [Статус рассылки](/extra/references.md#dispatch-states)                                                                                                       |
| items.source               | string  | Имя отправителя                                                                                                                                               |
| items.message              | string  | Текст сообщения                                                                                                                                               |
| items.trafficCenterId      | integer | Идентификатор ЦРТ                                                                                                                                             |
| items.trafficCenterName    | string  | Название ЦРТ                                                                                                                                                  |
| items.base                 | object  | Информация об источнике получателей                                                                                                                           |
| items.base.included        | object  | Включенные получатели                                                                                                                                         |
| items.base.included.type   | string  | <p>Тип источника получателей</p><p><code>MANUAL –</code> ввод вручную</p><p><code>FILE –</code>импорт из файла</p><p><code>API</code>- создание через API</p> |
| items.base.included.name   | string  | Имя файла                                                                                                                                                     |
| items.base.excluded        | object  | Исключенные получатели                                                                                                                                        |
| items.base.excluded.type   | string  | <p>Тип источника исключаемых получателей</p><p><code>MANUAL –</code> ввод вручную</p><p><code>FILE –</code>импорт из файла</p>                                |
| items.base.excluded.name   | string  | Имя файла                                                                                                                                                     |
| items.parts                | object  | Статистика по частям сообщений рассылки                                                                                                                       |
| items.parts.total          | integer | Общее количество частей                                                                                                                                       |
| items.parts.delivered      | integer | Доставлено частей                                                                                                                                             |
| items.parts.undelivered    | integer | Не доставлено частей                                                                                                                                          |
| items.parts.unsent         | integer | Не отправлено частей                                                                                                                                          |
| items.parts.sent           | integer | Отправлено частей; в ожидании статуса                                                                                                                         |
| items.parts.sending        | integer | Частей в ожидании отправки                                                                                                                                    |
| items.messages             | object  | Статистика по сообщениям рассылки                                                                                                                             |
| items.messages.total       | integer | Общее количество сообщений                                                                                                                                    |
| items.messages.delivered   | integer | Доставлено сообщений                                                                                                                                          |
| items.messages.undelivered | integer | Не доставлено сообщений                                                                                                                                       |
| items.messages.unsent      | integer | Не отправлено сообщений                                                                                                                                       |
| items.messages.sent        | integer | Отправлено сообщений; в ожидании статуса                                                                                                                      |
| items.messages.sending     | integer | Сообщений в ожидании отправки                                                                                                                                 |


---

# 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://api.docs.direct.i-dgtl.ru/dispatches/get.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.
