---
title: "Schedule an email for delivery"
description: "Schedules an email to be sent via the queue service"
---

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

Path: Channel Automation API › Queue

`POST /api/queue/schedule-email`

Schedules an email to be sent via the queue service

## Authentication

- `bearerAuth`

## Request body

_Required._

- `to` (`post/api/queue/schedule-email.to`; string, required) — Recipient email address
  - format `email`
- `subject` (`post/api/queue/schedule-email.subject`; string, required) — Email subject
- `body` (`post/api/queue/schedule-email.body`; string, required) — Email body (HTML supported)
- `workspaceId` (`post/api/queue/schedule-email.workspaceId`; string, required) — Workspace ID
- `contactId` (`post/api/queue/schedule-email.contactId`; string, optional) — Contact ID (optional)
- `scheduledFor` (`post/api/queue/schedule-email.scheduledFor`; string, optional) — When to send the email (optional, immediate if not specified)
  - format `date-time`
- `metadata` (`post/api/queue/schedule-email.metadata`; object, optional) — Additional metadata for the email

## Example request

```json
{
  "to": "user@example.com",
  "subject": "string",
  "body": "string",
  "workspaceId": "string",
  "contactId": "string",
  "scheduledFor": "2019-08-24T14:15:22Z",
  "metadata": {}
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/queue/schedule-email \
  --header 'Content-Type: application/json' \
  --data '
{
  "to": "user@example.com",
  "subject": "string",
  "body": "string",
  "workspaceId": "string",
  "contactId": "string",
  "scheduledFor": "2019-08-24T14:15:22Z",
  "metadata": {}
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/queue/schedule-email';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    to: 'user@example.com',
    subject: 'string',
    body: 'string',
    workspaceId: 'string',
    contactId: 'string',
    scheduledFor: '2019-08-24T14:15:22Z',
    metadata: {}
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/queue/schedule-email"

payload = {
    "to": "user@example.com",
    "subject": "string",
    "body": "string",
    "workspaceId": "string",
    "contactId": "string",
    "scheduledFor": "2019-08-24T14:15:22Z",
    "metadata": {}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Email scheduled successfully

#### Example

```json
{
  "success": true,
  "jobId": "string",
  "scheduledFor": "2019-08-24T14:15:22Z"
}
```

- `success` (`post/api/queue/schedule-email.response.200.success`; boolean, optional)
- `jobId` (`post/api/queue/schedule-email.response.200.jobId`; string, optional) — Queue job ID for tracking
- `scheduledFor` (`post/api/queue/schedule-email.response.200.scheduledFor`; string, optional) — When the email is scheduled to be sent
  - format `date-time`

### 400

Invalid input

### 401

Unauthorized

### 500

Internal server error


Source: https://developer.channelautomations.com/api/post-api-queue-schedule-email/index.md
