> ## 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: 수신 거부 기록

> Didit의 PATCH /v3/messages/contacts/{to}/consent/ 엔드포인트는 수신자의 채널별 수신 동의 또는 수신 거부를 기록합니다. 수신 거부된 채널로의 전송은 거부되며 요금이 청구되지 않습니다.

Didit의 메시징 동의 업데이트 API는 한 수신자의 한 채널에 대해 수신 동의(opt-in) 또는 수신 거부(opt-out)를 기록합니다.
이후 해당 채널에서 수신 거부 상태인 수신자에게 보내는 발송은 `opted_out`으로 거부되며 요금이 청구되지 않습니다.
각 발송은 해당 채널의 기록만 조회합니다.

`to`는 `+`와 ASCII 숫자로 이루어진 E.164 번호, 이메일 주소 또는 WhatsApp 비즈니스 범위 사용자 ID여야 하며, `channel`은 이에 맞아야 합니다. 수신자 유형은 [동의 조회](https://docs.didit.me/ko/standalone-apis/messages-consent-retrieve.md)를 참고하십시오.
`source`는 동의 선택이 이루어진 출처를 기록하며, 생략하면 `api`입니다.

호출은 `400`과 함께 `invalid_status`를 반환합니다. `status`가 `opted_in` 또는 `opted_out`이 아닐 때 발생합니다. `to`가 세 가지 수신자 유형 중 어디에도 해당하지 않거나(`person@`처럼 형식이 잘못된 이메일 포함) `channel`이 이에 맞지 않으면 400 응답과 함께 `invalid_channel`이 반환됩니다. 기록을 저장할 수 없으면 400 응답과 함께 `consent_unavailable`이 반환되므로 나중에 재시도하십시오.

범위가 지정된 API 키에는 메시지에 대한 쓰기 권한이 필요합니다.

```bash theme={null}
curl -X PATCH 'https://verification.didit.me/v3/messages/contacts/%2B34600000012/consent/' \
  -H "x-api-key: $DIDIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"channel": "sms", "status": "opted_out"}'
```


## OpenAPI

````yaml ko/openapi-25.json PATCH /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/:
    patch:
      tags:
        - Messages
      summary: Update a recipient's consent
      description: >-
        Record an opt-in or an opt-out for one channel. The record applies from
        now on: a send to an opted-out recipient on that channel is refused with
        `opted_out` and not charged. Each send reads the record of its own
        channel only, and a record for a channel Didit does not send on yet is
        kept for when it does. `source` records where the choice came from,
        `api` when left out.


        `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`. `channel`
        has to fit the recipient.


        A scoped API key needs write access to messages.
      operationId: updateMessageConsent
      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.
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageConsentUpdate'
            example:
              channel: whatsapp
              status: opted_out
              source: api
      responses:
        '200':
          description: The recipient's consent per channel, with this choice recorded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageConsentChannels'
              example:
                channels:
                  - channel: whatsapp
                    status: opted_out
                    source: api
                    updated_at: '2026-11-22T09:41:00Z'
        '400':
          description: >-
            `invalid_status`: `status` is not `opted_in` or `opted_out`.
            `invalid_channel`: `to` is not an E.164 number of ASCII digits, a
            valid email address (`person@` is not) or a WhatsApp business-scoped
            user id, or `channel` does not fit it. `consent_unavailable`: the
            record could not be written; retry later.
        '403':
          description: A scoped API key without write access to messages.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageAccessDenied'
        '429':
          $ref: '#/components/responses/RateLimitedWrite'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl -X PATCH
            'https://verification.didit.me/v3/messages/contacts/%2B34600000012/consent/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{
                  "channel": "whatsapp",
                  "status": "opted_out",
                  "source": "api"
                }'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >-
        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](/integration/api-errors#retries-and-idempotency).
      schema:
        type: string
        minLength: 1
        maxLength: 255
  schemas:
    MessageConsentUpdate:
      type: object
      required:
        - channel
        - status
      properties:
        channel:
          type: string
          enum:
            - sms
            - whatsapp
            - telegram
            - rcs
            - viber
            - voice
            - email
          description: The channel the choice applies to.
        status:
          type: string
          enum:
            - opted_in
            - opted_out
          description: >-
            `opted_out` refuses sends on this channel; `opted_in` allows them
            again.
        source:
          type: string
          enum:
            - stop_reply
            - start_reply
            - bot_left
            - api
            - console
            - reassigned
          description: >-
            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.
          default: api
    MessageConsentChannels:
      type: object
      required:
        - channels
      properties:
        channels:
          type: array
          items:
            $ref: '#/components/schemas/MessageConsentChannel'
          description: >-
            The recipient's consent per channel, as the retrieve call returns
            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:
    RateLimitedWrite:
      description: >-
        The shared write limit of 300 requests per minute per API key was
        exceeded. Honor `Retry-After` before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitBudgetError'
          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
      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'
  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.