MAILSNAIL API
Mail a letter from your own code.
Five HTTP calls put a real letter in the US mail. One call returns an API key, with no sign-up. A person adds funds once, by card. After that every letter is one request, at our cost: from $1.21.
Want Claude, ChatGPT or Cursor to mail letters for you instead? That needs no key: connect the app.
Building an agent that speaks MCP and should need no key and no account? One server address asks for no sign-in: the agent makes the proof, and a person pays for each letter by card on a page it hands them.
1. Get a key
No form and no email. The key is shown once, and we keep only a hash of it, so store it when it arrives. Send it on every request as Authorization: Bearer msk_live_…. One key is enough for any number of letters.
curl -X POST "https://api.mailsnail.dev/v1/accounts?ref=developers"
# 201
# {
# "api_key": "msk_live_…", <- shown once; store it now
# "account_id": "…",
# "balance_cents": 0,
# "currency": "usd",
# "status": "active",
# "next_step": "…the calls below, in order…"
# }
export MAILSNAIL_KEY="msk_live_…"2. Check an address
Free. deliverability is deliverable when USPS recognizes the address, undeliverable with a reason when it does not, and unknown when the check could not be made. US addresses only.
curl -X POST https://api.mailsnail.dev/v1/verify \
-H "Authorization: Bearer $MAILSNAIL_KEY" \
-H "Content-Type: application/json" \
-d '{
"address_line1": "1 Main St",
"address_city": "Brooklyn",
"address_state": "NY",
"address_zip": "11201"
}'
# 200
# { "deliverability": "deliverable", "normalized": { …the address as USPS writes it… } }3. Make a proof
Free, and nothing is mailed. You get back the PDF that would be printed, the exact price, and a draft_id. Send the key on this call too: a draft can be sent only with the key it was made with.
curl -X POST https://api.mailsnail.dev/v1/preview \
-H "Authorization: Bearer $MAILSNAIL_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": {
"name": "Jane Doe",
"address_line1": "1 Main St",
"address_city": "Brooklyn",
"address_state": "NY",
"address_zip": "11201"
},
"from": {
"name": "Sam Sender",
"address_line1": "500 Oak Ave",
"address_city": "Austin",
"address_state": "TX",
"address_zip": "78701"
},
"body_text": "Dear Jane,\n\nThank you for the referral.\n\nSam"
}'
# 200
# {
# "draft_id": "…", <- what you send in step 5
# "proof_url": "https://…", <- the PDF that will be printed (link lasts 30 minutes)
# "amount_cents": 121, <- the exact price, taken from your balance
# "to_deliverability": "deliverable",
# "draft_valid_until": "…", <- the draft can be sent for 7 days
# "next_step": "…"
# }Instead of body_text you can pass file_url, the public address of your own letter-size PDF. color is off and double_sided is on unless you say otherwise. For certified mail add extra_service (see the prices below); the Certified Mail API page shows the tracking and the return receipt that come back.
4. Add funds
This is the one step a person does. The call returns a link to a payment page run by Stripe; open it and pay by card. We never see the card number. The money is on the key's balance a second or two after the payment. Paying adds funds and mails nothing: step 5 is what mails the letter, and a proof made before the payment still counts.
curl -X POST https://api.mailsnail.dev/v1/billing/setup \
-H "Authorization: Bearer $MAILSNAIL_KEY" \
-H "Content-Type: application/json" \
-d '{ "amount_cents": 2500 }'
# 200
# {
# "checkout_url": "https://checkout.stripe.com/…", <- open this and pay by card
# "amount_cents": 2500,
# "saves_card_for_auto_reload": false,
# "next_step": "…"
# }The least you can add is $10 and the most is $500 at a time; with no amount_cents it is $25. It is a one-time payment and the card is not saved. If you would rather not come back when the balance runs low, pass "auto_reload": true: the card is then saved and the same amount is added whenever the balance falls below $10. The payment page shows those terms before you pay, and PATCH /v1/billing/auto-reload with {"enabled": false} turns it off. A balance can be spent only on postage and printing here and is not redeemable for cash.
5. Mail it
This mails exactly the proof, at exactly the price it quoted. A draft is mailed once: sending the same request again returns the first answer and mails nothing more.
curl -X POST https://api.mailsnail.dev/v1/letters \
-H "Authorization: Bearer $MAILSNAIL_KEY" \
-H "Content-Type: application/json" \
-d '{ "draft_id": "…" }'
# 200
# {
# "id": "…",
# "status": "…",
# "amount_charged_cents": 121,
# "rail": "balance",
# "balance_cents": 2379, <- what is left
# "status_url": "https://api.mailsnail.dev/v1/letters/…",
# "next_step": "…when it is printed, how long it travels, how to check and to cancel…"
# }If the balance does not cover the letter, nothing is mailed and the answer is 402. It says what is missing and where to add it. Add funds, then send the same request again.
{
"balance": {
"account_balance_cents": 0,
"price_cents": 121,
"shortfall_cents": 121,
"topup": {
"by_card": { "method": "POST", "endpoint": "/v1/billing/setup", "returns": "checkout_url" }
}
},
"help": { "add_funds_by_card": "…", "docs": "https://mailsnail.dev/developers" }
}If the printer refuses a letter, its price goes straight back to your balance and the answer says so. You can also skip the proof and post the whole letter (to, from and body_text or file_url) to /v1/letters. Then an Idempotency-Key header of your own is required, so that a retry never mails twice.
Then follow it
status_url is the letter's own address. It works without the key, so share it only with people who should see the letter's status. For certified mail the answer carries the USPS tracking number and a usps.com link once the letter has been mailed.
# The address from "status_url". It needs no key.
curl https://api.mailsnail.dev/v1/letters/…
# Cancel before it is printed; the price goes back to your balance.
curl -X POST https://api.mailsnail.dev/v1/letters/…/cancel \
-H "Authorization: Bearer $MAILSNAIL_KEY"
# What is left to spend, with a "next_step" that says what it pays for.
curl https://api.mailsnail.dev/v1/balance -H "Authorization: Bearer $MAILSNAIL_KEY"What it costs
Mail type, and its extra_service | Price |
|---|---|
First-class letterleave extra_service out | $1.21 |
Certified lettercertified | $8.61 |
Certified + electronic return receiptcertified_ | $11.64 |
Certified + physical return receiptcertified_ | $14.27 |
Each piece is priced at what it costs us: the print and postage supplier's price plus card processing, with no markup and no monthly fee. Extra pages and color are priced the same way, and the proof always shows the exact number before you spend anything. Checking addresses, making proofs and reading status are free. Full pricing.
Worth knowing
- A key cannot be shown again. If you lose it, make a new one and write to hello@mailsnail.dev about the balance on the old one.
- A key's balance is its own. It is separate from an account you signed in to from Claude, ChatGPT or Cursor.
- Making keys is limited to five an hour from one place. Sending letters is not.
- Letters go to US addresses, printed and handed to USPS by a third-party print partner on the next business day.
- You are responsible for what you mail. No spam, harassment or fraud: see the terms and the privacy policy.
For a program reading this
Every route and field is in /openapi.json, and the same steps in plain text are in /llms-full.txt. The key, a proof, the funding page and the balance each answer with a next_step that names the call to make next. A mailed letter answers with one too: when it is printed, how long it travels, and how to check on it or cancel it.
An agent that keeps skills can install the whole procedure as one file, /skill.md. With the skills CLI that is npx skills add https://mailsnail.dev; in Hermes Agent it is hermes skills install https://mailsnail.dev/.well-known/.
Stuck? Email hello@mailsnail.dev.