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

# Send Email

> Sends a single email from one of your connected domains and returns its `message_id`.

`from` can be a full email address or just a domain. With a domain, one of the domain's email accounts is picked for you. The domain must be connected to your account, set up, and past its initial warmup period.

Each email uses 1 credit from the sending workspace. Emails to addresses on your suppression list, or that have previously hard bounced, are rejected with `422`.

Use the returned `message_id` to fetch the email with `Retrieve Sent Email`, to match webhook events, and as `reply_to_message_id` to continue the conversation. It's also sent with the email in the `X-Deliveryman-Message-Id` header.

Every email includes one-click unsubscribe headers. Unsubscribes are added to your suppression list and sent to your webhook as `unsubscribe` events.

**Strongly recommended:** leave 5 to 10 minutes between emails sent from the same domain. Sending many emails from one domain in a short time can hurt your domain and IP reputation.

**Send pacing:** emails from one sending domain go out at least a minimum interval apart. If you send before that interval has passed, the email is queued instead of rejected. The response has status `202`, `status: "scheduled"` and the time it will go out in `scheduled_for`. You get a `sent` webhook when it goes out, or check it with `Retrieve Sent Email`. A scheduled email can't be replied to until it's been sent. If it can't be sent at all, you get a `failed` webhook. Each domain's queue holds a limited number of emails. Once it's full, requests are rejected with `429`.



## OpenAPI

````yaml /openapi.yml post /api/v2/send/
openapi: 3.1.1
info:
  title: DeliverymanAI API
  version: 2.0.0
  description: >-
    API documentation for DeliverymanAI. Send emails, track their delivery and
    engagement, read replies, verify addresses, manage your suppression list and
    receive webhook events.


    **Strongly recommended:** leave 5 to 10 minutes between emails sent from the
    same domain. Sending many emails from one domain in a short time can hurt
    your domain and IP reputation.


    **Rate limits:** emails from one sending domain go out at least a minimum
    interval apart. If you send sooner, the email is queued and `Send Email`
    returns `202`. Each endpoint also caps how many requests your account can
    make per minute. Over the cap you get `429` with a `Retry-After` header.
    Treat these limits as an upper bound and keep to the gap recommended above.
servers:
  - url: https://api.deliveryman.ai
    description: Deliveryman API Server
security: []
paths:
  /api/v2/send/:
    post:
      tags:
        - Email
      summary: Send Email
      description: >-
        Sends a single email from one of your connected domains and returns its
        `message_id`.


        `from` can be a full email address or just a domain. With a domain, one
        of the domain's email accounts is picked for you. The domain must be
        connected to your account, set up, and past its initial warmup period.


        Each email uses 1 credit from the sending workspace. Emails to addresses
        on your suppression list, or that have previously hard bounced, are
        rejected with `422`.


        Use the returned `message_id` to fetch the email with `Retrieve Sent
        Email`, to match webhook events, and as `reply_to_message_id` to
        continue the conversation. It's also sent with the email in the
        `X-Deliveryman-Message-Id` header.


        Every email includes one-click unsubscribe headers. Unsubscribes are
        added to your suppression list and sent to your webhook as `unsubscribe`
        events.


        **Strongly recommended:** leave 5 to 10 minutes between emails sent from
        the same domain. Sending many emails from one domain in a short time can
        hurt your domain and IP reputation.


        **Send pacing:** emails from one sending domain go out at least a
        minimum interval apart. If you send before that interval has passed, the
        email is queued instead of rejected. The response has status `202`,
        `status: "scheduled"` and the time it will go out in `scheduled_for`.
        You get a `sent` webhook when it goes out, or check it with `Retrieve
        Sent Email`. A scheduled email can't be replied to until it's been sent.
        If it can't be sent at all, you get a `failed` webhook. Each domain's
        queue holds a limited number of emails. Once it's full, requests are
        rejected with `429`.
      operationId: v2_send_email
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendEmailRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/SendEmailRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/SendEmailRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendEmailResponse'
          description: Email Sent
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendEmailResponse'
          description: Email Scheduled, waiting for the domain's next send slot
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: Bad Request, or the domain can't send right now
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: No Credits Remaining
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: API Sending Disabled For This Account
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: Sender or `reply_to_message_id` Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: '`reply_to_message_id` Refers To An Email That Hasn''t Been Sent Yet'
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: Recipient Is Suppressed
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: Rate Limited, or the domain's send queue is full
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: Internal Server Error
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
          description: Mail Server Error
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: bash
          label: curl
          source: |-
            curl -X POST "https://api.deliveryman.ai/api/v2/send/" \
              -H "X-Api-Key: YOUR_API_KEY" \
              -H "Content-Type: application/json" \
              -d '{
                "from": "draftss.com",
                "to": "alex@draftss.com",
                "subject": "Quick question about your onboarding flow",
                "html_content": "<p>Hi Alex, do you have 15 minutes this week?</p>",
                "open_tracking": true,
                "click_tracking": true,
                "reply_to_message_id": "em_9f2c4a7b1e0d3c5a8b6f4e21"
              }'
