v1

latestOpenAPI 3.0.02026-07-2491237338.9 KB
Emails

Send an email

Sends an outbound email message.

post/emails

Request body

fromstring required
  • 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.
tostring required
  • The intended recipients' email addresses.
  • Supports a comma-separated list of one or more addresses. Max items: 100.
subjectstring required

The email subject, which contains a short string identifying the topic of the message. Max length: 255.

contentstring required
  • 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 provided by YCloud for testing.
contentType'text/html' | 'text/plain'

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.

variablesobject[]
  • 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.
ccstring

Recipients who will receive a copy of the email.

bccstring

Recipients who will receive a blind carbon copy of the email.

replyTostring

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.

summarystring

This is a summary of your email. Max length: 70.

externalIdstring

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.

callbackUrlstring

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 request

{
  "from": "SupportTeam<support@example.com>",
  "to": "to1@example.com,Nick<to2@example.com>",
  "content": "This is a test message from #nick#.",
  "cc": "cc1@example.com,Nick<cc2@example.com>",
  "bcc": "bcc1@example.com,Nick<bcc2@example.com>",
  "summary": "This is a summary.",
  "callbackUrl": "https://httpbin.org/anything?tag=api-email"
}

Response

The request is successfully accepted.

idstring required

Unique ID for the object.

subjectstring

The email subject, which contains a short string identifying the topic of the message.

summarystring

This is a summary of your email. Max length: 70.

contentType'text/html' | 'text/plain'

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.

externalIdstring

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.

callbackUrlstring

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.

createTimestring date-time

The time at which this message was created, formatted in RFC 3339. e.g., 2022-06-01T12:00:00.000Z.

totalRecipientsinteger

Total recipients of this message, including to, cc and bcc.

totalPricenumber double

Total price of this message.

currencystring

Price currency. ISO 4217 currency code.

Example response

{
  "from": {
    "name": "Support Team",
    "address": "team@example.com"
  },
  "to": [
    {
      "name": "Support Team",
      "address": "team@example.com"
    }
  ],
  "cc": [
    {
      "name": "Support Team",
      "address": "team@example.com"
    }
  ],
  "bcc": [
    {
      "name": "Support Team",
      "address": "team@example.com"
    }
  ],
  "replyTo": [
    {
      "name": "Support Team",
      "address": "team@example.com"
    }
  ],
  "summary": "This is a summary.",
  "callbackUrl": "https://httpbin.org/anything?tag=api-email",
  "createTime": "2022-06-01T12:00:00.000Z",
  "totalRecipients": 3,
  "totalPrice": 0.0085,
  "currency": "USD"
}