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

# Add a domain

> Creates the sending identity and returns the DNS records to publish: three DKIM CNAMEs, an MX and an SPF TXT
for the custom return-path host, and a suggested DMARC record. Adding a domain you already have returns it
with 200. Requires `domains:write`.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/domains
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: Usage
paths:
  /v1/domains:
    post:
      tags:
        - Domains
      summary: Add a domain
      description: >
        Creates the sending identity and returns the DNS records to publish:
        three DKIM CNAMEs, an MX and an SPF TXT

        for the custom return-path host, and a suggested DMARC record. Adding a
        domain you already have returns it

        with 200. Requires `domains:write`.
      operationId: addDomain
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDomainRequest'
            example:
              name: yourshop.co.za
      responses:
        '200':
          description: Already added
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Domain'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Domain'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/Unprocessable'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    CreateDomainRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          example: yourshop.co.za
        mailFromSubdomain:
          type: string
          default: mail
          description: Subdomain for the custom return path.
    Domain:
      type: object
      required:
        - id
        - name
        - status
        - mailFromDomain
        - records
        - verifiedAt
        - lastCheckedAt
        - createdAt
      properties:
        id:
          type: string
          example: dom_01j9x7k2r4m8q3v5n6b7c8d9e0
        name:
          type: string
          example: yourshop.co.za
        status:
          type: string
          enum:
            - pending
            - verified
            - failed
        mailFromDomain:
          type: string
          example: mail.yourshop.co.za
        records:
          type: array
          items:
            $ref: '#/components/schemas/DnsRecord'
        advice:
          type: array
          description: >-
            Deliverability findings from the last check (DMARC, apex SPF,
            alignment).
          items:
            $ref: '#/components/schemas/DomainAdvice'
        verifiedAt:
          type:
            - string
            - 'null'
          format: date-time
        lastCheckedAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
    DnsRecord:
      type: object
      required:
        - purpose
        - type
        - name
        - value
        - required
        - status
        - found
        - checkedAt
      properties:
        purpose:
          type: string
          enum:
            - dkim
            - mail_from_mx
            - mail_from_spf
            - dmarc
        type:
          type: string
          enum:
            - CNAME
            - MX
            - TXT
        name:
          type: string
          example: abc123._domainkey.yourshop.co.za
        value:
          type: string
          example: abc123.dkim.af-south-1.amazonses.com
        required:
          type: boolean
          description: >-
            Sending is blocked until every required record verifies; DMARC is
            advice.
        status:
          type: string
          enum:
            - pending
            - verified
            - failed
        found:
          type: array
          description: What public DNS currently returns for the name.
          items:
            type: string
        wildcard:
          type: boolean
          description: >-
            The answer comes from a wildcard record; publishing the exact record
            overrides it.
        checkedAt:
          type:
            - string
            - 'null'
          format: date-time
    DomainAdvice:
      type: object
      required:
        - code
        - level
        - title
        - detail
      properties:
        code:
          type: string
          example: dmarc_missing
        level:
          type: string
          enum:
            - warn
            - info
        title:
          type: string
        detail:
          type: string
    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:
    PaymentRequired:
      description: Allowance used up, not enough credits, or plan limit reached
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    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
    ServiceUnavailable:
      description: A dependency is unavailable; nothing was changed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  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.