components:
  schemas:
    SendEmailRequest:
      properties:
        from:
          description: >-
            Sender. Either a full email address from one of your connected
            domains (`jane@draftss.com`), or just the domain (`draftss.com`), in
            which case one of the domain's email accounts is picked for you. The
            domain must be connected to your account and ready to send.
          title: From
          type: string
        to:
          description: Recipient email address.
          format: email
          title: To
          type: string
        subject:
          description: Email subject line. Can't be empty.
          maxLength: 998
          minLength: 1
          pattern: \S
          title: Subject
          type: string
        html_content:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            HTML body of the email. Provide exactly one of `html_content` or
            `plain_text_content`.
          title: Html Content
        plain_text_content:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Plain text body of the email. Provide exactly one of `html_content`
            or `plain_text_content`. Open and click tracking are not available
            for plain text emails.
          title: Plain Text Content
        open_tracking:
          default: false
          description: >-
            Track when the recipient opens the email. Only applies to HTML
            emails. Defaults to `false`.
          title: Open Tracking
          type: boolean
        click_tracking:
          default: true
          description: >-
            Track clicks on links in the email. Only applies to HTML emails.
            Defaults to `true`.
          title: Click Tracking
          type: boolean
        reply_to_message_id:
          anyOf:
            - maxLength: 40
              type: string
            - type: 'null'
          default: null
          description: >-
            Send this email as a reply in an existing conversation. Pass the
            `message_id` of an email you sent, or of a reply you received (from
            `Inbox` or the `reply` webhook). The email is threaded under the
            original conversation in the recipient's mail client, and its
            replies show up in the same `Inbox` thread.
          title: Reply To Message Id
      required:
        - from
        - to
        - subject
      title: SendEmailRequest
      type: object
    SendEmailResponse:
      type: object
      description: The email that was sent or scheduled.
      properties:
        from:
          type: string
          description: >-
            Email account the email was sent from. When `from` was a domain,
            this is the account picked.
        message_id:
          type: string
          description: >-
            Unique ID of the email, available as soon as it's accepted,
            including while it's `scheduled`. Use it to look the email up with
            `Retrieve Sent Email`, to match webhook events, and as
            `reply_to_message_id` to reply in the same conversation. It's also
            sent with the email in the `X-Deliveryman-Message-Id` header.
        to:
          type: string
          description: Recipient email address.
        status:
          allOf:
            - $ref: '#/components/schemas/SendEmailResponseStatusEnum'
          description: >-
            `queued`: handed to the mail server now (HTTP 201). `scheduled`:
            your sending domain's send interval hasn't passed yet, so the email
            waits in a queue and goes out at `scheduled_for` (HTTP 202).


            * `queued` - queued

            * `scheduled` - scheduled
        subject:
          type: string
          description: Subject line of the email.
        scheduled_for:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When a `scheduled` email will be handed to the mail server, or null
            if it was sent right away. ISO 8601, UTC.
        sent_on:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the recipient's mail server accepted the email. Null until
            delivery is confirmed. ISO 8601, UTC.
      required:
        - from
        - message_id
        - status
        - subject
        - to
    MessageResponse:
      type: object
      description: A message describing the result of the request, or what went wrong.
      properties:
        message:
          type: string
          description: Human readable description of the result or error.
      required:
        - message
    SendEmailResponseStatusEnum:
      enum:
        - queued
        - scheduled
      type: string
      description: |-
        * `queued` - queued
        * `scheduled` - scheduled
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Your API key. In the dashboard, go to Integrations and open Deliveryman
        API Keys to create one.

````

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