REST API
Read and write a pSMS archive from your own code: messages, contacts, contact cards, the outbox and tokens.
Every pSMS archive has a JSON API under /v1. Self-hosted archives listen on the address psms status shows. Messages stay encrypted: the API returns sealed envelopes, and your code opens them with the archive key. See Decrypt a message for code, and Encryption.
Authentication
Send a token as Authorization: Bearer TOKEN.
| Token | Can | Create it |
|---|---|---|
| Owner | Everything below | Created with the archive; psms manage access create api makes a scoped copy |
| Upload | Save messages and contact cards (what the phone uses) | Written into the phone's shortcut |
| Send | Queue texts in the outbox, nothing else | psms manage access create send |
| Browser autofill | Read recent envelopes for autofill | Settings → Browser autofill |
Tokens can expire after 7 or 30 days or never, and can be rotated or revoked in Settings or with psms manage access.
Messages
| Request | Token | Purpose |
|---|---|---|
POST /v1/messages | Upload, owner | Save one encrypted message |
GET /v1/messages?limit=30 | Owner | Newest first. Pass next_cursor back as cursor for the next page. |
GET /v1/messages/{id} | Owner | One message |
PATCH /v1/messages/{id} | Owner | {"starred": true}, {"read": true}, or both |
POST /v1/messages/read | Owner | Mark many read: {"ids": ["…"]} |
DELETE /v1/messages/{id} | Owner | Delete, and remember the ID so a retried upload can't bring it back |
Saving a message:
POST /v1/messages
Authorization: Bearer UPLOAD_TOKEN
Content-Type: application/json
{ "id": "33f25af6-8774-4d98-b5bf-d73545644319",
"sender": "papamo:encrypted:v1",
"body": "BASE64(nonce ‖ ciphertext)",
"contact_id": "9f2c…64 hex…" }A new message returns 201, an identical retry 200, the same ID with different content 409, and a retry after deletion 410. The reply may include {"contact_card": "wanted"}, asking the phone to send the sender's contact card.
Contacts
| Request | Purpose |
|---|---|
GET /v1/contacts | Contacts, newest first. ?contact_id=ID finds one; ?include=messages adds up to five messages each. |
GET /v1/contacts/{id}/messages | Every message from one contact, with a cursor |
GET /v1/contacts/cards | Sealed contact cards: the phone's copy and your edited copy |
PUT /v1/contacts/{id}/card | Save {"envelope": "…"}, or {"envelope": null} to drop your edits |
A contact ID is sha256("psms-contact-v1\n" + sender + "\n" + archive key) in hex, so it identifies a sender without revealing them. psms contact-id --key-file KEY computes one.
Chats, reactions and files
pSMS for Mac stores group chats, tapbacks and files sealed with the archive key, like messages. The server links them only by opaque IDs.
| Request | Token | Purpose |
|---|---|---|
PUT /v1/chats/{id} | Upload, owner | {"envelope": "…"}: a chat's sealed title, members and Messages identifier. id is 32 lowercase hex characters. |
GET /v1/chats | Owner | Every chat's id, envelope and updated_at |
PUT /v1/messages/{id}/reactions/{reaction} | Upload, owner | {"envelope": "…"}: a sealed tapback on a message (up to 100 per message) |
DELETE /v1/messages/{id}/reactions/{reaction} | Upload, owner | Removes a tapback |
PUT /v1/messages/{id}/attachments/{n} | Upload, owner | {"envelope": "…"}: file n (0–9) of a message, sealed, up to 2 MB of base64 |
GET /v1/messages/{id}/attachments/{n} | Owner | The sealed file |
POST /v1/messages also takes a chat_id. Message listings include chat_id, reactions ([{"id", "envelope"}]) and attachments (a count) when a message has them, and GET /v1/messages?chat=ID lists one chat. Deleting a message deletes its reactions and files.
Outbox
Queue texts for a sending device, such as pSMS for Mac.
| Request | Token | Purpose |
|---|---|---|
POST /v1/outbox | Owner, send | {"to": "+15550100", "body": "On my way"}, optionally "send_at" (Unix time, up to a year ahead) to send later. Returns 202 with an id. |
GET /v1/outbox/{id} | Owner, send | queued, sending, sent or failed, with an error if it failed |
POST /v1/outbox/claim | Owner | For sending devices: take up to 10 queued texts |
POST /v1/outbox/{id}/result | Owner | For sending devices: {"status": "sent"} or {"status": "failed", "error": "…"} |
A claimed text returns to the queue if its device doesn't report back within five minutes. Once sent, the text is removed from the outbox; the sent copy lives in the archive.
On papamo.dev the outbox stores {"envelope": "…"} instead: {"to", "body"} sealed with the archive key, so Papamo never sees it.
Other endpoints
- Webhooks:
/v1/webhooks - Connect to papamo.dev:
/v1/cloud - Replicas:
/v1/replicas/{source}/messages - Health:
GET /healthzandGET /readyz
papamo.dev
The hosted API lives at https://na.sms.papamo.dev/free/v1 (also sg, ws and sa). In your own web inbox, open Account → Settings → API keys → Create API key. Copy the key before closing Settings. Send it as Authorization: Bearer YOUR_API_KEY. Choose 1 year or Never expires before creating the key. Revoke either kind in the same section. It has:
GET /messages?limit=100&offset=0(pages bynext_offset),POST /messages,PATCHandDELETE /messages/{id},POST /messages/read. There's no request for a single message: find it byidin the list.GET /contacts/cardsandPUT /contacts/{id}/card/outboxwith sealed envelopes, and managed webhooksGET /mefor your usage and plan, and the publicGET /plans
Free accounts are rate limited.