> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# API de consentement aux messages : consulter les opt-in d'un destinataire

> Didit : GET /v3/messages/contacts/{to}/consent/ renvoie l'opt-in ou opt-out par canal, avec origine et date de chaque modification.

L'API de consentement aux messages de Didit renvoie le consentement d'un destinataire pour chaque canal pour lequel votre application possède un enregistrement, avec l'origine de chaque enregistrement et la date de sa dernière modification.
Un canal sans enregistrement n'apparaît pas dans la liste.

`to` correspond à l'un de trois types de destinataires, chacun avec ses propres canaux :

| Destinataire | Exemple | Canaux |
| - | - | - |
| Numéro E.164 : `+` suivi d'au plus 15 chiffres ASCII | `+34600000012` | `sms`, `whatsapp`, `telegram`, `rcs`, `viber`, `voice` |
| Adresse e-mail | `person@example.com` | `email` |
| Identifiant utilisateur WhatsApp à portée d'entreprise : un indicatif de pays, un point et un identifiant | `US.13491208655302741918` | `whatsapp` |

Encodez `to` en pourcentage dans le chemin : le `+` d'un numéro devient `%2B`.
Un `to` qui ne correspond à aucun des trois types renvoie `{"channels": [], "reassigned": false}`.

`reassigned` vaut toujours `false` : cette version ne détecte pas qu'un numéro a changé de titulaire, et aucun envoi n'est ignoré pour cette raison.

Une clé API à portée limitée doit disposer de l'accès en lecture aux messages.

```bash theme={null}
curl 'https://verification.didit.me/v3/messages/contacts/%2B34600000012/consent/' \
  -H "x-api-key: $DIDIT_API_KEY"
```

