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/cliexport LETTERHEAD_API_KEY=<your-company-api-key># Send this week's issue to everyone on the channelletterhead 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.
Open Settings, then MCP, and copy your server URL.
In Claude, go to Settings, Connectors, Add custom connector. In ChatGPT, go to Settings, Connectors.
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 everyonein registrants.csv with "webinar-attendee".My API key is in LETTERHEAD_API_KEY.
What it runs
# Every operation is a command with its own --helpletterhead --helpletterhead tags add-to-contacts --help# JSON in, JSON outletterhead tags add-to-contacts --tag webinar-attendee \ --body @registrants.json --compact# Outside a terminal, deletes need --yesletterhead 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.