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

# Get a draft

> One draft (an email object with `object` "Draft").



## OpenAPI

````yaml /api-reference/openapi.yaml get /drafts/{draft_id}
openapi: 3.1.0
info:
  title: PigeonPost API
  version: 1.0.0
  description: >
    Connect your users' mailboxes (Gmail with an app password, and any IMAP/SMTP
    provider), read, send and manage their email, and

    receive webhooks when something changes. The API follows Unipile's v2
    conventions (ids, lists,

    events); its own version is v1.


    **Authentication:** every request needs your access token in the `X-API-KEY`
    header. Create

    tokens in your dashboard under **API keys**, or with `POST
    /api/v1/api-keys`.


    **Base URL:** `https://{your DSN}/api/v1`. Your DSN is shown in your
    dashboard.


    **Ids** carry their type: `acc_…` (account), `email_…`, `att_…`
    (attachment), `fld_…`

    (folder), `drf_…` (draft), `we_…` (webhook endpoint), `evt_…` (event),
    `pk_…` (API key).


    **Lists** are `{ "object": "<Plural>", "data": [...], "has_more": true|false
    }`. Accounts,

    webhook endpoints, conversations and API keys page with `offset` and
    `limit`. Emails, drafts

    and contacts page with a `cursor`: pass the `cursor` of a response back to
    get the next page.


    **Errors** always have the same JSON shape: `status`, `type`, `title`,
    `detail`.
servers:
  - url: https://{dsn}/api/v1
    description: Your workspace's DSN, from your dashboard
    variables:
      dsn:
        default: mail-api.example.com
        description: Your DSN, for example mail-api.example.com
security:
  - apiKey: []
tags:
  - name: Auth
    description: Connect a mailbox from your app (IMAP/SMTP).
  - name: Accounts
    description: The mailboxes connected to your workspace.
  - name: Emails
    description: Read, search, send, change and delete emails.
  - name: Attachments
    description: Download the files attached to an email.
  - name: Drafts
    description: Drafts saved in the user's mailbox.
  - name: Folders
    description: Folders (Gmail labels appear as folders over IMAP).
  - name: Contacts
    description: The people an account has emailed with.
  - name: Webhooks
    description: Get notified when something happens in a mailbox.
  - name: API keys
    description: Access tokens for this API.
paths:
  /drafts/{draft_id}:
    parameters:
      - $ref: '#/components/parameters/draft_id'
      - $ref: '#/components/parameters/draft_account_id'
    get:
      tags:
        - Drafts
      summary: Get a draft
      description: One draft (an email object with `object` "Draft").
      operationId: getDraft
      responses:
        '200':
          description: The draft.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Email'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    draft_id:
      name: draft_id
      in: path
      required: true
      description: The `drf_…` id from creation, or the synced draft's `email_…` id.
      schema:
        type: string
      example: drf_r-4419383208612875012
    draft_account_id:
      name: account_id
      in: query
      description: >-
        The draft's account. Needed only right after creating it, before it has
        synced.
      schema:
        type: string
  schemas:
    Email:
      type: object
      properties:
        object:
          type: string
          enum:
            - Email
            - Draft
        id:
          type: string
          description: '`email_…`; stays the same when the email moves.'
        account_id:
          type: string
        provider_id:
          type: string
        message_id:
          type: string
        thread_id:
          type: string
        date:
          type: string
          format: date-time
        subject:
          type: string
        snippet:
          type: string
        body:
          type: string
        body_plain:
          type: string
        from_attendee:
          $ref: '#/components/schemas/Attendee'
        to_attendees:
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
        cc_attendees:
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
        bcc_attendees:
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
        reply_to_attendees:
          type: array
          items:
            $ref: '#/components/schemas/Attendee'
        in_reply_to:
          type:
            - object
            - 'null'
          properties:
            message_id:
              type: string
            id:
              type:
                - string
                - 'null'
              description: The replied-to email, when the account has it.
        references:
          type: array
          items:
            type: string
        folders:
          type: array
          items:
            type: string
        folder_ids:
          type: array
          items:
            type: string
        role:
          $ref: '#/components/schemas/Role'
        unread:
          type: boolean
        starred:
          type: boolean
        has_attachments:
          type: boolean
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        size:
          type: integer
        origin:
          type: string
          enum:
            - api
            - external
          description: '`api`: sent through this API.'
        tracking_id:
          type:
            - string
            - 'null'
          description: Open/click tracking of this email (`trk_…`).
        draft_id:
          type: string
          description: Drafts only.
        headers:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              value:
                type: string
    Attendee:
      type: object
      properties:
        display_name:
          type: string
        identifier:
          type: string
          format: email
      required:
        - identifier
    Role:
      type: string
      enum:
        - INBOX
        - SENT
        - DRAFTS
        - TRASH
        - SPAM
        - ARCHIVE
        - ALL
        - IMPORTANT
        - STARRED
        - UNKNOWN
    Attachment:
      type: object
      properties:
        id:
          type: string
          description: '`att_…`'
        name:
          type: string
        extension:
          type: string
          description: From the file name, e.g. `pdf`. Empty when there is none.
        size:
          type: integer
        mime:
          type: string
        cid:
          type:
            - string
            - 'null'
          description: Content-ID of an image shown inside the body.
        inline:
          type: boolean
    Error:
      type: object
      properties:
        status:
          type: integer
        type:
          type: string
          enum:
            - errors/invalid_parameters
            - errors/unauthorized
            - errors/invalid_credentials
            - errors/not_found
            - errors/already_exists
            - errors/provider_rejected
            - errors/provider_error
            - errors/unexpected_error
        title:
          type: string
        detail:
          type: string
  responses:
    Unauthorized:
      description: The `X-API-KEY` header is missing, wrong or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 401
            type: errors/unauthorized
            title: Unauthorized
            detail: missing or invalid API key
    NotFound:
      description: Nothing with this id (a malformed or wrong-type id is also not found).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: 404
            type: errors/not_found
            title: Not found
            detail: email email_94a0d77db739407e932c3b97fef44aac not found
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-KEY
      description: Your access token, from your dashboard under **API keys**.

````

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