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

# Create a contact

> Create a single contact. If `double_opt_in` is provided the contact is created in `unverified` status and receives a confirmation email — they become `subscribed` only after clicking the confirmation link. Requires the `audience:write` scope and is blocked for sandbox API keys.

Create a single contact. If `double_opt_in` is provided the contact is created in `unverified` status and receives a confirmation email — they become `subscribed` only after clicking the confirmation link. Requires the `audience:write` scope and is blocked for sandbox API keys.


## OpenAPI

````yaml POST /audience/contacts
openapi: 3.1.0
info:
  title: Lettr API
  version: 1.0.0
  description: >-
    Lettr Email API - Send transactional emails with tracking, attachments, and
    personalization.
  contact:
    name: Lettr Support
    url: https://lettr.com
  license:
    name: Proprietary
    url: https://lettr.com/terms
servers:
  - url: https://app.lettr.com/api
    description: Production
security: []
tags:
  - name: Emails
    description: Email sending operations
  - name: Templates
    description: Email template management operations
  - name: Domains
    description: Domain management operations
  - name: Webhooks
    description: Webhook management operations
  - name: Audience
    description: 'Audience management: lists, contacts, topics, properties, and segments'
  - name: Campaigns
    description: >-
      Campaign operations: listing, stats, engagement events, and
      dispatch/scheduling
paths:
  /audience/contacts:
    post:
      tags:
        - Audience
      summary: Create a contact
      description: >-
        Create a single contact. If `double_opt_in` is provided the contact is
        created in `unverified` status and receives a confirmation email — they
        become `subscribed` only after clicking the confirmation link. Requires
        the `audience:write` scope and is blocked for sandbox API keys.
      operationId: createAudienceContact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StoreAudienceContactRequest'
      responses:
        '201':
          description: Contact created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShowAudienceContactResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '404':
          description: >-
            Double opt-in confirmation template not found. Returned only when
            `double_opt_in` is supplied and its `template_slug` does not exist,
            has no active (published) version, or no default project is
            configured for the team. No contact is created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                template_not_found:
                  summary: Template slug not found
                  value:
                    message: Template with slug 'confirm-subscription' was not found.
                    error_code: template_not_found
                no_active_version:
                  summary: Template has no active version
                  value:
                    message: >-
                      Template 'confirm-subscription' has no active version.
                      Publish a version of this template before using it.
                    error_code: template_not_found
                no_default_project:
                  summary: No default project configured
                  value:
                    message: No default project is configured for this team.
                    error_code: template_not_found
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          $ref: '#/components/responses/ServerError'
        '502':
          description: >-
            Confirmation email transmission failed (upstream provider error).
            Returned only when `double_opt_in` is supplied and the confirmation
            email could not be sent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                message: Unconfigured Sending Domain <sender.example.com>
                error_code: transmission_failed
      security:
        - bearerAuth: []
