---
title: "SendForMe REST API: mail letters over HTTP"
description: "Preview and mail letters with plain HTTP: endpoints, curl examples, the 402 needs_setup response, Idempotency-Key, uploads and tracking."
url: https://sendforme.co/docs/rest-api
updated: 2026-11-29
---

# SendForMe REST API: mail letters over HTTP

> The REST API at https://sendforme.co/v1 mirrors the MCP tools. POST /v1/letters/preview is free and needs no key; POST /v1/letters mails a letter and returns 402 with a setup link the first time, then 200 with status scheduled. Send an Idempotency-Key header on sends so retries never mail twice. Auth is Authorization: Bearer sfm_...

## Basics

- Base URL: `https://sendforme.co/v1`
- Bodies are JSON with `Content-Type: application/json`. Field names are the same as the [MCP tools](/docs/mcp).
- Auth: `Authorization: Bearer sfm_...`, with a key from the [account page](/account). Previews and guides work without one.
- Spec: [https://sendforme.co/openapi.json](https://sendforme.co/openapi.json)

Errors return `{ "ok": false, "code": "...", "error": "...", "next_step": "..." }`. Status codes:

| Status | When |
|---|---|
| 200 | Success, including `scheduled` and `awaiting_approval` |
| 402 | `needs_setup`: the letter needs credit, and the body has a setup link |
| 400 | A validation error (`FROM_REQUIRED`, `CONTENT_REFUSED`, `TOO_LONG`, `INVALID_JSON` ...) |
| 401 | `INVALID_KEY` |
| 404 | `UNKNOWN_LETTER`, or no such endpoint |

The [MCP reference](/docs/mcp) lists every error code.

## Endpoints

| Method and path | Same as |
|---|---|
| `POST /v1/letters/preview` | `preview_letter` |
| `POST /v1/letters` | `send_letter` |
| `POST /v1/letters/{letter_id}/send` | `send_letter` with that id |
| `GET /v1/letters` (`?limit=&status=`) | `list_letters` |
| `GET /v1/letters/{letter_id}` (`?wait=45`) | `get_letter` |
| `DELETE /v1/letters/{letter_id}` or `POST /v1/letters/{letter_id}/cancel` | `cancel_letter` |
| `GET /v1/setups/{setup_code}` (`?wait=50`) | `wait_for_setup` |
| `POST /v1/uploads` | `upload_file` |
| `POST /v1/addresses/check` | `check_address` |
| `GET /v1/guides`, `GET /v1/guides/{kind}` | `letter_guide` |
| `GET /v1/account`, `POST /v1/account` | `account` |
| `GET /v1/pricing` | pricing and account summary |

## Preview a letter

```bash
curl -s https://sendforme.co/v1/letters/preview \
  -H "Content-Type: application/json" \
  -d '{
    "from": {"name": "Sam Rivera", "line1": "4410 Maple Ave Apt 12", "city": "Dallas", "state": "TX", "zip": "75219"},
    "to": {"company": "Northgate Property Management", "line1": "900 Commerce St Ste 300", "city": "Dallas", "state": "TX", "zip": "75202"},
    "subject": "Return of security deposit for 4410 Maple Ave, Apt 12",
    "body": "I moved out on October 31 and returned my keys the same day...",
    "mail_class": "certified_return_receipt",
    "must_arrive_by": "2026-12-10"
  }'
```

The response has `letter_id`, `letter_url` (the proof page), `price`, `price_lines`, `delivery_estimate`, `address_check` and `warnings`. Show the proof to the person before you send.

## Send it

```bash
curl -s https://sendforme.co/v1/letters \
  -H "Authorization: Bearer $SENDFORME_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: deposit-demand-2026-11-27" \
  -d '{"letter_id": "ltr_abc123def"}'
```

You can also send the full preview body to `POST /v1/letters` to preview and send in one call, or send `letter_id` plus changed fields to re-render with the changes.

**If there's credit**, you get 200 with `status: "scheduled"` and `cancel_until`. The letter waits in the undo window, then goes to the printer.

**The first time, or without enough credit**, you get **402** with:

```json
{
  "status": "needs_setup",
  "setup_code": "QF6S-2U4Z",
  "setup_url": "https://sendforme.co/go/QF6S-2U4Z",
  "amount": "<the letter rounded up to the next $5>",
  "letters_total": "$13.99",
  "message_for_user": "Here's the proof of the letter to Northgate Property Management ($13.99). Look it over and pay once to mail it ...",
  "next_step": "..."
}
```

Show `message_for_user` to the person (the link must be visible). Then wait for them:

```bash
curl -s "https://sendforme.co/v1/setups/QF6S-2U4Z?wait=50"
```

It returns as soon as they've paid, with the letter on its way. If you had no key, the response includes an `account_key` once: save it. If it says `waiting_for_setup`, call it again. Setup links last 3 days. More in [setup links](/docs/setup-links).

**With approval on, or over the per-letter limit**, you get 200 with `status: "awaiting_approval"` and a link to approve. See [approvals and limits](/docs/approvals-and-limits).

## Idempotency-Key

Send an `Idempotency-Key` header on `POST /v1/letters` and `POST /v1/letters/{id}/send`. If a request with the same key already succeeded on your account, you get the first response back with `Idempotent-Replayed: true`, and nothing is mailed twice. That includes a 402: a retry returns the same setup link. Use a key that names the letter (an order id, a row id) so a crashed script can safely run again.

## Follow it

```bash
curl -s "https://sendforme.co/v1/letters/ltr_abc123def?wait=45" \
  -H "Authorization: Bearer $SENDFORME_KEY"
```

`wait` holds the request open until the status changes (max 50 seconds). The response has `status`, `timeline`, `tracking_number` and `usps_tracking_url` for certified mail, and `mailing_record_url` once it's mailed. Statuses are listed in the [MCP reference](/docs/mcp#statuses).

Cancel during the undo window:

```bash
curl -s -X DELETE https://sendforme.co/v1/letters/ltr_abc123def \
  -H "Authorization: Bearer $SENDFORME_KEY"
```

## Upload a PDF

Ask for an upload slot, then PUT the bytes to it:

```bash
curl -s https://sendforme.co/v1/uploads \
  -H "Authorization: Bearer $SENDFORME_KEY" \
  -H "Content-Type: application/json" \
  -d '{"filename": "appeal.pdf"}'
# => {"file_id": "f_...", "upload_url": "https://sendforme.co/u/<token>", "method": "PUT", ...}

curl -T ./appeal.pdf "https://sendforme.co/u/<token>"
```

`PUT /u/<token>` takes the raw file (`curl -T`) or a multipart form (`curl -F file=@appeal.pdf`). PDF, PNG or JPEG, up to 25 MB. The link works once and lasts 24 hours. Then pass `"pdf": "f_..."` or `"attachments": ["f_..."]` in a preview. Small files can also go inline as base64, and public files as an https URL. See [bring your own PDF](/docs/bring-your-own-pdf).

## Check an address

```bash
curl -s https://sendforme.co/v1/addresses/check \
  -H "Content-Type: application/json" \
  -d '{"address": "900 Commerce St Ste 300, Dallas, TX 75202"}'

curl -s https://sendforme.co/v1/addresses/check \
  -H "Content-Type: application/json" \
  -d '{"query": "Northgate Property Management Dallas"}'
```

## Account settings

```bash
curl -s https://sendforme.co/v1/account \
  -H "Authorization: Bearer $SENDFORME_KEY" \
  -H "Content-Type: application/json" \
  -d '{"hold_minutes": 30, "max_letter_usd": 15, "default_mail_class": "certified"}'
```

`GET /v1/account` returns the balance, defaults, recent letters and an add-credit link.

## FAQ

### Do previews need a key?

No. POST /v1/letters/preview works without one. Sending, listing and account settings need a key, or an account made through a setup link.

### Is there an OpenAPI spec?

Yes, at https://sendforme.co/openapi.json. GET https://sendforme.co/v1 also lists every endpoint.

### Are there webhooks?

Not yet. Poll GET /v1/letters/{id}?wait=45: it returns as soon as the status changes, or after 45 seconds.