Pour enregistrer un consentement ou un retrait de consentement, [mettez à jour le consentement](https://docs.didit.me/fr/standalone-apis/messages-consent-update.md).


## OpenAPI

````yaml fr/openapi-25.json GET /v3/messages/contacts/{to}/consent/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: Identity verification API. Authenticate with x-api-key header.
servers:
  - url: https://verification.didit.me
security: []
tags:
  - name: Bank Data
    description: >-
      Bank Link, connections, accounts, balances, transactions, institutions and
      coverage. One-time reads of real banks are open to live applications.
      Ongoing access with real banks is not open yet for live applications: it
      is available for sandbox applications with the Didit Test Bank, and opens
      country by country. Nothing is charged in sandbox. A call made with an API
      key needs a key that can reach Bank data: a full-access key can, and a
      scoped key needs `bank-data` in its scopes (read for reads, write for
      operations that change something). A scoped key without it is refused, and
      the call answers `403 bank_data_access_denied`. The account check is the
      exception: it needs write access to sessions, or full access, and not the
      Bank data scope. Raw bank data (accounts, balances, transactions and the
      change feed) also refuses a request that carries no API key.


      Every refusal under `/v3/bank/` except the account check's has the same
      JSON body (`code`, `message`, `request_id`, `field`, `next_action`,
      `retry_after`). A path that is not an operation, an id that is not a UUID
      or an unknown sub-resource answers `404 not_found` for every method, and
      any unexpected error answers `500 internal_error` with a `request_id`.
      Where Bank data is not available, every operation answers the platform's
      standard `404`, exactly as an unknown route does.
paths:
  /v3/messages/contacts/{to}/consent/:
    get:
      tags:
        - Messages
      summary: Retrieve a recipient's consent
      description: >-
        The recipient's consent for every channel your application has a record
        on, with where each record came from and when it changed. A channel with
        no record is not listed, and a `to` that is none of the three recipient
        types below answers `{"channels": [], "reassigned": false}`.


        `reassigned` is always `false`: this release does not detect that a
        number changed owner, and no send is skipped for it.


        `to` is one of three recipient types, and each has its own channels: an
        E.164 number (`+` and up to 15 ASCII digits `[0-9]`) is on `sms`,
        `whatsapp`, `telegram`, `rcs`, `viber` and `voice`; an email address is
        on `email` only; a WhatsApp business-scoped user id (a country code, a
        dot and an id, such as `US.13491208655302741918`) is on `whatsapp` only.
        Percent-encode it in the path: a number's `+` becomes `%2B`.


        A scoped API key needs read access to messages.
      operationId: retrieveMessageConsent
      parameters:
        - name: to
          in: path
          required: true
          schema:
            type: string
            example: '+34600000012'
          description: >-
            The recipient: an E.164 number (`+` and up to 15 ASCII digits), an
            email address, or a WhatsApp business-scoped user id.
      responses:
        '200':
          description: The recipient's consent per channel.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageConsent'
              example:
                channels:
                  - channel: sms
                    status: opted_in
                    source: api
                    updated_at: '2026-11-12T08:30:00Z'
                reassigned: false
        '403':
          description: A scoped API key without read access to messages.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageAccessDenied'
        '429':
          $ref: '#/components/responses/RateLimitedRead'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X GET
            'https://verification.didit.me/v3/messages/contacts/%2B34600000012/consent/'
            \
              -H 'x-api-key: YOUR_API_KEY'
components:
  schemas:
    MessageConsent:
      type: object
      required:
        - channels
        - reassigned
      properties:
        channels:
          type: array
          items:
            $ref: '#/components/schemas/MessageConsentChannel'
          description: >-
            The recipient's consent per channel, for the channels you have a
            record on.
        reassigned:
          type: boolean
          description: >-
            Always `false`: this release does not detect that a number changed
            owner, and no send is skipped for it.
    MessageAccessDenied:
      type: object
      description: 'A request the API key may not make: `detail` says why (no `code`).'
      required:
        - detail
      properties:
        detail:
          type: string
          example: This API key has no write access to messages.
    MessageConsentChannel:
      type: object
      description: One channel's consent record for the recipient.
      required:
        - channel
        - status
        - source
        - updated_at
      properties:
        channel:
          type: string
          enum:
            - sms
            - whatsapp
            - telegram
            - rcs
            - viber
            - voice
            - email
          description: The channel this consent applies to.
        status:
          type: string
          enum:
            - opted_in
            - opted_out
          description: >-
            `opted_out` refuses every send on this channel with `opted_out`,
            uncharged.
        source:
          type: string
          enum:
            - stop_reply
            - start_reply
            - bot_left
            - api
            - console
            - reassigned
          description: >-
            Where the choice came from. `stop_reply` and `start_reply`: the
            recipient's own STOP or START reply; an email bounce or spam
            complaint reads `stop_reply`, and a completed Telegram opt-in link
            `start_reply`. `bot_left`: the recipient blocked or left the sender
            on the channel. `console`: a team member in the console. `api`: your
            API call without a `source`. A `source` your API call sets,
            `reassigned` included, is returned as you sent it; Didit never
            records `reassigned` itself.
        updated_at:
          type: string
          format: date-time
    RateLimitBudgetError:
      type: object
      description: >-
        Returned only for a rate-limit middleware budget refusal. Other 429
        errors, including idempotency conflicts and endpoint-specific caps, do
        not promise these metadata fields.
      required:
        - detail
        - reference
        - limit
        - remaining
        - reset
        - window_seconds
      properties:
        detail:
          type: string
          description: Existing human-readable budget refusal message.
        reference:
          type: string
          pattern: ^RL-[0-9a-f]{32}$
          description: >-
            Opaque support reference: RL- followed by 32 lowercase UUID
            hexadecimal characters.
        limit:
          type: integer
          description: Budget for the exceeded scope; equals X-RateLimit-Limit.
        remaining:
          type: integer
          minimum: 0
          description: Remaining budget, clamped to zero; equals X-RateLimit-Remaining.
        reset:
          type: integer
          format: int64
          description: Window reset time in Unix seconds; equals X-RateLimit-Reset.
        window_seconds:
          type: integer
          description: >-
            Fixed-window duration in seconds, not the remaining wait. Honor
            Retry-After before retrying.
      example:
        detail: >-
          Write request rate limit exceeded. You can make up to 300 requests per
          minute.
        reference: RL-00000000000040008000000000000001
        limit: 300
        remaining: 0
        reset: 1794358860
        window_seconds: 60
  responses:
    RateLimitedRead:
      description: Middleware read budget exceeded. Honor Retry-After before retrying.
      headers:
        Retry-After:
          $ref: '#/components/headers/BudgetRetryAfter'
        X-RateLimit-Scope:
          $ref: '#/components/headers/BudgetXRateLimitScope'
        X-RateLimit-Limit:
          $ref: '#/components/headers/BudgetXRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/BudgetXRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/BudgetXRateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitBudgetError'
          example:
            detail: >-
              GET request rate limit exceeded. You can make up to 600 requests
              per minute.
            reference: RL-00000000000040008000000000000001
            limit: 600
            remaining: 0
            reset: 1794358860
            window_seconds: 60
  headers:
    BudgetRetryAfter:
      description: >-
        Seconds to wait, rounded up to the next window. Present on middleware
        budget refusals.
      schema:
        type: integer
    BudgetXRateLimitScope:
      description: >-
        The scope whose budget was exceeded. Present on middleware budget
        refusals.
      schema:
        type: string
    BudgetXRateLimitLimit:
      description: >-
        Budget for the exceeded scope; equals body limit. Present on middleware
        budget refusals.
      schema:
        type: integer
    BudgetXRateLimitRemaining:
      description: >-
        Remaining budget, clamped to zero; equals body remaining. Present on
        middleware budget refusals.
      schema:
        type: integer
    BudgetXRateLimitReset:
      description: >-
        Reset time in Unix seconds; equals body reset. Present on middleware
        budget refusals.
      schema:
        type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.