components:
  schemas:
    StoreAudienceContactRequest:
      type: object
      description: Request to create a single contact
      required:
        - email
      properties:
        email:
          type: string
          format: email
          maxLength: 255
          example: jane@example.com
        list_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Optional list to add the contact to
        properties:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
            maxLength: 1000
          description: >-
            Custom property values. Each key must match a property defined for
            the team.
          example:
            first_name: Jane
        double_opt_in:
          $ref: '#/components/schemas/DoubleOptInConfig'
    ShowAudienceContactResponse:
      type: object
      required:
        - message
        - data
      properties:
        message:
          type: string
          example: Contact retrieved successfully.
        data:
          $ref: '#/components/schemas/AudienceContactView'
    ErrorResponse:
      type: object
      required:
        - message
        - error_code
      description: Error response for non-validation errors (400, 409, 500, 502).
      properties:
        message:
          type: string
          description: Human-readable error message
          example: The sender domain could not be determined from the email address.
        error_code:
          $ref: '#/components/schemas/ErrorCode'
    ValidationErrorResponse:
      type: object
      required:
        - message
        - error_code
        - errors
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Validation failed.
        error_code:
          type: string
          description: Error code (always `validation_error` for 422 responses)
          const: validation_error
          example: validation_error
        errors:
          type: object
          description: Field-specific validation errors
          additionalProperties:
            type: array
            items:
              type: string
          example:
            from:
              - The sender email address is required.
            to:
              - At least one recipient email address is required.
    DoubleOptInConfig:
      type: object
      description: >-
        Double opt-in configuration. When provided, the contact receives a
        confirmation email and is created in `unverified` status until they
        click the confirmation link.
      required:
        - from
        - subject
        - template_slug
        - redirect_url
      properties:
        from:
          type: string
          format: email
          maxLength: 255
          example: no-reply@example.com
        from_name:
          type:
            - string
            - 'null'
          maxLength: 255
          example: Example Newsletter
        subject:
          type: string
          maxLength: 998
          example: Please confirm your subscription
        template_slug:
          type: string
          maxLength: 255
          example: double-opt-in
        redirect_url:
          type: string
          format: uri
          maxLength: 2048
          example: https://example.com/confirmed
    AudienceContactView:
      type: object
      description: Audience contact
      required:
        - id
        - email
        - status
        - properties
        - created_at
        - lists
        - topics
      properties:
        id:
          type: string
          format: uuid
          example: 0193e6b0-9c1d-7d4f-a8f1-cef9a1b2d3e4
        email:
          type: string
          format: email
          example: jane@example.com
        status:
          $ref: '#/components/schemas/AudienceContactStatus'
        properties:
          type: object
          description: Custom properties for the contact (string values)
          additionalProperties:
            type: string
          example:
            first_name: Jane
            country: US
        created_at:
          type: string
          format: date-time
          example: '2024-01-15T10:30:00Z'
        lists:
          type: array
          items:
            $ref: '#/components/schemas/AudienceContactListLink'
        topics:
          type: array
          items:
            $ref: '#/components/schemas/AudienceContactTopicLink'
    UnauthorizedResponse:
      type: object
      required:
        - message
      description: Error response for authentication failures (401).
      properties:
        message:
          type: string
          description: Human-readable error message
          example: API key is required.
    ErrorCode:
      type: string
      description: >-
        Error codes returned by the API.


        | Code | HTTP Status | Description |

        |------|-------------|-------------|

        | `validation_error` | 422 | Request validation failed. Check the
        `errors` object for field-specific messages. |

        | `invalid_domain` | 400 | The sender domain could not be determined
        from the email address. |

        | `unconfigured_domain` | 400 | The sender domain is not configured or
        approved for sending. |

        | `send_error` | 400, 500 | General error during email send preparation
        or domain registration. |

        | `retrieval_error` | 400, 500 | Failed to retrieve resources (e.g.,
        sandbox key without associated user, upstream error). |

        | `transmission_failed` | 502 | Email transmission to the upstream
        provider failed. |

        | `resource_already_exists` | 409 | The resource (e.g., domain) already
        exists. |

        | `not_found` | 404 | The specified resource was not found. |

        | `template_not_found` | 404 | The specified template, project, or
        template version was not found. |

        | `insufficient_scope` | 403 | The API key does not have the required
        scope for this endpoint. |

        | `schedule_cancellation_failed` | 409, 500 | Could not cancel the
        scheduled transmission (already sent or upstream error). |

        | `quota_exceeded` | 429 | Monthly sending quota exceeded. Upgrade your
        plan to continue sending. |

        | `daily_quota_exceeded` | 429 | Daily sending quota exceeded. Try again
        tomorrow. |

        | `campaign_not_sendable` | 422 | The campaign cannot be sent in its
        current state (not a draft, or missing subject/sender/content). |

        | `campaign_not_scheduled` | 422 | The campaign is not scheduled, so it
        cannot be unscheduled. |
      enum:
        - validation_error
        - invalid_domain
        - unconfigured_domain
        - send_error
        - retrieval_error
        - transmission_failed
        - resource_already_exists
        - not_found
        - template_not_found
        - insufficient_scope
        - schedule_cancellation_failed
        - quota_exceeded
        - daily_quota_exceeded
        - campaign_not_sendable
        - campaign_not_scheduled
      example: invalid_domain
    AudienceContactStatus:
      type: string
      enum:
        - subscribed
        - unsubscribed
        - bounced
        - complained
        - unverified
      description: Contact subscription status
      example: subscribed
    AudienceContactListLink:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
    AudienceContactTopicLink:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
  responses:
    UnauthorizedError:
      description: Unauthorized - Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedResponse'
          examples:
            missing_key:
              summary: Missing API key
              value:
                message: API key is required.
            invalid_key:
              summary: Invalid API key
              value:
                message: Invalid API key.
    ForbiddenError:
      description: Forbidden - API key does not have the required scope
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: >-
              Your API key does not have the required permissions for this
              action.
            error_code: insufficient_scope
    ServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            message: An unexpected error occurred. Please try again later.
            error_code: send_error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key for authentication

````