# Transactional

Send transactional emails for order confirmations, password resets, and notifications.

{% hint style="success" %}
Best for: Real-time, one-to-one emails triggered by user actions
{% endhint %}

## Send transactional email

> Send a single transactional email with text, HTML, or template content.\
> \
> Use this endpoint for:\
> \- Order confirmations\
> \- Password reset emails\
> \- Account notifications\
> \- Welcome emails\
> \- System alerts<br>

```json
{"openapi":"3.1.0","info":{"title":"Transactional","version":"2.0.0"},"tags":[{"name":"send-email","description":"Send transactional emails for order confirmations, password resets, and notifications.\n\n{% hint style=\"success\" %}\nBest for: Real-time, one-to-one emails triggered by user actions\n{% endhint %}\n"}],"servers":[{"description":"Transactional Stream","url":"https://send.api.mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"schemas":{"EmailWithText":{"title":"Text Only","allOf":[{"$ref":"#/components/schemas/EmailSenderRequired"},{"$ref":"#/components/schemas/EmailRecipients"},{"$ref":"#/components/schemas/EmailReplyTo"},{"$ref":"#/components/schemas/EmailSubjectRequired"},{"$ref":"#/components/schemas/EmailTextRequired"},{"$ref":"#/components/schemas/EmailAttachments"},{"$ref":"#/components/schemas/EmailSendingHeaders"},{"$ref":"#/components/schemas/EmailCustomVariables"},{"$ref":"#/components/schemas/EmailCategory"}]},"EmailSenderRequired":{"type":"object","required":["from"],"properties":{"from":{"$ref":"#/components/schemas/Address"}}},"Address":{"type":"object","properties":{"email":{"type":"string","format":"email"},"name":{"type":"string"}}},"EmailRecipients":{"type":"object","properties":{"to":{"type":"array","maxItems":1000,"items":{"$ref":"#/components/schemas/Address"}},"cc":{"type":"array","maxItems":1000,"items":{"$ref":"#/components/schemas/Address"}},"bcc":{"type":"array","maxItems":1000,"items":{"$ref":"#/components/schemas/Address"}}}},"EmailReplyTo":{"type":"object","properties":{"reply_to":{"$ref":"#/components/schemas/Address"}}},"EmailSubjectRequired":{"type":"object","required":["subject"],"properties":{"subject":{"type":"string","minLength":1}}},"EmailTextRequired":{"type":"object","required":["text"],"properties":{"text":{"type":"string","minLength":1}}},"EmailAttachments":{"type":"object","properties":{"attachments":{"type":"array","items":{"type":"object","required":["content","filename"],"properties":{"content":{"type":"string","description":"Base64 encoded content"},"filename":{"type":"string"},"type":{"type":"string","description":"MIME type"},"disposition":{"type":"string","enum":["attachment","inline"],"default":"attachment"},"content_id":{"type":"string","description":"For inline attachments"}}}}}},"EmailSendingHeaders":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}}}},"EmailCustomVariables":{"type":"object","properties":{"custom_variables":{"type":"object","additionalProperties":{"type":"string"}}}},"EmailCategory":{"type":"object","properties":{"category":{"type":"string","maxLength":255}}},"EmailWithHtml":{"title":"HTML Only","allOf":[{"$ref":"#/components/schemas/EmailSenderRequired"},{"$ref":"#/components/schemas/EmailRecipients"},{"$ref":"#/components/schemas/EmailReplyTo"},{"$ref":"#/components/schemas/EmailSubjectRequired"},{"$ref":"#/components/schemas/EmailHtmlRequired"},{"$ref":"#/components/schemas/EmailAttachments"},{"$ref":"#/components/schemas/EmailSendingHeaders"},{"$ref":"#/components/schemas/EmailCustomVariables"},{"$ref":"#/components/schemas/EmailCategory"}]},"EmailHtmlRequired":{"type":"object","required":["html"],"properties":{"html":{"type":"string","minLength":1}}},"EmailWithTextAndHtml":{"title":"Text and HTML","allOf":[{"$ref":"#/components/schemas/EmailSenderRequired"},{"$ref":"#/components/schemas/EmailRecipients"},{"$ref":"#/components/schemas/EmailReplyTo"},{"$ref":"#/components/schemas/EmailSubjectRequired"},{"$ref":"#/components/schemas/EmailTextRequired"},{"$ref":"#/components/schemas/EmailHtmlRequired"},{"$ref":"#/components/schemas/EmailAttachments"},{"$ref":"#/components/schemas/EmailSendingHeaders"},{"$ref":"#/components/schemas/EmailCustomVariables"},{"$ref":"#/components/schemas/EmailCategory"}]},"EmailFromTemplate":{"title":"From Template","allOf":[{"$ref":"#/components/schemas/EmailSenderRequired"},{"$ref":"#/components/schemas/EmailRecipients"},{"$ref":"#/components/schemas/EmailReplyTo"},{"$ref":"#/components/schemas/TemplateUuidRequired"},{"$ref":"#/components/schemas/TemplateVariables"},{"$ref":"#/components/schemas/EmailAttachments"},{"$ref":"#/components/schemas/EmailSendingHeaders"},{"$ref":"#/components/schemas/EmailCustomVariables"}]},"TemplateUuidRequired":{"type":"object","required":["template_uuid"],"properties":{"template_uuid":{"type":"string","format":"uuid","description":"Email template UUID"}}},"TemplateVariables":{"type":"object","properties":{"template_variables":{"type":"object","description":"Template variable values"}}},"SentResponse":{"type":"object","properties":{"success":{"type":"boolean"},"message_ids":{"type":"array","description":"Message IDs (one per recipient)","items":{"type":"string"}}}},"SendEmailErrorResponse":{"type":"object","properties":{"success":{"type":"boolean"},"errors":{"type":"array","items":{"type":"string"}}}}},"responses":{"BadRequest":{"description":"Bad request. Fix errors listed in response before retrying.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized. Check your API credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailErrorResponse"}}}},"Forbidden":{"description":"Forbidden. Verify domain or check permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailErrorResponse"}}}},"InternalError":{"description":"Internal server error. Retry later or contact support.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailErrorResponse"}}}}}},"paths":{"/api/send":{"post":{"summary":"Send transactional email","description":"Send a single transactional email with text, HTML, or template content.\n\nUse this endpoint for:\n- Order confirmations\n- Password reset emails\n- Account notifications\n- Welcome emails\n- System alerts\n","operationId":"sendEmail","tags":["send-email"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/EmailWithText"},{"$ref":"#/components/schemas/EmailWithHtml"},{"$ref":"#/components/schemas/EmailWithTextAndHtml"},{"$ref":"#/components/schemas/EmailFromTemplate"}]}}}},"responses":{"200":{"description":"Email successfully sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SentResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Batch send emails

> Send up to 500 transactional emails in a single API call. Each email can have unique recipients and content while sharing base properties.\
> \
> \*\*Limits:\*\*\
> \- Maximum 500 messages per call\
> \- Maximum 50 MB total payload size (including attachments)\
> \
> \*\*Note:\*\* The endpoint returns HTTP 200 even if individual messages fail. Check the \`responses\` array for individual message status.<br>

```json
{"openapi":"3.1.0","info":{"title":"Transactional","version":"2.0.0"},"tags":[{"name":"send-email","description":"Send transactional emails for order confirmations, password resets, and notifications.\n\n{% hint style=\"success\" %}\nBest for: Real-time, one-to-one emails triggered by user actions\n{% endhint %}\n"}],"servers":[{"description":"Transactional Stream","url":"https://send.api.mailtrap.io"}],"security":[{"HeaderAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"HeaderAuth":{"type":"apiKey","description":"API token in Api-Token header","in":"header","name":"Api-Token"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token authentication"}},"schemas":{"BatchEmail":{"title":"Batch Email Request","description":"Send multiple emails in a single API call (up to 500)","type":"object","required":["requests"],"properties":{"base":{"description":"Base properties shared by all emails","allOf":[{"$ref":"#/components/schemas/EmailSender"},{"$ref":"#/components/schemas/EmailReplyTo"},{"$ref":"#/components/schemas/EmailSubject"},{"$ref":"#/components/schemas/EmailText"},{"$ref":"#/components/schemas/EmailHtml"},{"$ref":"#/components/schemas/EmailAttachments"},{"$ref":"#/components/schemas/EmailSendingHeaders"},{"$ref":"#/components/schemas/EmailCategory"},{"$ref":"#/components/schemas/EmailCustomVariables"},{"$ref":"#/components/schemas/TemplateUuid"},{"$ref":"#/components/schemas/TemplateVariables"}]},"requests":{"type":"array","description":"Individual email configurations (max 500)","maxItems":500,"items":{"allOf":[{"$ref":"#/components/schemas/EmailSender"},{"$ref":"#/components/schemas/EmailRecipients"},{"$ref":"#/components/schemas/EmailReplyTo"},{"$ref":"#/components/schemas/EmailSubject"},{"$ref":"#/components/schemas/EmailText"},{"$ref":"#/components/schemas/EmailHtml"},{"$ref":"#/components/schemas/EmailAttachments"},{"$ref":"#/components/schemas/EmailSendingHeaders"},{"$ref":"#/components/schemas/EmailCategory"},{"$ref":"#/components/schemas/EmailCustomVariables"},{"$ref":"#/components/schemas/TemplateUuid"},{"$ref":"#/components/schemas/TemplateVariables"}]}}}},"EmailSender":{"type":"object","properties":{"from":{"$ref":"#/components/schemas/Address"}}},"Address":{"type":"object","properties":{"email":{"type":"string","format":"email"},"name":{"type":"string"}}},"EmailReplyTo":{"type":"object","properties":{"reply_to":{"$ref":"#/components/schemas/Address"}}},"EmailSubject":{"type":"object","properties":{"subject":{"type":"string","minLength":1}}},"EmailText":{"type":"object","properties":{"text":{"type":"string","minLength":1}}},"EmailHtml":{"type":"object","properties":{"html":{"type":"string","minLength":1}}},"EmailAttachments":{"type":"object","properties":{"attachments":{"type":"array","items":{"type":"object","required":["content","filename"],"properties":{"content":{"type":"string","description":"Base64 encoded content"},"filename":{"type":"string"},"type":{"type":"string","description":"MIME type"},"disposition":{"type":"string","enum":["attachment","inline"],"default":"attachment"},"content_id":{"type":"string","description":"For inline attachments"}}}}}},"EmailSendingHeaders":{"type":"object","properties":{"headers":{"type":"object","additionalProperties":{"type":"string"}}}},"EmailCategory":{"type":"object","properties":{"category":{"type":"string","maxLength":255}}},"EmailCustomVariables":{"type":"object","properties":{"custom_variables":{"type":"object","additionalProperties":{"type":"string"}}}},"TemplateUuid":{"type":"object","properties":{"template_uuid":{"type":"string","format":"uuid","description":"Email template UUID"}}},"TemplateVariables":{"type":"object","properties":{"template_variables":{"type":"object","description":"Template variable values"}}},"EmailRecipients":{"type":"object","properties":{"to":{"type":"array","maxItems":1000,"items":{"$ref":"#/components/schemas/Address"}},"cc":{"type":"array","maxItems":1000,"items":{"$ref":"#/components/schemas/Address"}},"bcc":{"type":"array","maxItems":1000,"items":{"$ref":"#/components/schemas/Address"}}}},"BatchSentResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Overall request success"},"responses":{"type":"array","description":"Individual message results","items":{"type":"object","properties":{"success":{"type":"boolean"},"message_ids":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}}}}},"errors":{"type":"array","description":"General errors","items":{"type":"string"}}}},"SendEmailErrorResponse":{"type":"object","properties":{"success":{"type":"boolean"},"errors":{"type":"array","items":{"type":"string"}}}}},"responses":{"BadRequest":{"description":"Bad request. Fix errors listed in response before retrying.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized. Check your API credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailErrorResponse"}}}},"InternalError":{"description":"Internal server error. Retry later or contact support.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailErrorResponse"}}}}}},"paths":{"/api/batch":{"post":{"summary":"Batch send emails","description":"Send up to 500 transactional emails in a single API call. Each email can have unique recipients and content while sharing base properties.\n\n**Limits:**\n- Maximum 500 messages per call\n- Maximum 50 MB total payload size (including attachments)\n\n**Note:** The endpoint returns HTTP 200 even if individual messages fail. Check the `responses` array for individual message status.\n","operationId":"batchSendEmail","tags":["send-email"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchEmail"}}}},"responses":{"200":{"description":"Batch processed. Check individual responses for delivery status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchSentResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mailtrap.io/developers/email-sending/transactional.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
