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

# Create a saved draft



## OpenAPI

````yaml /openapi-app.json post /mailbox/drafts
openapi: 3.1.0
info:
  description: Programmatic access to your Sendmux email infrastructure.
  title: Sendmux API
  version: 1.0.0
servers:
  - description: API v1
    url: https://app.sendmux.ai/api/v1
security:
  - bearerAuth: []
  - oauth2: []
paths:
  /mailbox/drafts:
    post:
      tags:
        - Mailbox API
      summary: Create a saved draft
      operationId: mailboxCreateDraft
      parameters:
        - description: Reuse this key when retrying the same create request.
          in: header
          name: Idempotency-Key
          required: false
          schema:
            description: Reuse this key when retrying the same create request.
            maxLength: 255
            type: string
        - description: >-
            Mailbox public ID to target when the credential grants access to
            more than one mailbox. Omit when the credential is scoped to exactly
            one mailbox.
          in: query
          name: mailbox_id
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMailboxDraft'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MailboxDraftResponse'
          description: Saved draft and its revision.
          headers:
            Location:
              description: Canonical draft URL.
              schema:
                type: string
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          description: Request could not be completed.
      security:
        - bearerAuth: []
        - oauth2:
            - mailbox.read
            - mailbox.drafts.write
components:
  schemas:
    CreateMailboxDraft:
      additionalProperties: false
      properties:
        attachments:
          description: Attachments and inline images.
          items:
            additionalProperties: false
            properties:
              blob_id:
                description: An attachment uploaded to this mailbox.
                maxLength: 255
                minLength: 1
                type: string
              content_id:
                description: Content ID referenced by an inline image.
                maxLength: 998
                minLength: 1
                type: string
              content_type:
                description: Attachment media type.
                maxLength: 255
                minLength: 1
                type: string
              disposition:
                description: Whether the attachment appears within the message.
                enum:
                  - attachment
                  - inline
                type: string
              filename:
                description: Attachment filename.
                maxLength: 255
                minLength: 1
                type: string
              size_bytes:
                description: Attachment size in bytes; verified when saved.
                maximum: 7500000
                minimum: 0
                type: integer
            required:
              - blob_id
              - filename
              - content_type
              - size_bytes
            type: object
          maxItems: 10
          type: array
        bcc:
          description: Hidden copied recipients.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 50
          type: array
        cc:
          description: Visible copied recipients.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 50
          type: array
        custom_headers:
          additionalProperties:
            type: string
          description: Custom X- headers preserved with this revision.
          type: object
        from:
          additionalProperties: false
          description: Authorised sender; defaults to this inbox.
          properties:
            email:
              description: Email address.
              format: email
              maxLength: 254
              type: string
            name:
              description: Display name.
              maxLength: 255
              type:
                - string
                - 'null'
          required:
            - email
          type: object
        html_body:
          description: HTML body, preserved when saved.
          maxLength: 1000000
          type: string
        reply_to:
          description: Authorised reply addresses; defaults to this inbox.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 20
          type: array
        reply_to_message_id:
          description: Message in this inbox to reply to; thread headers are snapshotted.
          maxLength: 255
          minLength: 1
          type: string
        source:
          additionalProperties: false
          description: >-
            Source for this draft. Adoption requires Idempotency-Key. Explicit
            content fields override prepared defaults.
          properties:
            action:
              description: >-
                Prepare a reply, reply-all, forward or adopt an existing draft.
                Source content and attachments are saved with the draft.
              enum:
                - reply
                - reply_all
                - forward
                - adopt
              type: string
            message_id:
              description: Source message in this inbox.
              maxLength: 255
              minLength: 1
              type: string
          required:
            - message_id
            - action
          type: object
        subject:
          description: Subject; may be empty.
          maxLength: 998
          type: string
        text_body:
          description: Plain-text body.
          maxLength: 1000000
          type: string
        to:
          description: Primary recipients; at most 50 total across To, Cc and Bcc.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 50
          type: array
      type: object
    MailboxDraftResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - properties:
            data:
              $ref: '#/components/schemas/MailboxDraft'
            meta:
              $ref: '#/components/schemas/ResponseMeta'
          required:
            - data
          type: object
      unevaluatedProperties: false
    ApiError:
      additionalProperties: false
      properties:
        error:
          additionalProperties: false
          properties:
            code:
              description: Machine-readable error code
              enum:
                - invalid_parameter
                - missing_parameter
                - authentication_required
                - insufficient_permissions
                - not_found
                - conflict
                - limit_exceeded
                - idempotency_conflict
                - payload_too_large
                - validation_error
                - rate_limit_exceeded
                - service_unavailable
                - internal_error
              example: invalid_parameter
              type: string
            doc_url:
              description: Link to relevant documentation
              type: string
            errors:
              description: >-
                Accumulated per-field issues for validation errors. Only present
                on 400/422 responses.
              items:
                $ref: '#/components/schemas/ApiErrorDetail'
              type: array
            message:
              description: Human-readable error description
              type: string
            param:
              description: The parameter that caused the error
              type: string
            retryable:
              description: >-
                Whether the caller may safely retry this request. 4xx are
                typically false (except 429); 5xx are typically true.
              example: false
              type: boolean
          required:
            - code
            - message
            - retryable
          type: object
        meta:
          additionalProperties: false
          properties:
            request_id:
              example: req_clxxxxxxxxxxxxxxxxxxxxxxxxx
              type: string
          required:
            - request_id
          type: object
        ok:
          enum:
            - false
          type: boolean
      required:
        - ok
        - error
        - meta
      type: object
    SuccessEnvelope:
      properties:
        meta:
          additionalProperties: {}
          properties: {}
          type: object
        ok:
          enum:
            - true
          type: boolean
      required:
        - ok
        - meta
      type: object
    MailboxDraft:
      additionalProperties: false
      properties:
        attachments:
          description: Attachments and inline images.
          items:
            additionalProperties: false
            properties:
              blob_id:
                description: An attachment uploaded to this mailbox.
                maxLength: 255
                minLength: 1
                type: string
              content_id:
                description: Content ID referenced by an inline image.
                maxLength: 998
                minLength: 1
                type: string
              content_type:
                description: Attachment media type.
                maxLength: 255
                minLength: 1
                type: string
              disposition:
                description: Whether the attachment appears within the message.
                enum:
                  - attachment
                  - inline
                type: string
              filename:
                description: Attachment filename.
                maxLength: 255
                minLength: 1
                type: string
              size_bytes:
                description: Attachment size in bytes; verified when saved.
                maximum: 7500000
                minimum: 0
                type: integer
            required:
              - blob_id
              - filename
              - content_type
              - size_bytes
            type: object
          maxItems: 10
          type: array
        bcc:
          description: Hidden copied recipients.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 50
          type: array
        cc:
          description: Visible copied recipients.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 50
          type: array
        custom_headers:
          additionalProperties:
            type: string
          description: Custom X- headers preserved with this revision.
          type: object
        failure_code:
          description: >-
            Safe failure reason. Correct failed draft content or current
            permissions before retrying. Never retry an uncertain send as a new
            message.
          enum:
            - preparation_failed
            - authorisation_revoked
            - send_rejected
          type:
            - string
            - 'null'
        from:
          additionalProperties: false
          description: Authorised sender; defaults to this inbox.
          properties:
            email:
              description: Email address.
              format: email
              maxLength: 254
              type: string
            name:
              description: Display name.
              maxLength: 255
              type:
                - string
                - 'null'
          required:
            - email
          type: object
        html_body:
          description: HTML body, preserved when saved.
          maxLength: 1000000
          type: string
        id:
          description: Stable draft ID.
          type: string
        in_reply_to:
          description: Snapshotted parent message identifiers.
          items:
            type: string
          type: array
        message_id:
          description: Saved message ID; absent until saving finishes.
          type:
            - string
            - 'null'
        references:
          description: Snapshotted conversation identifiers.
          items:
            type: string
          type: array
        reply_to:
          description: Authorised reply addresses; defaults to this inbox.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 20
          type: array
        reply_to_message_id:
          description: Original message this draft replies to.
          type: string
        revision:
          description: Current draft revision.
          exclusiveMinimum: 0
          type: integer
        schedule_version:
          description: >-
            Schedule control version. Changes whenever a schedule is created,
            moved or cancelled.
          minimum: 0
          type: integer
        scheduled_for:
          description: >-
            Requested earliest send time, retained after sending. Null when no
            schedule is set.
          format: date-time
          type:
            - string
            - 'null'
        status:
          description: Saving or sending state.
          enum:
            - preparing
            - ready
            - scheduled
            - sending
            - queued
            - uncertain
            - failed
            - deleted
          type: string
        subject:
          description: Subject; may be empty.
          maxLength: 998
          type: string
        text_body:
          description: Plain-text body.
          maxLength: 1000000
          type: string
        to:
          description: Primary recipients; at most 50 total across To, Cc and Bcc.
          items:
            additionalProperties: false
            properties:
              email:
                description: Email address.
                format: email
                maxLength: 254
                type: string
              name:
                description: Display name.
                maxLength: 255
                type:
                  - string
                  - 'null'
            required:
              - email
            type: object
          maxItems: 50
          type: array
      required:
        - id
        - revision
        - status
        - message_id
        - scheduled_for
        - schedule_version
        - failure_code
        - in_reply_to
        - references
      type: object
    ResponseMeta:
      additionalProperties: false
      properties:
        request_id:
          example: req_clxxxxxxxxxxxxxxxxxxxxxxxxx
          type: string
      required:
        - request_id
      type: object
    ApiErrorDetail:
      additionalProperties: false
      properties:
        code:
          description: >-
            Machine-readable issue code from the validator (e.g. zod issue
            code).
          example: invalid_string
          type: string
        field:
          description: Dot-path of the offending request field.
          example: recipient.email
          type: string
        message:
          description: Human-readable issue description.
          type: string
      required:
        - field
        - code
        - message
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: API Key
      description: >-
        Sendmux API key. Use a root API key for Management API routes, or a
        mailbox credential for Mailbox API routes. Obtain keys from the
        dashboard under API Keys.
      scheme: bearer
      type: http
    oauth2:
      description: >-
        Use the authorisation-code flow with S256 PKCE and
        resource=https://sendmux.ai/api. The user selects the team, API access
        and mailboxes during consent. OAuth access tokens authenticate HTTP API
        requests; use separate credentials for SMTP and IMAP.
      flows:
        authorizationCode:
          authorizationUrl: https://app.sendmux.ai/oauth/authorize
          refreshUrl: https://app.sendmux.ai/oauth/token
          scopes:
            analytics.*: All analytics operations
            analytics.read: View key usage analytics and verification logs
            billing.*: All billing operations
            billing.auto_topup: Configure auto top-up settings
            billing.read: View balance, transactions, invoices
            billing.topup: Purchase balance top-ups
            domain.*: All domain operations
            domain.create: Add sending domains
            domain.delete: Remove domains
            domain.read: List/view domains and DNS status
            domain.verify: Trigger domain verification
            email.receive: Authorise email reception
            email.send: Send email through the HTTP API
            key.*: All key management operations
            key.create: Create new API keys (both root and mailbox)
            key.read: List/view API keys and their metadata
            key.revoke: Revoke API keys
            key.rotate: Rotate API keys
            logs.*: All log operations
            logs.read: View delivery logs
            mailbox.admin.*: All mailbox admin operations
            mailbox.admin.create: Create mailboxes (admin-level)
            mailbox.admin.delete: Delete mailboxes (admin-level)
            mailbox.admin.manage: Manage all mailbox settings
            mailbox.admin.read: List/view mailboxes (admin-level)
            mailbox.drafts.write: Create and edit saved mailbox drafts
            mailbox.read: Read mailbox contents (folders, messages)
            mailbox.settings.update: Update own mailbox settings (signature, auto-reply)
            provider.*: All provider operations
            provider.create: Add email provider accounts (Google, Microsoft, SMTP)
            provider.delete: Remove provider accounts
            provider.read: List/view provider accounts and connection status
            provider.update: Update provider settings, refresh tokens
            routing.*: All routing operations
            routing.create: Create delivery groups
            routing.delete: Remove delivery groups
            routing.read: List/view delivery groups and routing rules
            routing.update: Update delivery group configuration
            team.*: All team operations
            team.members.invite: Invite team members
            team.members.remove: Remove team members
            team.members.roles: Change member roles
            team.read: View team settings and members
            team.update: Update team settings
            webhook.*: All webhook operations
            webhook.create: Create webhook subscriptions
            webhook.delete: Delete webhook subscriptions
            webhook.manage: Rotate signing secret + send test events
            webhook.read: List/view webhook subscriptions
            webhook.update: Update webhook URL, event types, enabled flag
          tokenUrl: https://app.sendmux.ai/oauth/token
      type: oauth2

````

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