# Letterhead for Developers: MCP, the newsletter API, SDK, and CLI | Letterhead

Canonical: https://www.tryletterhead.com/developers

Letterhead for Developers

# Run a newsletter from Claude, ChatGPT, your own app, or the terminal.

Connect your AI to Letterhead's MCP server, or build on the API with the SDK and the CLI.

[Start free](https://app.tryletterhead.com/sign-up)[Read the docs](https://docs.tryletterhead.com/api/using-the-letterhead-api/)[Connect your AI](#mcp)

`npm install @tryletterhead/sdk`

Send a newsletter

```
import { createLetterheadClient } from '@tryletterhead/sdk';

const letterhead = createLetterheadClient({
  apiKey: process.env.LETTERHEAD_API_KEY!,
});

// Send it to everyone on the channel.
await letterhead.letters.sendALetter({
  body: {
    channel: 'the-morning-brief',
    subject: 'Tuesday: the council vote, explained',
    html: `
      <h1>The council vote, explained</h1>
      <p>Here's what passed last night, and what it means for you.</p>
      <a href='{{ unsubscribe }}'>Unsubscribe</a>
    `,
    segment: 0,
  },
});
```

```
npm install -g @tryletterhead/cli
export LETTERHEAD_API_KEY=<your-company-api-key>

# Send this week's issue to everyone on the channel
letterhead letters send-a-letter \
  --channel the-morning-brief \
  --subject "Tuesday: the council vote, explained" \
  --html "$(cat issue.html)" \
  --segment 0
```

```
curl -X POST https://api.tryletterhead.com/api/v3/letters/actions/send \
  -H "Authorization: Bearer $LETTERHEAD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "api": true,
    "channel": "the-morning-brief",
    "subject": "Tuesday: the council vote, explained",
    "html": "<h1>The council vote, explained</h1><p>Here is what passed last night.</p><a href=\u0027{{ unsubscribe }}\u0027>Unsubscribe</a>",
    "segment": 0
  }'
```

**212** operations in the API reference

-   POST`/api/v3/contacts`
-   GET`/api/v3/contacts/{email}`
-   POST`/api/v3/contacts/tags/{tag}/members`
-   POST`/api/v3/contacts/{email}/subscriptions`
-   GET`/api/v3/contacts/segments`
-   GET`/api/v3/contacts/segments/system`
-   POST`/api/v3/contacts/segments/{segmentId}/preview`
-   GET`/api/v3/contacts/overlap`
-   POST`/api/v3/contacts/export`
-   POST`/api/v3/letters/actions/draft`
-   POST`/api/v3/letters/actions/send`
-   POST`/api/v3/letters/metrics`
-   GET`/api/v3/letters/metrics/top-performers`
-   POST`/api/v3/letters/subject-line-analyses`
-   POST`/api/v3/curations`
-   POST`/api/v3/curations/bulk`
-   GET`/api/v3/curations/feeds`
-   POST`/api/v3/promotions`
-   GET`/api/v3/promotions/insights`
-   GET`/api/v3/channels`
-   POST`/api/v3/metrics/clicks/links`
-   GET`/api/v3/metrics/portfolio-health`
-   GET`/api/v3/automations`
-   POST`/api/v3/reports/export`
-   POST`/api/v3/contacts`
-   GET`/api/v3/contacts/{email}`
-   POST`/api/v3/contacts/tags/{tag}/members`
-   POST`/api/v3/contacts/{email}/subscriptions`
-   GET`/api/v3/contacts/segments`
-   GET`/api/v3/contacts/segments/system`
-   POST`/api/v3/contacts/segments/{segmentId}/preview`
-   GET`/api/v3/contacts/overlap`
-   POST`/api/v3/contacts/export`
-   POST`/api/v3/letters/actions/draft`
-   POST`/api/v3/letters/actions/send`
-   POST`/api/v3/letters/metrics`
-   GET`/api/v3/letters/metrics/top-performers`
-   POST`/api/v3/letters/subject-line-analyses`
-   POST`/api/v3/curations`
-   POST`/api/v3/curations/bulk`
-   GET`/api/v3/curations/feeds`
-   POST`/api/v3/promotions`
-   GET`/api/v3/promotions/insights`
-   GET`/api/v3/channels`
-   POST`/api/v3/metrics/clicks/links`
-   GET`/api/v3/metrics/portfolio-health`
-   GET`/api/v3/automations`
-   POST`/api/v3/reports/export`

01

## Connect Claude, ChatGPT, or any MCP client to your newsletters.

Letterhead runs an MCP server, so your AI can work with your newsletters. Add it as a custom connector and sign in with your Letterhead login.

Ask it to draft Tuesday's issue, compare this month's opens with last month's, check that your welcome series is still sending, or schedule a weekly report to your team.

1.  Open Settings, then MCP, and copy your server URL.
2.  In Claude, go to Settings, Connectors, Add custom connector. In ChatGPT, go to Settings, Connectors.
3.  Only company administrators can connect it.

[Read how to connect an AI assistant](https://docs.tryletterhead.com/integrations/connect-ai-tools-mcp). For terminal agents, use [the CLI](#agents).

02

## Give a coding agent your API key and a job.

It can do the rest. The docs and the CLI's own help tell it which commands to run.

Ask your agent

```
Read https://docs.tryletterhead.com/llms.txt.
Then use the Letterhead CLI to tag everyone
in registrants.csv with "webinar-attendee".
My API key is in LETTERHEAD_API_KEY.
```

What it runs

```
# Every operation is a command with its own --help
letterhead --help
letterhead tags add-to-contacts --help

# JSON in, JSON out
letterhead tags add-to-contacts --tag webinar-attendee \
  --body @registrants.json --compact

# Outside a terminal, deletes need --yes
letterhead contacts delete-a-tag --tag-id 123 --yes
```

Deletes require --yes outside a terminal.

03

## What teams build on the API.

Use the API to manage contacts, bring in content, send newsletters, and pull reporting data. These are a few common jobs.

### Add readers from your own app.

Create or update a contact when someone signs up in your product, with tags, custom fields, and where they came from.

TypeScript

```
await letterhead.contacts.upsert({
  email: 'pat@example.org',
  tags: ['trial'],
  customFields: { plan: 'pro' },
  source: 'app-signup',
});
```

### Send stories from your CMS to the curations library.

Push articles as you publish them. Name the newsletters each one belongs to, or leave it shared with all of them.

TypeScript

```
await letterhead.curations.curateInBulk({
  body: {
    curations: [
      {
        url: 'https://example.com/council-vote',
        channels: ['the-morning-brief'],
      },
      { url: 'https://example.com/weekend-guide' },
    ],
  },
});
```

### Send a newsletter from your own HTML.

Opens and clicks are tracked for you. Add your own unsubscribe link with the {{ unsubscribe }} merge tag.

TypeScript

```
await letterhead.letters.sendALetter({
  body: {
    channel: 'the-morning-brief',
    subject: 'Tuesday: the council vote, explained',
    html: issueHtml,
    segment: 0, // everyone subscribed to the channel
  },
});
```

### Pull performance into your own reports.

Opens, clicks, bounces, and unsubscribes for many letters at once, filtered by newsletter and date.

TypeScript

```
const metrics = await letterhead.letters.listLetterMetrics({
  body: {
    channels: ['the-morning-brief'],
    createdAtAfter: '2026-10-01',
  },
});
```

04

## Everything you need to start.

-   [**API reference**Every endpoint, browsable.](https://docs.tryletterhead.com/api/reference/)
-   [**Docs for agents**The help center and API docs as Markdown, in one llms.txt.](https://docs.tryletterhead.com/llms.txt)
-   [**SDK**npm install @tryletterhead/sdk](https://www.npmjs.com/package/@tryletterhead/sdk)
-   [**CLI**npm install -g @tryletterhead/cli](https://www.npmjs.com/package/@tryletterhead/cli)
-   [**Integrations**WordPress, HubSpot, Zapier, and more.](/integrations.html)

## Get an API key and send your first request.

Sign up free, then create a key in Settings, under API keys. The free plan covers up to 5,000 contacts and 5,000 emails a month.

[Start free](https://app.tryletterhead.com/sign-up)
