---
docId: doc_d153ee777cbb492f81a152f1903300dd
title: Send an email
description: "Send or reply to an email from a connected mailbox."
api:
  group: mensajes
  auth: bearer
  operations:
    - operationId: sendEmailMessage
      method: POST
      path: /v1/messages/email
      postmanName: Send an Email
---

<script>
  import { Ways, Note, Collapsible } from '$lib/components';
</script>

# Send an email

Send an email from Gmail, Outlook or a mailbox on your domain connected to Platica. Omit `conversationId` to start a thread or send it to reply to an existing one. Each thread is a conversation. See [Email through the API](/api-reference/channels/email).

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl https://api.platic.ai/v1/messages/email \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "channelId": "em-sales@acme.com",
    "to": "ana@example.com",
    "subject": "Your quote",
    "text": "Hi Ana, here is your quote."
  }'
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.messages.sendEmail({
  channelId: "em-sales@acme.com",
  to: "ana@example.com",
  subject: "Your quote",
  text: "Hi Ana, here is your quote.",
});
```

</Ways.Way>
</Ways>

With your assistant, the tool is `send_email`.

## Query parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `workspace` | string | Look for the channel only in that workspace. Without it, every workspace of the credential is searched. A workspace the credential does not cover answers `400` | — |

## Request body

```json
{
  "channelId": "em-sales@acme.com",
  "to": "ana@example.com",
  "subject": "Your quote",
  "text": "Hi Ana, here is your quote.",
  "attachments": [
    { "url": "https://acme.com/quote.pdf", "filename": "quote.pdf" }
  ],
  "agentId": "tVKljCHCNiebQdasHeit",
  "client": { "name": "Ana" }
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `channelId` | string | ✓ | The sending mailbox, such as `em-sales@acme.com`. It comes from [list channels](/api-reference/channels/list) |
| `to` | string | ✓¹ | The contact's email or their id. Only to start a thread |
| `subject` | string | ✓¹ | Subject. Sent as is, without "Re:". Only to start a thread |
| `text` | string | ✓² | The email as plain text |
| `html` | string | ✓² | The email as HTML |
| `attachments` | array | — | Up to 10 attachments `{ "url", "filename" }`. `url` is `https://` and, for now, must be a file stored in Platica; `filename` is optional |
| `conversationId` | string | — | The `id` of the conversation you are replying to. Without it, a new thread is started |
| `agentId` | string | — | The agent that answers when the contact replies. Without it, the conversation has no agent. Only to start a thread |
| `client` | object | — | Contact data to create or complete them, as in [send a message](/api-reference/messages/send) |
| `delay` | number | — | Delay in milliseconds (3,000 – 86,400,000) |
| `scheduleTime` | string | — | Send date and time (ISO 8601), up to 30 days later. Cannot be combined with `delay` |

¹ Required to start a thread. Ignored when replying.
² Send `text`, `html` or both. If you send one, Platica builds the other.

### Start or reply

**Start a thread:** omit `conversationId` and send `to` and `subject`. If the contact does not exist, it is created with the data in `client`. A new conversation always opens, even if the contact has others.

With `agentId`, the conversation is `automatic`: the agent handles the contact's reply. Without it, the conversation is `supervised` and your team handles it.

**Reply** (with `conversationId`): the email goes in the same thread, with its subject. `to`, `subject` and `agentId` are ignored: the recipient, the subject and the agent are those of the conversation.

```json
{
  "channelId": "em-sales@acme.com",
  "conversationId": "Hk3pQ9wLx2QmZ7bN1cVd",
  "text": "Sure, I'll send it as a PDF."
}
```

If the same request to start a thread arrives twice in under a minute, Platica sends a single email and both responses carry the same conversation.

## Response

```json
{
  "status": "success",
  "data": {
    "messageId": "apiMessage_123xyz",
    "kind": "email",
    "status": "sent",
    "timestamp": "2026-11-17T18:00:00.000Z",
    "conversationId": "Hk3pQ9wLx2QmZ7bN1cVd",
    "clientId": "274fc73cb7d84a17955914fdc1a1f9d0",
    "threadStarted": true,
    "scheduled": false
  }
}
```

| Field | Type | Description |
|-------|------|-------------|
| `data.conversationId` | string \| null | The `id` of the thread's conversation. Use it to reply and in [get a conversation](/api-reference/conversations/get) |
| `data.kind` | string | Always `email` |
| `data.status` | string | `sent`, or `delayed` / `scheduled` when it was scheduled |
| `data.timestamp` | string | When the API accepted the request, in ISO 8601 |
| `data.messageId` | string | Message ID. If it is scheduled, use it to [read, reschedule or cancel it](/api-reference/messages/scheduled) |
| `data.clientId` | string \| null | Contact ID |
| `data.threadStarted` | boolean | `true` if it started a thread, `false` if it replied |
| `data.scheduled` | boolean | `true` if it was sent with `delay` or `scheduleTime` |

With `delay` or `scheduleTime`, you receive `202`, as in [send a message](/api-reference/messages/send#response). `status` is `delayed` or `scheduled`. `data` includes `executeAt` and, depending on the option used, `delayMs` or `scheduledTime`.

A scheduled reply returns `conversationId`. When scheduling a new thread, `conversationId` and `clientId` are `null`: the conversation is created when the email is sent.

## Errors

<Collapsible summary="Show error codes and fixes">

| Status | `details.code` | When it happens |
|--------|----------------|-----------------|
| `400` | `INVALID_REQUEST` | A field is missing or not valid: `channelId`, `to` or `subject` (when starting a thread), `text` or `html` (send at least one), an attachment, or `delay` together with `scheduleTime`. `details.issues` says which field |
| `400` | `INVALID_SCHEDULE` | `delay` is out of range, or `scheduleTime` is not valid, is in the past or is more than 30 days ahead. `details.issues` points at `delay` or `scheduleTime` |
| `400` | `INVALID_REQUEST` | You sent a `?workspace=` that the credential does not cover. `details.available` lists the ones you can use |
| `400` | `EMAIL_CHANNEL_REQUIRED` | `channelId` is not an email mailbox of the workspace |
| `400` | `INVALID_RECIPIENT` | `to` is neither a valid email nor a contact id |
| `401` | `UNAUTHENTICATED` | The credential is missing or invalid |
| `402` | `PAYMENT_REQUIRED` | The workspace reached its credit limit |
| `403` | `FORBIDDEN` | The credential does not have the module, or the user does not have access to the workspace |
| `404` | `EMAIL_CONVERSATION_NOT_FOUND` | `conversationId` is not a thread of that mailbox (wrong id, wrong channel or ambiguous). `details.conversationId` repeats it |
| `404` | `WORKSPACE_NOT_FOUND` | The credential does not carry any workspace |
| `409` | `EMAIL_CHANNEL_UNAVAILABLE` | The mailbox is paused or its domain is not verified. `details.channelId` says which. Check its `health` in [list channels](/api-reference/channels/list#health) |
| `409` | `AGENT_UNAVAILABLE` | The agent in `agentId` does not exist or is not active |
| `409` | `CONTACT_UNAVAILABLE` | The contact is blocked, invalid or missing |
| `409` | `MULTIPLE_CONTACTS_MATCH` | More than one contact has that email. Send the contact id in `to`. `details.clientIds` lists them |
| `409` | `AMBIGUOUS_CHANNEL` | The channel exists in several workspaces. Add `?workspace=`. `details.workspaces` lists them |
| `409` | `EMAIL_RECIPIENT_SUPPRESSED` | The recipient is on the suppression list |
| `413` | `PAYLOAD_TOO_LARGE` | The scheduled send is too large |
| `422` | `EMAIL_REJECTED` | Amazon SES refused the email, for example an unverified recipient in a sandbox |
| `502` | `EMAIL_SEND_FAILED` | The mailbox provider could not send the email. The conversation was already created |
| `502` | `UPSTREAM_ERROR` | The send could not be scheduled, or the messaging service failed |

If a field is missing or has another type, the response is `400` `INVALID_REQUEST` and `details.issues` says which.

The general error format is in [Errors](/api-reference/errors).

</Collapsible>

## Notes

- No copy (`cc`) or blind copy (`bcc`).
- Up to 10 attachments per email.
- There are no email campaigns: to write to several contacts, make one request per contact.
