> ## 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.

# Create or update a contact

> Creates the contact, or completes the one that already owns the email or the phone, merges
`attributes`, and records the `consent` given in the same body (one row per channel). 201 when
created, 200 when updated. Requires `contacts:write`. Under POPIA a marketing SMS needs an
unrevoked SMS consent for its number; see [Contacts and consent](/learn/contacts).




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/contacts
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:
    post:
      tags:
        - Contacts
      summary: Create or update a contact
      description: >
        Creates the contact, or completes the one that already owns the email or
        the phone, merges

        `attributes`, and records the `consent` given in the same body (one row
        per channel). 201 when

        created, 200 when updated. Requires `contacts:write`. Under POPIA a
        marketing SMS needs an

        unrevoked SMS consent for its number; see [Contacts and
        consent](/learn/contacts).
      operationId: createContact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateContactRequest'
            example:
              phone: '+27821234567'
              email: thandi@example.co.za
              attributes:
                first_name: Thandi
              consent:
                channel:
                  - sms
                  - email
                source: form
                capturedAt: '2026-10-29T08:12:00+02:00'
                evidence:
                  url: https://shop.example.co.za/checkout
                  formId: checkout-optin
                  ip: 196.25.1.10
      responses:
        '200':
          description: Updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contact'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contact'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/Unprocessable'
components:
  schemas:
    CreateContactRequest:
      type: object
      description: One of email or phone is required.
      properties:
        email:
          type: string
          format: email
        phone:
          type: string
          description: E.164
          e.g. +27821234567: null
        attributes:
          $ref: '#/components/schemas/ContactAttributes'
        consent:
          $ref: '#/components/schemas/RecordConsentRequest'
    Contact:
      allOf:
        - $ref: '#/components/schemas/ContactSummary'
        - type: object
          required:
            - consents
          properties:
            consents:
              type: array
              description: Every consent record, newest first, revoked ones included.
              items:
                $ref: '#/components/schemas/Consent'
    ContactAttributes:
      type: object
      description: >-
        Your own flat fields, up to 40 keys of lower-case letters, digits and
        underscores; values up to 500 characters. `first_name` fills
        `{{first_name}}` in sends.
      additionalProperties:
        type: string
        maxLength: 500
      example:
        first_name: Thandi
        city: Pretoria
    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.
    ContactSummary:
      type: object
      required:
        - id
        - email
        - phone
        - attributes
        - marketing
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          example: ct_01j9x7k2r4m8q3v5n6b7c8d9e0
        email:
          type:
            - string
            - 'null'
        phone:
          type:
            - string
            - 'null'
        attributes:
          $ref: '#/components/schemas/ContactAttributes'
        marketing:
          type: object
          required:
            - email
            - sms
          properties:
            email:
              $ref: '#/components/schemas/MarketingStatus'
            sms:
              $ref: '#/components/schemas/MarketingStatus'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    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
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
    ConsentChannel:
      type: string
      enum:
        - email
        - sms
    MarketingStatus:
      type: object
      required:
        - consented
        - optedOutAt
      properties:
        consented:
          type: boolean
          description: An unrevoked marketing consent exists on this channel.
        optedOutAt:
          type:
            - string
            - 'null'
          format: date-time
          description: Set when the person opted out (STOP
          unsubscribe link: null
          or by hand); marketing is refused.: null
    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.
    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:
    Conflict:
      description: Idempotency conflict or duplicate name
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    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.