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

# Send an email

> Sends an outbound email message.



## OpenAPI

````yaml /openapi/endpoints/ycloud-api-v2.yaml post /emails
openapi: 3.0.0
info:
  description: >-
    The [YCloud](https://ycloud.com) API is organized around
    [REST](https://en.wikipedia.org/wiki/Representational_state_transfer). Our
    API is designed to have predictable, resource-oriented URLs, return
    [JSON](https://www.json.org) responses, and use standard HTTP response codes
    and verbs.
  version: v2
  title: YCloud API
  termsOfService: https://ycloud.com/terms-service
  contact:
    email: service@ycloud.com
servers:
  - url: https://api.ycloud.com/v2
    description: Base URL
security:
  - api_key: []
tags:
  - name: Balance
  - name: Contacts
  - name: Custom Events
  - name: Emails
  - name: SMS
  - name: Unsubscribers
  - name: Verify
  - name: Voices
  - name: Webhook Endpoints
  - name: WhatsApp Business Accounts
  - name: WhatsApp Inbound Messages
  - name: WhatsApp Media
  - name: WhatsApp Messages
  - name: WhatsApp Blocked Users
  - name: WhatsApp Groups
  - name: WhatsApp Calling
  - name: WhatsApp Phone Numbers
  - name: WhatsApp Templates
  - name: WhatsApp Flows
  - name: Meta Business Agent
  - name: WhatsApp Group Messages
externalDocs:
  description: Homepage
  url: https://ycloud.com
paths:
  /emails:
    post:
      tags:
        - Emails
      summary: Send an email
      description: Sends an outbound email message.
      operationId: email-send
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailSendRequest'
        required: true
      responses:
        '200':
          description: The request is successfully accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Email'
components:
  schemas:
    EmailSendRequest:
      type: object
      required:
        - from
        - to
        - subject
        - content
      properties:
        from:
          type: string
          description: >-
            - The sender's email. Its domain should be one that has been
            registered and activated in your account.

            - The sender's email address is required while the sender's name is
            optional. For example, both `support@example.com` and
            `Sender<support@example.com>` work.
          example: SupportTeam<support@example.com>
        to:
          type: string
          description: >-
            - The intended recipients' email addresses.

            - Supports a comma-separated list of one or more addresses. Max
            items: 100.
          example: to1@example.com,Nick<to2@example.com>
        subject:
          type: string
          description: >-
            The email subject, which contains a short string identifying the
            topic of the message. Max length: 255.
          maxLength: 255
        content:
          type: string
          description: >-
            - The email body. Max size: 150 KB.

            - Variables in the form of `#var_1#` are supported, they should be
            used together with the `variables` parameter. Variable keys only
            support letters, digits, and the underline character (`_`).

            - You can use the [Test
            Templates](https://helpdocs.ycloud.com/help-center/integrations/channels/email/email-template-samples)
            provided by YCloud for testing.
          example: 'This is a test message from #nick#.'
        contentType:
          $ref: '#/components/schemas/EmailContentType'
        variables:
          type: array
          description: >-
            - The variable key-value pairs that will replace the variable
            placeholders in `content` for each recipient. Variable keys are
            those that are wrapped with `#` as placeholders (e.g., `#var_1#`) in
            `content`. The placeholders will be replaced by variable values when
            sending the email.

            - The size of the array must be the same as the number of recipients
            in `to`. Be aware that `cc` and `bcc` addresses are excluded, and
            they can not receive emails that contain variables.

            - This parameter's size will be calculated together with the
            parameter `content`. The whole size must not exceed 150 KB.
          items:
            type: object
            description: Variable key-value pair.
            additionalProperties:
              type: string
        cc:
          type: string
          description: Recipients who will receive a copy of the email.
          example: cc1@example.com,Nick<cc2@example.com>
        bcc:
          type: string
          description: Recipients who will receive a blind carbon copy of the email.
          example: bcc1@example.com,Nick<bcc2@example.com>
        replyTo:
          type: string
          description: >-
            If this field exists, then the reply should go to the addresses
            indicated in that field and not to the address(es) indicated in the
            `from` field.
        summary:
          type: string
          description: 'This is a summary of your email. Max length: 70.'
          example: This is a summary.
          maxLength: 70
        externalId:
          type: string
          description: >-
            A unique (recommended) string to reference the object. This can be
            an order number or similar, and can be used to reconcile the object
            with your internal systems.
        callbackUrl:
          type: string
          description: >-
            Delivery report URL. You can provide a URL, and we will push the
            updated status report to your server in time. e.g.,
            https://httpbin.org/anything?tag=api.

            Note: We recommend configuring Webhook Endpoints instead.
          example: https://httpbin.org/anything?tag=api-email
    Email:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          description: Unique ID for the object.
          minLength: 6
          maxLength: 128
        from:
          $ref: '#/components/schemas/Mailbox'
          description: The sender's email address.
        to:
          type: array
          description: The intended recipients' email addresses.
          items:
            $ref: '#/components/schemas/Mailbox'
        cc:
          type: array
          description: Recipients who will receive a copy of the email.
          items:
            $ref: '#/components/schemas/Mailbox'
        bcc:
          type: array
          description: Recipients who will receive a blind carbon copy of the email.
          items:
            $ref: '#/components/schemas/Mailbox'
        replyTo:
          type: array
          description: >-
            If this field exists, then the reply should go to the addresses
            indicated in that field and not to the address(es) indicated in the
            `from` field.
          items:
            $ref: '#/components/schemas/Mailbox'
        subject:
          type: string
          description: >-
            The email subject, which contains a short string identifying the
            topic of the message.
          maxLength: 255
        summary:
          type: string
          description: 'This is a summary of your email. Max length: 70.'
          example: This is a summary.
          maxLength: 70
        contentType:
          $ref: '#/components/schemas/EmailContentType'
        externalId:
          type: string
          description: >-
            A unique (recommended) string to reference the object. This can be
            an order number or similar, and can be used to reconcile the object
            with your internal systems.
        callbackUrl:
          type: string
          description: >-
            Delivery report URL. You can provide a URL, and we will push the
            updated status report to your server in time. e.g.,
            https://httpbin.org/anything?tag=api.

            Note: We recommend configuring Webhook Endpoints instead.
          example: https://httpbin.org/anything?tag=api-email
        createTime:
          type: string
          format: date-time
          description: >-
            The time at which this message was created, formatted in [RFC
            3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g.,
            `2022-06-01T12:00:00.000Z`.
          example: '2022-06-01T12:00:00.000Z'
        totalRecipients:
          type: integer
          format: int32
          description: Total recipients of this message, including `to`, `cc` and `bcc`.
          example: 3
        totalPrice:
          type: number
          format: double
          description: Total price of this message.
          example: 0.0085
        currency:
          type: string
          description: >-
            Price currency. [ISO 4217 currency
            code](https://en.wikipedia.org/wiki/ISO_4217).
          example: USD
    EmailContentType:
      type: string
      description: >-
        The MIME type of the email content (`text/html` or `text/plain`). Be
        aware that We won't count click and open events for the type
        `text/plain`.
      enum:
        - text/html
        - text/plain
      x-enum-varnames:
        - TEXT_HTML
        - TEXT_PLAIN
    Mailbox:
      type: object
      description: Represents a mailbox.
      properties:
        name:
          type: string
          description: Name of the mailbox.
          example: Support Team
        address:
          type: string
          description: Address of the mailbox.
          example: team@example.com
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-Key
      in: header

````

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