# Emailwritr API

Integrate AI-powered email writing, subscriber management, and campaign generation directly into your applications and workflows.

**Base URL:** https://api3.emailwritr.com/api/v1

## Authentication

All API requests require an API key. Keys are available on **Agency** and **Enterprise** plans. Generate keys from your [dashboard](/content/dashboard/api-access/index.html).

Pass your key using either method:

**Option 1 — X-API-Key header (recommended)**

```bash
curl -H "X-API-Key: ew_live_your_key_here" \
     https://api3.emailwritr.com/api/v1/lists
```

**Option 2 — Authorization Bearer**

```bash
curl -H "Authorization: Bearer ew_live_your_key_here" \
     https://api3.emailwritr.com/api/v1/lists
```

Keep your key secret. Never expose it in client-side code or public repositories. Each key is shown only once at creation.

## Rate Limits

The API allows 100 requests per minute per API key. Exceeding this returns a `429` response.

| Plan                                 | Req / min | API Access |
| ------------------------------------ | ---------- | ---------- |
| Premium / Pro / Expert               | —          | ✗ No      |
| Agency / Agency LTD / Agency Lifetime | 100        | ✓ Yes     |
| Enterprise / Enterprise LTD / Lifetime | 100        | ✓ Yes     |

## Lists & Subscribers

**GET** `/api/v1/lists`  
Return all email lists for the account.

**POST** `/api/v1/lists`  
Create a new subscriber list.

**GET** `/api/v1/lists/:id`  
Get a single list by ID.

**PUT** `/api/v1/lists/:id`  
Update list name or description.

**DELETE** `/api/v1/lists/:id`  
Delete a list and all its subscribers.

**GET** `/api/v1/lists/:id/subscribers`  
Get subscribers. Supports status filter and pagination.

**POST** `/api/v1/lists/:id/subscribers`  
Add a subscriber to a list.

**DELETE** `/api/v1/lists/:id/subscribers/:subscriberId`  
Remove a subscriber from a list.

## Email Writing

**POST** `/api/v1/email/sessions`  
Create a new AI email writing session.

**GET** `/api/v1/email/sessions`  
List all email writing sessions.

**POST** `/api/v1/email/sessions/:sessionId/message`  
Send a prompt to the AI and receive a generated email. Consumes email tokens.

**GET** `/api/v1/email/sessions/:sessionId/conversation`  
Get the full conversation history for a session.

**DELETE** `/api/v1/email/sessions/:sessionId`  
Delete an email writing session.

## SMS Writing

**POST** `/api/v1/sms/sessions`  
Create a new AI SMS writing session.

**POST** `/api/v1/sms/sessions/:sessionId/message`  
Generate an SMS with AI. Consumes SMS tokens.

**GET** `/api/v1/sms/sessions`  
List all SMS writing sessions.

**DELETE** `/api/v1/sms/sessions/:sessionId`  
Delete an SMS writing session.

## Sequences

**GET** `/api/v1/sequences`  
List all email sequence requests for the account.

**GET** `/api/v1/sequences/:id`  
Get a single sequence request and its status.

**GET** `/api/v1/sequences/:id/emails`  
Get all generated emails within a completed sequence.

## Error Responses

| Status | Meaning                                       |
| ------ | --------------------------------------------- |
| 200    | Success                                       |
| 201    | Created                                       |
| 400    | Bad request — check your parameters           |
| 401    | Missing or invalid API key                    |
| 403    | Plan does not include API access              |
| 404    | Resource not found                            |
| 429    | Rate limit exceeded — 100 req/min            |
| 500    | Server error — contact support                |

### Ready to integrate?

API access is included with Agency and Enterprise plans.
