push.do API
The API is plain HTTP, so curl or any HTTP client is enough. The base address is https://push.do. Publishing works like ntfy (message, title, priority, tags), so most ntfy scripts only need a new host. What push.do adds is that a notification can be a question: you ask with a few options, the person taps one on the phone or types a reply, and the answer comes back as the response to your open HTTP request.
An open topic needs no account. It is created when it is first used; its name is 1 to 64 characters from A-Z a-z 0-9 _ -. Anyone who knows the name can read the topic and answer its questions, so pick a name that is hard to guess (agent-q9f3k7, not alerts). A team can have private topics instead, which only its members read.
- Send a notification
- Ask a question
- Read a topic
- Private topics
- Errors and limits
- Calling from a web page
- Opening a topic in a browser
Send a notification
curl -d "Backup finished" https://push.do/mytopic
Title, priority and tags go in headers (Title, Priority, Tags, or X-Title, X-Priority, X-Tags) or query parameters, as in ntfy:
curl -H "Title: New signup" -H "Priority: high" -H "Tags: tada" \ -d "[email protected] joined" https://push.do/signups
Or post JSON to the root:
curl https://push.do -d '{"topic": "signups", "message": "[email protected] joined", "title": "New signup", "priority": 4, "tags": ["tada"]}'
The response is 200 with the stored event:
{"id":"k3Jd9sLq2xPz","time":1794850283,"event":"message","topic":"signups","message":"[email protected] joined","title":"New signup","priority":4,"tags":["tada"]}
Priority is 1 to 5, default 3; outside JSON it can also be min, low, default, high, max or urgent. A message is at most 4096 bytes (larger gets 413), a title at most 256 characters, and there are at most 10 tags of up to 64 characters each. Other ntfy options (actions, attachments, delays, email) are ignored.
Ask a question
curl https://push.do/agent-q9f3k7/ask -d '{
"question": "Where should I deploy?",
"body": "Build passed, tests are green.",
"options": ["staging", "prod", "cancel"],
"wait": 90
}'
question: required, up to 256 characters.body: optional, up to 2000 characters.options: 2 to 6 different options, up to 40 characters each.allow_text: whether a reply in the person's own words (up to 1000 characters) is allowed; defaulttrue.wait: how many seconds to keep the request open for the answer; default and at most 90 (a larger value is cut to 90),0to return at once. Proxies end a response that stays silent too long, Cloudflare after 100 seconds, so to wait longer, wait again as below.
The response comes as soon as the question is answered, or when wait runs out.
200, answered. kind is option or text:
{"id":"Gx4kQ2pLm9Za","status":"answered","answer":"staging","kind":"option","answered_at":1794850301}
202, no answer yet:
{"id":"Gx4kQ2pLm9Za","status":"pending","expires_at":1794936683}
410, the question expired; questions expire 24 hours after they are asked:
{"id":"Gx4kQ2pLm9Za","status":"expired"}
Every response about a question also has its ID in the X-Question-ID header. A 202 can come early when the server restarts. Closing the connection does not cancel the question. To wait for it again, with the same responses:
curl "https://push.do/agent-q9f3k7/ask/Gx4kQ2pLm9Za?wait=90"
wait works as above (default 90, 0 for the current state). An answered question returns 200 at once, even long after the answer; an expired one returns 410. Questions and answers are kept for 7 days, after that 404.
Text mode
With format=text on either request the body is the bare answer instead of JSON: the answer and a newline with 200, an empty body with 202 and 410. The question ID is then only in the X-Question-ID header, so keep the headers, for example with -i:
curl -si "https://push.do/agent-q9f3k7/ask?format=text" -d '{"question": "Deploy to prod?", "options": ["yes", "no"]}'
HTTP/2 202 content-type: text/plain; charset=utf-8 x-question-id: Gx4kQ2pLm9Za
curl -s "https://push.do/agent-q9f3k7/ask/Gx4kQ2pLm9Za?wait=90&format=text"
yes
Answering
The app answers like this, which is also handy for testing:
curl https://push.do/agent-q9f3k7/ask/Gx4kQ2pLm9Za/answer -d '{"answer": "staging", "kind": "option"}'
The first answer wins and gets 200; a later one gets 409 with the answer that won. An option answer must be one of the options, and a text answer needs allow_text, otherwise 422.
Read a topic
curl "https://push.do/mytopic/json?poll=1&since=all"
The response is the topic's events ("event" is message, question or answer), one JSON object per line, as in ntfy. since is all, a Unix time, or an event ID for the events after it; an ID the server no longer has returns everything it keeps. Only polling (poll=1) is supported, streaming returns 501. Events are kept for 7 days. GET /{topic}/msg/{id} returns one event.
A response has at most 1000 events, oldest first. If you get 1000, ask again with since= the id of the last one, until fewer than 1000 come back. Paging this way never skips an event, even one sent while you read.
Private topics
A team's topic lives at https://push.do/@team/topic, for example @acme/deploys. Only the team's members read it and answer its questions; they sign in with a code sent to their e-mail. Scripts and agents send to it with a token of the team:
curl -H "Authorization: Bearer $PUSHDO_TOKEN" -d 'Deploy finished' https://push.do/@acme/deploys
Open topics do not change: they still need no account and no token.
The web app does all of this with buttons: signing in, teams, members, tokens, and reading and answering a team's topics. The iPhone app signs in too (the account button above the topic list), adds your teams' topics and reads and answers them; teams, members and tokens are managed in the web app.
Signing in
An account is an e-mail address; the first sign-in creates it. The address must be a plain ASCII one with an ordinary domain ([email protected]); its case and the spaces around it do not matter. Ask for a code:
curl https://push.do/v1/auth/code -d '{"email": "[email protected]", "lang": "en"}'
The answer is 204, the same whether or not the address has an account, and a message with an eight-digit code goes to the address (lang is en or ru, the language of the message). When very many messages are asked for at once, some are dropped, so ask again if no code comes within a minute. A code works for 10 minutes. Asking again sends a new one, and the earlier ones keep working until one of them is used: a sign-in deletes every code of the address. Exchange the code for a session:
curl https://push.do/v1/auth/session -d '{"email": "[email protected]", "code": "12345678"}'
{"token":"pds_…","email":"[email protected]"}
Keep the token in $SESSION for the requests below. A malformed address gets 400 invalid e-mail address, a wrong, used or expired code 401.
Signing in has limits, answered with 429 and Retry-After:
- Asking for a code: once a minute and 5 times an hour per address and client; 20 times per address from all clients, then once every 3 minutes; 100 times a day per client.
- Trying a code: 100 times an hour per client. After 5 wrong codes in 10 minutes from one client, that client waits before it tries the address again. After 20 wrong codes for an address from all clients, its live codes are deleted and even the right one gets
401: ask for a new code.
A session works as long as it is used; one unused for 90 days is deleted, and an account keeps at most 20, dropping the one unused the longest.
Every request below takes the session in Authorization: Bearer $SESSION:
| Request | What it does |
|---|---|
GET /v1/account | Your address and teams: {"email":"[email protected]","teams":[{"name":"acme","role":"owner"}]} |
DELETE /v1/auth/session | Signs this session out, 204. |
DELETE /v1/auth/sessions | Signs out every session of the account, for a lost phone, 204. |
DELETE /v1/account | Deletes the account with its sessions, its tokens and its places in teams, 204. The only owner of a team gets 409: delete the team or make someone else an owner first. |
Teams
curl -H "Authorization: Bearer $SESSION" https://push.do/v1/teams -d '{"name": "acme"}'
A team's name is 2 to 32 characters from a-z 0-9 - and starts and ends with a letter or a digit. Whoever creates a team first owns it: 201 with {"name":"acme","role":"owner"}. A taken name gets 409, a name that does not fit or is kept for the service 400. One account can create 3 teams.
The team's name is case-insensitive in an address and in the topic field of a JSON message (@Acme/deploys is @acme/deploys). Topic names are case-sensitive, as for open topics, and the names an open topic cannot have (health, v1 and the others) are not topics inside a team either. A topic of a team is created when it is first used, as an open one.
An owner adds people by address:
curl -H "Authorization: Bearer $SESSION" https://push.do/v1/teams/acme/members \
-d '{"email": "[email protected]", "role": "member", "lang": "en"}'
The answer is 201 with {"id":"…","email":"[email protected]","role":"member"}, and the address gets a message that it was added. There is nothing to accept: once Bob signs in with that address, he is in the team, even if he had no account when he was added. One account sends at most 300 such messages a day, one client address 300 a day, and the whole server 2000 a day; one address gets 3 at once, then one more every 8 hours. Beyond any of these the person is still added, without a message. Adding an address that is already in the team changes its role (200). A role is owner or member, default member; a team can have several owners, and up to 100 members.
| Request | Who | Answer |
|---|---|---|
POST /v1/teams {"name"} | Anyone signed in | 201; 409 the name is taken or you have created 3 teams; 400 the name does not fit or is kept |
GET /v1/teams/{team} | A member | {"name","role","members":[{"id","email","role"}],"topics":[{"name","time"}]}: your role, every member, and the topics with events, the latest first, at most 1000 of them; time is the Unix time of a topic's latest event |
DELETE /v1/teams/{team} | An owner | 204; the team's events, questions, tokens and members go with it, and the name is free again |
POST /v1/teams/{team}/members {"email","role","lang"} | An owner | 201 with the member; 200 when the address was there and its role changed; 409 the team has 100 members, or a team needs an owner when it would demote the only owner |
PUT /v1/teams/{team}/members/{id} {"role"} | An owner | 204; 409 for the last owner; 404 member not found |
DELETE /v1/teams/{team}/members/{id} | An owner, or the member to leave | 204; 409 for the last owner; 404 member not found |
GET /v1/teams/{team}/tokens | A member | [{"id","name","by","created","last_used"}]: your tokens, or every token to an owner; Unix times, last_used is 0 for a token never used |
POST /v1/teams/{team}/tokens {"name"} | A member | 201 with {"id","name","token"}; 400 unless the name is 1 to 64 characters; 409 the team has 100 tokens |
DELETE /v1/teams/{team}/tokens/{id} | Its creator or an owner | 204; 404 token not found, also for another member's token |
A member who is not an owner gets 403 for an owner's request. A team that does not exist or that you are not in is 404 not found. These requests need a session: a token gets 403.
Tokens
A token sends to the topics of one team. Any member creates one and names it:
curl -H "Authorization: Bearer $SESSION" https://push.do/v1/teams/acme/tokens -d '{"name": "CI"}'
{"id":"…","name":"CI","token":"pdt_…"}
The token is shown only in this answer; keep it in $PUSHDO_TOKEN, as a secret of your CI. It belongs to the member who created it: when that person leaves the team, is removed or deletes the account, the token is deleted and gets 401.
A team topic takes the same requests as an open one (message, JSON to the root with "topic": "@acme/deploys", question, waiting again, answer, feed, one event), with the token or a member's session in Authorization: Bearer. curl -u works too, with the token as the password and any user name:
curl -u :$PUSHDO_TOKEN -d 'Deploy finished' https://push.do/@acme/deploys
A question waits for a member's answer, and the answer says who gave it in by:
curl -H "Authorization: Bearer $PUSHDO_TOKEN" https://push.do/@acme/deploys/ask \
-d '{"question": "Deploy to prod?", "options": ["Yes", "No"]}'
{"id":"Gx4kQ2pLm9Za","status":"answered","answer":"Yes","kind":"option","answered_at":1794850301,"by":"[email protected]"}
by is also in the answer event of the feed and in a 409 to a late answer. Open topics have no by. In events and pushes topic is the full name, "@acme/deploys".
Who can do what
| In a team's topic | A member (session) | A token |
|---|---|---|
| Send a message | Yes | Yes |
| Ask a question and wait for the answer | Yes | Yes |
| Read the feed or one event | Yes | No |
| Answer a question | Yes | No |
| Get pushes on a device | Yes | No |
Access is checked when a request starts: a wait for an answer that began before someone was removed or a token was revoked runs to its end, at most PUSHDO_MAX_WAIT (90 seconds). If the team is deleted meanwhile, the wait ends with 404.
A refused request gets, in this order:
404 not foundbefore anything else when the address cannot be a team topic's: a team part that does not fit (/@a/x) or a topic name an open topic cannot have (/@acme/health). In the JSON form such atopicgets400 invalid topic nameinstead.403 topic is blocked: the server blocks this topic or its whole team. Up to here no credentials are looked at.401: noAuthorizationheader, or a session or token the server does not know: signed out, revoked, or the token of someone no longer in the team. The answer hasWWW-Authenticate: Bearer.429: the caller's limit (below), spent before the team is looked at, so a signed-in stranger spends their own.404 not found: a session of someone who is not a member, a token of another team, or a team that does not exist. It is the same answer in each case, so a team topic's address does not tell whether the team exists. Creating a team does: a taken name gets409.403: a token tried to read or answer.429: the team's ceiling (below) is reached.
GET https://push.do/@acme/deploys and GET https://push.do/@acme redirect to #/t/@acme/deploys and #/team/acme of the web app, for any team: they need no credentials and tell nothing.
Sending, asking and answering in team topics have limits of their own, counted per token or account rather than per client address: 120 requests at once, then one more a second, at most 20000 a day, and 200 waits for an answer at the same time. Reading a team topic has the reading limit of open topics, also per token or account. Above these budgets are ceilings, taken after the membership check, and a request over one gets 429: all tokens and members of one team together send at most 600 requests at once, then one more every 200 milliseconds, at most 100000 a day, with 1000 waits for an answer at the same time; and all teams of the server together have 5000 waits. Two things still count per client address:
POST /with"topic": "@acme/deploys"(the JSON form) first spends the address's limit for open topics (PUSHDO_LIMIT_SEND: 60 at once, one more every 5 seconds, 500 a day), then the caller's. A CI behind one address should send to the path,POST /@acme/deploys.- Requests with no credentials or with credentials the server does not know, and reads of open topics, spend the address's reading limit (
PUSHDO_LIMIT_READ). While it is spent, every request with a session or token from that address gets429too.
Devices
These requests are the apps' own API, for an app of your own. A device registers with POST /v1/devices, whose answer gives the device_id and device_secret used below as $DEVICE_ID and $DEVICE_SECRET. A device gets a team topic's pushes only while it is bound to a live session of a current member:
curl -X PUT -H "Authorization: Bearer $DEVICE_SECRET" \
https://push.do/v1/devices/$DEVICE_ID/session -d "{\"session\": \"$SESSION\"}"
The answer is 204, or 401 invalid session for a session the server does not know. Binding to another session drops the device's subscriptions to team topics, so send the list again after every sign-in. Then PUT /v1/devices/{id}/subscriptions takes full names such as "@acme/deploys" in topics, with the team in lower case ("@Acme/deploys" is 400 invalid topic name in topics). If the device is not bound to a member of some of those teams, the answer is 403 with those topics, and no subscription changes:
{"http":403,"error":"the device is not signed in as a member of these teams","topics":["@acme/deploys"]}
Leave the named topics out and send the request again, so that the rest keep working. DELETE /v1/devices/{id}/session unbinds the device and drops its subscriptions to team topics; open topics stay. Signing out and being removed from the team drop them too. The pushes a server sends itself stop at once for a person removed from the team, signed out, or signed out everywhere; for a self-hosted server that relays pushes through push.do, see below. On a server without accounts a team topic in topics is 400.
On your own server
A self-hosted server has accounts and private topics only with mail for the sign-in codes: both PUSHDO_SMTP_URL (smtp://user:password@host:587 with STARTTLS, or smtps://…:465; a %, /, ?, # or @ in the user name or password is percent-encoded, and in a compose file or its .env a $ is written $$) and PUSHDO_MAIL_FROM, an e-mail address. With only one of them, or a sender that is not an address, the server does not start; without both, these requests answer 404, and everything else works as before.
A server that relays its pushes through push.do relays a team topic's pushes the same way: push.do gets only the hash of the topic's address and the event ID, and pushes to every device subscribed to that hash, with no team to check. So someone who guesses the full address of a team topic on that server can learn that something happened in it, though not what; and a member removed from the team keeps getting these pushes without content until the device drops the topic. On push.do itself neither is possible.
Errors and limits
Errors are JSON, for example:
{"http": 429, "error": "rate limit exceeded"}
Over a limit the server answers 429 with Retry-After in seconds. Reading has a limit of its own, apart from sending. A client is an IPv4 address or an IPv6 /64, and days are UTC calendar days. The hosted service has these limits:
| What | Limit |
|---|---|
| Sending, asking and answering | 60 requests at once per client, then one more every 5 seconds; at most 500 a day per client |
Reading: GET /{topic}/json, GET /{topic}/msg/{id}, GET /{topic}/ask/{id} | 300 requests at once per client, then one more every second |
| Requests waiting for an answer | 20 at the same time per client |
| Unanswered questions | 20 per topic |
| Message size | 4096 bytes |
| Question lifetime | Expires 24 hours after it is asked |
| Messages, questions and answers | Kept for 7 days |
Calling from a web page
A script on any web page may call the API: every response has Access-Control-Allow-Origin: *, and preflight requests are answered. The API uses no cookies, so this opens nothing that knowing a topic's name does not already open.
Opening a topic in a browser
A topic's own address opened in a browser, such as https://push.do/my-topic, leads to that topic in the web app at https://web.push.do. The web app reads topics, answers questions and shows notifications. A team's address, such as https://push.do/@acme, leads to the team's screen there, and a team topic's address to that topic; without a sign-in, both ask for one first.