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

# Edit email draft

> Update an unsent draft without sending it. Only supplied fields change. Read the draft first and pass its exact updatedAt; the response contains the new version. Draft ownership and reply context are fixed. Edits are blocked while a send is pending or accepted. Requires MCP send scope and respects inbox and pod API-key scopes.



## OpenAPI

````yaml https://api.openmail.sh/openapi.json patch /v1/drafts/{draftId}
openapi: 3.0.3
info:
  title: OpenMail API
  description: >-
    Email infrastructure API for AI agents. Create inboxes, send and receive
    email, and get real-time notifications via webhooks.
  version: 1.0.0
  license:
    name: Proprietary
servers:
  - url: https://api.openmail.sh
security:
  - bearerAuth: []
tags:
  - name: pods
    description: Isolated sub-accounts for your end users or tenants
  - name: inboxes
    description: Email inboxes and their webhook configuration
  - name: domains
    description: >-
      Custom domains: add your own sending/receiving domain, publish DNS, and
      verify it
  - name: owned-domains
    description: >-
      Domains your organisation controls but does not send from. Prove ownership
      with one TXT record and mail to their addresses stops counting toward the
      cold outreach limits.
  - name: messages
    description: Sending and listing messages
  - name: drafts
    description: Create, view, edit and send saved email drafts
  - name: threads
    description: Conversation threads and read status
  - name: attachments
    description: Downloading and extracting text from attachments
  - name: policy
    description: >-
      Correspondent policy — provider-enforced allow/block rules and allowlist
      mode, scoped per account, pod, or inbox. Account-wide key only.
  - name: limits
    description: >-
      Sending limits: today's cold outreach caps on new recipients, per account,
      inbox, and domain, and what raises them
  - name: webhooks
    description: >-
      Webhook endpoints: where events are sent, how each request is
      authenticated, and the delivery log. Account-wide key only.
  - name: feedback
    description: Reporting bugs, friction, and feature requests to the OpenMail team
paths:
  /v1/drafts/{draftId}:
    patch:
      tags:
        - drafts
      summary: Edit email draft
      description: >-
        Update an unsent draft without sending it. Only supplied fields change.
        Read the draft first and pass its exact updatedAt; the response contains
        the new version. Draft ownership and reply context are fixed. Edits are
        blocked while a send is pending or accepted. Requires MCP send scope and
        respects inbox and pod API-key scopes.
      operationId: editDraft
      parameters:
        - schema:
            type: string
            minLength: 1
          in: path
          name: draftId
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - updatedAt
              properties:
                updatedAt:
                  type: string
                  format: date-time
                  description: >-
                    Exact updatedAt from the draft being edited. A stale version
                    returns 409; read the draft again before reapplying your
                    changes.
                inboxId:
                  type: string
                  minLength: 1
                  description: >-
                    Optional ownership check. Must match the original sending
                    inbox; edits cannot move a draft.
                to:
                  type: string
                  format: email
                  maxLength: 254
                  description: Recipient, or null to clear it.
                  nullable: true
                cc:
                  type: array
                  maxItems: 100
                  items:
                    type: string
                    format: email
                    maxLength: 254
                  description: Replace copy recipients; use [] to clear.
                bcc:
                  type: array
                  maxItems: 100
                  items:
                    type: string
                    format: email
                    maxLength: 254
                  description: Replace blind-copy recipients; use [] to clear.
                subject:
                  type: string
                  maxLength: 998
                  description: >-
                    Replacement subject. Reply drafts must retain their original
                    subject.
                removeAttachmentIndex:
                  type: integer
                  minimum: 0
                  description: >-
                    Zero-based index among regular (non-inline) attachments to
                    remove.
                bodyHtml:
                  type: string
                  maxLength: 500000
                  description: >-
                    Replacement HTML body. The plain-text fallback is generated
                    automatically. Use an empty string to clear the body, or
                    omit to preserve it. Retain cid: references for inline
                    images you want to keep. Plain-text body inputs are not
                    accepted.
      responses:
        '200':
          description: Updated unsent draft
          content:
            application/json:
              schema:
                description: Updated unsent draft
                type: object
                required:
                  - id
                  - inboxId
                  - to
                  - cc
                  - bcc
                  - subject
                  - bodyText
                  - bodyHtml
                  - createdAt
                  - updatedAt
                properties:
                  id:
                    type: string
                  inboxId:
                    type: string
                  threadId:
                    type: string
                    description: Thread this draft will reply to when sent.
                    nullable: true
                  sourceThreadId:
                    type: string
                    description: Conversation this draft was composed from.
                    nullable: true
                  attachments:
                    type: array
                    items:
                      type: object
                      required:
                        - filename
                        - contentType
                        - sizeBytes
                      properties:
                        filename:
                          type: string
                        contentType:
                          type: string
                        sizeBytes:
                          type: integer
                        contentId:
                          type: string
                          description: >-
                            Identifier referenced by cid: in bodyHtml for an
                            inline attachment.
                        url:
                          type: string
                  to:
                    type: string
                    nullable: true
                  cc:
                    type: array
                    items:
                      type: string
                  bcc:
                    type: array
                    items:
                      type: string
                  subject:
                    type: string
                  bodyText:
                    type: string
                    nullable: true
                  bodyHtml:
                    type: string
                    nullable: true
                  createdAt:
                    type: string
                    format: date-time
                  updatedAt:
                    type: string
                    format: date-time
        '400':
          description: Invalid draft or pagination
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Missing, invalid, or expired credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Inbox is outside the API key scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Inbox or draft not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Draft changed or sending is in progress or already accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: Attachment size limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Account storage limit reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      additionalProperties: true
      properties:
        error:
          type: string
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````

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