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

# Get Email Drafts

> Read exact unsent drafts in one connected mailbox. Pass one to twenty draft resource IDs, in request order. Duplicate IDs are read once. The result includes a per-draft outcome for every distinct ID.

### Authorization

Requires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.



## OpenAPI

````yaml /openapi.json post /api/v1/email/drafts/query
openapi: 3.1.0
info:
  title: OmniCommerce API
  version: 1.0.0
  license:
    name: Proprietary
    url: https://omnicommerce.sg/terms
  description: >-
    OmniCommerce API surface for agents and developer integrations. Includes
    public endpoints (merchant discovery, product search, compare, catalog, ACO
    retrieval) and authenticated endpoints (product management via API key
    Bearer tokens).
servers:
  - url: https://omnicommerce.ai
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: ads
    description: ads
    x-group: Ads
  - name: agentic-checkout
    description: Merchant-fulfilled agentic checkout
    x-group: Agentic Checkout
  - name: agents
    description: agents
    x-group: Agents
  - name: analytics
    description: Sales performance across marketplaces
    x-group: Analytics
  - name: aops
    description: Agent operating procedures
    x-group: AOPs
  - name: bots
    description: bots
    x-group: Bots
  - name: branding
    description: branding
    x-group: Branding
  - name: campaigns
    description: Campaign briefs, offer windows, and marketplace runs
    x-group: Campaigns
  - name: catalog
    description: catalog
    x-group: Catalog
  - name: commerce
    description: commerce
    x-group: Commerce
  - name: developer-platform
    description: Authenticated developer platform APIs
    x-group: Developer Platform
  - name: documents
    description: Knowledge base document uploads
    x-group: Knowledge Base
  - name: email
    description: email
    x-group: Email
  - name: follow-ups
    description: follow-ups
    x-group: Follow Ups
  - name: inventory
    description: Inventory quantities, planning signals, and marketplace listing absence
    x-group: Inventory
  - name: looks
    description: AI-styled product looks
    x-group: Looks
  - name: oauth
    description: OAuth token endpoints
    x-group: OAuth
  - name: orders
    description: Workspace and agentic orders
    x-group: Orders
  - name: organizations
    description: Organization management
    x-group: Organizations
  - name: price-books
    description: Marketplace list-price markup rules
    x-group: Price Books
  - name: products
    description: Product CRUD, bulk import, enrichment, publish, and delist
    x-group: Products
  - name: promotions
    description: Central promotions and marketplace sync
    x-group: Promotions
  - name: public-agent
    description: Public agent discovery and catalog APIs
    x-group: Public Agent
  - name: returns
    description: returns
    x-group: Returns
  - name: review-queue
    description: review-queue
    x-group: Review Queue
  - name: reviews
    description: Marketplace product reviews and seller replies
    x-group: Reviews
  - name: scripts
    description: scripts
    x-group: Scripts
  - name: settlements
    description: settlements
    x-group: Settlements
  - name: ucp
    description: Universal Commerce Protocol
    x-group: UCP
  - name: wiki
    description: wiki
    x-group: Wiki
paths:
  /api/v1/email/drafts/query:
    post:
      tags:
        - email
      summary: Get Email Drafts
      description: >-
        Read exact unsent drafts in one connected mailbox. Pass one to twenty
        draft resource IDs, in request order. Duplicate IDs are read once. The
        result includes a per-draft outcome for every distinct ID.


        ### Authorization


        Requires `email:read` and the integration permission the matching chat
        tool needs, with a person's credential: a CLI login, a signed-in
        session, or the SDK key inside your own chat sandbox. Only your own
        connected mailboxes are reachable; another account's `connectionId` is
        refused.
      operationId: post_v1_email_drafts_query
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                connectionId:
                  type: string
                  minLength: 1
                  maxLength: 120
                  description: >-
                    Exact mailbox connection ID from email_list_accounts or the
                    original draft result.
                draftIds:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: string
                    minLength: 1
                    maxLength: 500
                    pattern: ^[A-Za-z0-9_+/=-]+$
                  description: >-
                    One to 20 provider draft IDs. Use Gmail draft resource IDs
                    or Outlook draft message IDs from the exact mailbox. Never
                    use conversation IDs.
                organizationId:
                  description: >-
                    Required for session auth. Optional for API keys, which
                    already belong to one organization.
                  type: string
                  minLength: 1
                  maxLength: 120
              required:
                - connectionId
                - draftIds
              additionalProperties: false
            example:
              connectionId: connected-mailbox
              draftIds:
                - draft-1
      responses:
        '200':
          description: Ordered draft data and lookup outcomes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  operationId:
                    type: string
                  status:
                    type: string
                  data:
                    type: object
                    required:
                      - success
                      - connectionId
                      - draftIds
                      - succeededCount
                      - failedCount
                      - results
                    properties:
                      connectionId:
                        type: string
                      provider:
                        type: string
                        enum:
                          - gmail
                          - outlook
                      emailAddress:
                        type: string
                      success:
                        type: boolean
                      draftIds:
                        type: array
                        items:
                          type: string
                      succeededCount:
                        type: integer
                      failedCount:
                        type: integer
                      results:
                        type: array
                        items:
                          type: object
                          required:
                            - draftId
                            - success
                          properties:
                            draftId:
                              type: string
                            success:
                              type: boolean
                            code:
                              type: string
                              enum:
                                - draft_not_found
                            error:
                              type: string
                            draft:
                              type: object
                              properties:
                                draftId:
                                  type: string
                                messageId:
                                  type: string
                                threadId:
                                  type:
                                    - string
                                    - 'null'
                                subject:
                                  type: string
                                to:
                                  type: string
                                cc:
                                  type: string
                                bcc:
                                  type: string
                                bodyText:
                                  type: string
                                webLink:
                                  type:
                                    - string
                                    - 'null'
                                isDraft:
                                  type: boolean
                                  const: true
        '400':
          description: >-
            Invalid request, no connected mailbox, a mailbox that needs
            reconnecting, or a provider refusal (`error` says which).
        '401':
          description: Unauthorized
        '403':
          description: >-
            Missing scope or integration permission, or a credential that acts
            for no person: organization API clients, Applications and Computer
            previews cannot reach mail.
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Bearer API key for server-to-server access. Session auth is also
        supported in first-party UI flows.

````

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