# Send an email

Sends an email.

```http
POST https://api.pozy.ai/v1/email/messages
```

- Area: Email, calendar & files / Email
- Auth: Authorization: Bearer pz_live_...

## Request body

Content type: `application/json`

- `accountId`, string, required
- `to`, array of object, required: At least 1 item. Up to 100 items
  - `email`, string (email), required
  - `name`, string: Can be null
- `cc`, array of object: Up to 100 items
  - `email`, string (email), required
  - `name`, string: Can be null
- `bcc`, array of object: Up to 100 items
  - `email`, string (email), required
  - `name`, string: Can be null
- `replyTo`, array of object: Up to 5 items
  - `email`, string (email), required
  - `name`, string: Can be null
- `fromName`, string: Up to 200 characters
- `subject`, string, required: Up to 998 characters
- `text`, string
- `html`, string
- `attachments`, array of object: Up to 20 items
  - `filename`, string, required
  - `contentType`, string, required
  - `url`, string (URL)
  - `base64`, string
  - `contentId`, string
- `headers`, map of string
- `metadata`, map of string
- `scheduledFor`, string (date-time)
- `holdAsDraft`, boolean
- `trackOpens`, boolean
- `trackLinks`, boolean

## Example request

```bash
curl -X POST "https://api.pozy.ai/v1/email/messages" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "accountId": "696e0b682d0a31188e7a2ba9",
  "to": [
    {
      "email": "alex@example.com"
    }
  ],
  "subject": "string"
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/email/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    accountId: "696e0b682d0a31188e7a2ba9",
    to: [
      {
        email: "alex@example.com"
      }
    ],
    subject: "string"
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.post(
    "https://api.pozy.ai/v1/email/messages",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "to": [
            {
                "email": "alex@example.com",
            },
        ],
        "subject": "string",
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 201

- `data`, object
  - `id`, string
  - `threadId`, string
  - `accountId`, string
  - `provider`, string: One of `google`, `microsoft`
  - `folders`, array of string
  - `from`, object
    - one of: Email Address
      - `email`, string (email), required
      - `name`, string: Can be null
  - `to`, array of object
    - `email`, string (email), required
    - `name`, string: Can be null
  - `cc`, array of object
    - `email`, string (email), required
    - `name`, string: Can be null
  - `bcc`, array of object
    - `email`, string (email), required
    - `name`, string: Can be null
  - `replyTo`, array of object
    - `email`, string (email), required
    - `name`, string: Can be null
  - `subject`, string
  - `snippet`, string
  - `text`, string: Can be null
  - `html`, string: Can be null
  - `attachments`, array of object
    - `id`, string
    - `filename`, string
    - `contentType`, string
    - `size`, integer
    - `isInline`, boolean
    - `contentId`, string: Can be null
  - `headers`, map of string
  - `raw`, string
  - `date`, string (date-time)
  - `unread`, boolean
  - `starred`, boolean
  - `metadata`, map of string

```json
{
  "data": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "threadId": "60186572e25ff711298bf12e",
    "accountId": "696e0b682d0a31188e7a2ba9",
    "provider": "google",
    "folders": [
      "string"
    ],
    "from": {
      "email": "alex@example.com",
      "name": "Acme"
    },
    "to": [
      {
        "email": "alex@example.com",
        "name": "Acme"
      }
    ],
    "cc": [
      {
        "email": "alex@example.com",
        "name": "Acme"
      }
    ],
    "bcc": [
      {
        "email": "alex@example.com",
        "name": "Acme"
      }
    ],
    "replyTo": [
      {
        "email": "alex@example.com",
        "name": "Acme"
      }
    ],
    "subject": "string",
    "snippet": "string",
    "text": "Hello from Pozy",
    "html": "string",
    "attachments": [
      {
        "id": "6bfebd43ddc270f6d2c56fc5",
        "filename": "photo.jpg",
        "contentType": "image/jpeg",
        "size": 482133,
        "isInline": true,
        "contentId": "6e56e1ad0e43e2da5ef935a5"
      }
    ],
    "headers": {
      "key": "string"
    },
    "raw": "string",
    "date": "2026-10-02T09:00:00.000Z",
    "unread": true,
    "starred": true,
    "metadata": {
      "key": "string"
    }
  }
}
```
