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

# Record consent

> Records the person's consent to marketing on one or both channels, with the evidence you hold.
The contact needs the matching identifier (a phone for `sms`, an email for `email`). A `form` or
`manual` consent after an opt-out clears the opt-out (the person opted back in); `import` and
`existing_customer` never override a STOP. Requires `contacts:write`.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/contacts/{id}/consents
openapi: 3.1.0
info:
  title: Sendbaze API
  version: '1.0'
  description: >
    Transactional email and SMS for Africa. Send from your own domain through
    Amazon SES in Cape Town.

    Every send returns an id immediately; delivery is reported by webhook and in
    the dashboard logs.
  contact:
    name: Sendbaze support
    email: support@sendbaze.com
    url: https://www.sendbaze.com
servers:
  - url: https://api.sendbaze.com
security:
  - bearerAuth: []
tags:
  - name: Emails
  - name: Templates
  - name: Domains
  - name: Suppressions
  - name: Webhooks
  - name: SMS
  - name: Contacts
  - name: Senders
  - name: Usage
paths:
  /v1/contacts/{id}/consents:
    post:
      tags:
        - Contacts
      summary: Record consent
      description: >
        Records the person's consent to marketing on one or both channels, with
        the evidence you hold.

        The contact needs the matching identifier (a phone for `sms`, an email
        for `email`). A `form` or

        `manual` consent after an opt-out clears the opt-out (the person opted
        back in); `import` and

        `existing_customer` never override a STOP. Requires `contacts:write`.
      operationId: recordConsent
      parameters:
        - $ref: '#/components/parameters/ContactId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordConsentRequest'
            example:
              channel: sms
              source: existing_customer
              evidence:
                reference: ORD-10422
                when: '2026-09-14'
      responses:
        '201':
          description: The consent rows written, one per channel
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Consent'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/Unprocessable'
components:
  parameters:
    ContactId:
      name: id
      in: path
      required: true
      schema:
        type: string
        example: ct_01j9x7k2r4m8q3v5n6b7c8d9e0
  schemas:
    RecordConsentRequest:
      type: object
      required:
        - channel
        - source
      properties:
        channel:
          description: One channel, or both.
          oneOf:
            - $ref: '#/components/schemas/ConsentChannel'
            - type: array
              items:
                $ref: '#/components/schemas/ConsentChannel'
              minItems: 1
              maxItems: 2
        source:
          type: string
          enum:
            - form
            - import
            - existing_customer
            - manual
        evidence:
          type: object
          description: >-
            Up to 4 KB of flat key/values, kept verbatim and shown back; e.g.
            url, formId, text, ip, userAgent, reference, file, note.
          additionalProperties:
            type:
              - string
              - number
              - boolean
              - 'null'
        capturedAt:
          type: string
          format: date-time
          description: When the person consented. Defaults to now; not in the future.
    Consent:
      type: object
      required:
        - id
        - contactId
        - channel
        - value
        - purpose
        - source
        - evidence
        - capturedAt
        - recordedAt
        - revokedAt
        - revokedReason
      properties:
        id:
          type: string
          example: cns_01j9x7k2r4m8q3v5n6b7c8d9e0
        contactId:
          type:
            - string
            - 'null'
          description: Null once the contact was deleted; `value` stays as the evidence.
        channel:
          $ref: '#/components/schemas/ConsentChannel'
        value:
          type: string
          description: The address or number consent was given for
          as it was when recorded.: null
        purpose:
          type: string
          example: marketing
        source:
          $ref: '#/components/schemas/ConsentSource'
        evidence:
          type:
            - object
            - 'null'
          additionalProperties: true
        capturedAt:
          type: string
          format: date-time
          description: When the person consented.
        recordedAt:
          type: string
          format: date-time
          description: When Sendbaze stored it.
        revokedAt:
          type:
            - string
            - 'null'
          format: date-time
        revokedReason:
          type:
            - string
            - 'null'
          description: stop_reply
          unsubscribe: null
          manual or api.: null
    ConsentChannel:
      type: string
      enum:
        - email
        - sms
    ConsentSource:
      type: string
      enum:
        - form
        - import
        - existing_customer
        - manual
        - attestation
      description: >
        How the person agreed. form: a form they submitted. import: a list you
        brought with consent already

        obtained. existing_customer: they bought from you and could opt out
        (POPIA s69(3)). manual: a teammate

        typed it in. attestation: written by the dashboard when a teammate
        confirms a list's consent on the Send page.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
    ErrorBody:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable error code; see the errors reference.
          example: validation_error
        message:
          type: string
        docs:
          type: string
          format: uri
        fields:
          type: object
          description: Present on validation errors. Dotted path to messages.
          additionalProperties:
            type: array
            items:
              type: string
        limit:
          type: integer
          description: On `plan_limit`, the ceiling that was reached.
        upgradeUrl:
          type: string
          format: uri
          description: >-
            Where to change plan, when a bigger plan would have allowed the
            request.
        topUpUrl:
          type: string
          format: uri
          description: >-
            Where to add wallet funds, when a balance would have allowed the
            request.
        settingsUrl:
          type: string
          format: uri
          description: >-
            Where to change an organisation setting that blocked the request
            (SMS destinations).
        domainsUrl:
          type: string
          format: uri
          description: >-
            Where to add and verify a sending domain, on
            `sandbox_recipient_not_allowed` and `sandbox_limit_reached`.
  responses:
    NotFound:
      description: No such resource in your organisation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: not_found
              message: No email with id em_x.
              docs: https://docs.sendbaze.com/errors#not_found
    Unprocessable:
      description: >-
        Validation failed, a recipient is suppressed, or an SMS destination is
        not supported (destination_not_supported)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: validation_error
              message: The request has invalid fields.
              docs: https://docs.sendbaze.com/errors#validation_error
              fields:
                to.1:
                  - must be a valid email address
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An API key from the dashboard. `sk_live_…` sends; `sk_test_…` validates
        and returns ids without sending.

````

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