Перейти к основному содержанию
PATCH
curl
Didit’s API обновления согласия на получение сообщений фиксирует согласие или отказ от рассылки для одного канала одного получателя. С этого момента отправка получателю, отказавшемуся от рассылки по этому каналу, отклоняется с ошибкой opted_out и не тарифицируется. Каждая отправка учитывает только запись для своего канала. Параметр to задаёт номер в формате E.164, состоящий из + и ASCII-цифр, адрес электронной почты или идентификатор пользователя WhatsApp с областью действия для конкретной компании. Параметр channel должен соответствовать этому типу: см. типы получателей в разделе Получение согласия. source указывает, откуда получен выбор. Если параметр не передан, используется значение api. Запрос возвращает 400 с ошибкой invalid_status, если status не равен opted_in или opted_out. Он возвращает invalid_channel, если to не относится ни к одному из трёх типов получателей (в том числе некорректный адрес электронной почты, например person@) или если channel не подходит к нему. Он возвращает consent_unavailable, если запись не удалось сохранить: в этом случае повторите запрос позже. Для API-ключа с ограниченными правами необходим доступ на запись для сообщений.

Авторизации

x-api-key
string
header
обязательно

Your application's API key, from Developers -> API keys in the Business Console. The primary key has full access. A named key can be scoped: none, read or write per resource, limited to some workflows or to approved sessions, to a list of IP addresses, and to an expiry date. 401 means the key is wrong, revoked or expired; 403 means no key was sent, the key has no access to this resource or action, or the request came from an address outside its IP list; 404 on a session route means the session is outside the key's workflows or statuses. A key without media access receives image, video and PDF URLs as null, and a key without sessions write receives session links and tokens as null. See https://docs.didit.me/console/api-keys.

Заголовки

Idempotency-Key
string

Optional retry-safety key you choose for one operation, up to 255 characters (a UUID works). A request repeated with the same key, endpoint, query and body is answered with the first response, same status and same body, and runs and bills nothing a second time. The same key with another endpoint, query or body returns 409 idempotency_key_reused, and while the first request is still running, 409 idempotency_key_in_progress with Retry-After. A failed request (any 4xx or 5xx) is not stored, so you can send it again with the same key. Keys belong to your application, whether you call with an API key or an access token. See Retries and idempotency.

Required string length: 1 - 255

Параметры пути

to
string
обязательно

The recipient: an E.164 number (+ and up to 15 ASCII digits), an email address, or a WhatsApp business-scoped user id.

Пример:

"+34600000012"

Тело

application/json
channel
enum<string>
обязательно

The channel the choice applies to.

Доступные опции:
sms,
whatsapp,
telegram,
rcs,
viber,
voice,
email
status
enum<string>
обязательно

opted_out refuses sends on this channel; opted_in allows them again.

Доступные опции:
opted_in,
opted_out
source
enum<string>
по умолчанию:api

Where the choice came from, returned as you send it; api when left out. reassigned is only a label you can record: Didit does not detect a change of owner.

Доступные опции:
stop_reply,
start_reply,
bot_left,
api,
console,
reassigned

Ответ

The recipient's consent per channel, with this choice recorded.

channels
object[]
обязательно

The recipient's consent per channel, as the retrieve call returns it.

Последнее изменение 24 ноября 2026 г.