Passer au contenu principal
PATCH
curl
L’API de mise à jour du consentement aux messages de Didit enregistre un consentement ou un refus pour un canal donné d’un destinataire donné. Ensuite, un envoi à un destinataire ayant retiré son consentement sur ce canal est refusé avec opted_out et n’est pas facturé. Chaque envoi ne lit que l’enregistrement de son propre canal. to est un numéro E.164 composé du signe + et de chiffres ASCII, une adresse e-mail ou un identifiant utilisateur WhatsApp associé à l’entreprise, et channel doit correspondre à ce type de destinataire : voir les types de destinataires dans Récupérer le consentement. source indique d’où provient le choix et vaut api lorsque vous ne le renseignez pas. L’appel renvoie 400 avec invalid_status lorsque status n’est ni opted_in ni opted_out, et avec invalid_channel lorsque to ne correspond à aucun des trois types de destinataires (y compris une adresse e-mail mal formée, par exemple person@) ou lorsque channel ne correspond pas à ce destinataire. Il renvoie consent_unavailable lorsque l’enregistrement n’a pas pu être écrit ; réessayez plus tard. Une clé API à portée restreinte doit disposer d’un accès en écriture aux messages.

Autorisations

x-api-key
string
header
requis

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.

En-têtes

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

Paramètres de chemin

to
string
requis

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

Exemple:

"+34600000012"

Corps

application/json
channel
enum<string>
requis

The channel the choice applies to.

Options disponibles:
sms,
whatsapp,
telegram,
rcs,
viber,
voice,
email
status
enum<string>
requis

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

Options disponibles:
opted_in,
opted_out
source
enum<string>
défaut: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.

Options disponibles:
stop_reply,
start_reply,
bot_left,
api,
console,
reassigned

Réponse

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

channels
object[]
requis

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

Dernière modification le 24 novembre 2026