# Create Template

> Create a new email template.

> Documentation index: https://www.foxreach.io/docs/llms.txt lists every page of these docs. Each page is also served as Markdown: add `.md` to its URL.

`POST` https://api.foxreach.io/api/v1/templates

## Request Body

- `name` string body required

  Template name.

- `subject` string body

  Email subject line. Supports [variables and spin syntax](https://www.foxreach.io/docs/template-variables) like `{{firstName}}`, `{{company}}`.

- `body` string body required

  Email body content. Supports [variables and spin syntax](https://www.foxreach.io/docs/template-variables) for personalization and deliverability. A body can include `<img>` tags with a public `src`. A body that contains an image is sent as HTML even when `sendAsHtml` is `false`, because plain text cannot carry it. Uploading an image is a feature of the FoxReach app only; the API, MCP server and SDKs do not expose an upload endpoint, so host the file yourself and reference its public URL.

- `category` string body default `email`

  Template category: `email` or `reply_macro`.

**Request example**

```bash cURL
curl -X POST "https://api.foxreach.io/api/v1/templates" \
  -H "X-API-Key: otr_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Follow-up Template",
    "subject": "Following up on my last email",
    "body": "Hi {{firstName}},\n\nI wanted to follow up on my previous email about..."
  }'
```

```python Python SDK
from foxreach import FoxReach
from foxreach.types import TemplateCreate

client = FoxReach(api_key="otr_your_key")
template = client.templates.create(
    TemplateCreate(
        name="Cold Intro - SaaS",
        subject="Quick question about {{company}}",
        body="Hi {{firstName}},..."
    )
)
```

```typescript TypeScript SDK
import { FoxReach } from "foxreach";

const client = new FoxReach({ apiKey: "otr_your_key" });
const template = await client.templates.create({
    name: "Cold Intro - SaaS",
    subject: "Quick question about {{company}}",
    body: "Hi {{firstName}},..."
});
```

**Response example**

```json
{
  "data": {
    "id": "ctm_new456",
    "name": "Follow-up Template",
    "subject": "Following up on my last email",
    "body": "Hi {{firstName}},\n\nI wanted to follow up on my previous email about...",
    "category": "email",
    "createdAt": "2025-01-15T10:00:00",
    "updatedAt": "2025-01-15T10:00:00"
  }
}
```

## Rate Limit

- **120 requests per minute, shared by every `write` call in your workspace.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (unix epoch seconds) and `X-RateLimit-Bucket` (`write`).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns (`Retry-After`, exponential backoff, monitoring `X-RateLimit-Remaining`), see [Rate Limiting](https://www.foxreach.io/docs/rate-limiting).
