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

# Send Email

> SendLayer sends emails through the API based on JSON input. The JSON properties, such as `Subject`, `HTMLContent`, and `PlainContent`, are converted to a valid message when sent to the recipient.

**Note:** A table containing custom error codes can be found in **Schemas &raquo; Error codes**.



## OpenAPI

````yaml api-reference/sendlayer.json post /email
openapi: 3.0.3
info:
  title: SendLayer API
  version: 1.0.1
  description: >-
    Welcome to the SendLayer API! To learn how to access your SendLayer API key,
    check out our tutorial on <a
    href="https://sendlayer.com/docs/managing-api-keys/" title="Managing API
    Keys">managing API keys</a>. <br/><br/> For a quick introduction to sending
    emails, see our guide to <a
    href="https://sendlayer.com/docs/getting-started-with-the-sendlayer-api/"
    title="Getting Started With the SendLayer API">getting started with the
    SendLayer API</a>.<br/><br/><strong>Need help?</strong> <a
    href="https://sendlayer.com/contact/" title="SendLayer Support Page">Contact
    the SendLayer support team</a>
  contact:
    name: SendLayer Support
    url: https://sendlayer.com/contact
    email: support@sendlayer.com
servers:
  - url: https://console.sendlayer.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Email
    description: Operations related to email sending
  - name: Events
    description: Operations related to retrieving email events
  - name: Webhooks
    description: Operations related to creating and managing webhooks
paths:
  /email:
    post:
      tags:
        - Email
      summary: Send an email with an optional attachment
      description: >-
        SendLayer sends emails through the API based on JSON input. The JSON
        properties, such as `Subject`, `HTMLContent`, and `PlainContent`, are
        converted to a valid message when sent to the recipient.


        **Note:** A table containing custom error codes can be found in
        **Schemas &raquo; Error codes**.
      operationId: sendEmail
      requestBody:
        description: >-
          Below is the JSON payload required for sending a single email. Be sure
          to replace the example email addresses with valid email addresses in
          the `From` and `To` objects.


          **Note:** The `From` email address must contain your sender domain,
          which is the domain that you’ve verified in SendLayer. For example, if
          you’ve authorized **example.com** you’ll need to use
          **your-email@example.com**.

          Additionally, you can send emails to multiple recipients by adding
          more objects to the `To`, `CC`,and `BCC` arrays within the specified
          limits. See our [Getting Started
          guide](https://sendlayer.com/docs/getting-started-with-the-sendlayer-api/#limit)
          for more details.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailRequestBody'
      responses:
        '200':
          description: |-
            OK 

            A successfully delivered email returns the `MessageID`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostEmailResponse'
components:
  schemas:
    EmailRequestBody:
      title: POST email request body
      type: object
      required:
        - From
        - To
        - Subject
        - ContentType
        - HTMLContent
      properties:
        From:
          type: object
          properties:
            name:
              type: string
              example: Paulie Paloma
            email:
              type: string
              example: paulie@example.com
        To:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                example: Pattie Paloma
              email:
                type: string
                example: pattie@exampledomain.com
        CC:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                example: Pattie Paloma CC
              email:
                type: string
                example: pattie.cc@exampledomain.com
        BCC:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                example: Pattie Paloma BCC
              email:
                type: string
                example: pattie.bcc@exampledomain.com
        ReplyTo:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                example: Pattie Paloma ReplyTo
              email:
                type: string
                example: pattie.reply@exampledomain.com
        Subject:
          type: string
          example: This is the email subject
        ContentType:
          type: string
          example: HTML
        HTMLContent:
          type: string
          example: >-
            <html><body><p>This is a test email sent with the <a
            href=\"https://sendlayer.com\">SendLayer</a> API!</p></body></html>
        Tags:
          type: array
          items:
            type: string
            example: newsletter, daily
        Headers:
          type: object
          properties:
            X-Mailer:
              type: string
              example: test mailer
            X-Test:
              type: string
              example: test header
        Attachments:
          type: array
          items:
            type: object
            properties:
              Content:
                type: string
                example: BASE 64 ENCODED STRING
              Type:
                type: string
                example: image/png
              Filename:
                type: string
                example: test.png
              Disposition:
                type: string
                example: attachment
              ContentId:
                type: integer
                example: 0
    PostEmailResponse:
      title: POST email response
      description: A successfully delivered email returns the MessageID
      type: object
      properties:
        MessageID:
          type: string
          example: 8912e59e-ec88-bcd6-45dd-0012fe223ab6
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````