# NudgeNudge > Send a push notification to your phone (iPhone or Android) with one HTTPS request. No account, no SDK: the phone's code is the address. Ask a question and get the tapped answer back. Approve sign-ins (2FA) by tapping a number. The contract is the docs page: https://nudgenudge.app/docs/ . The whole of it as Markdown, after this brief: https://nudgenudge.app/llms-full.txt . Machine-readable: https://nudgenudge.app/openapi.json (OpenAPI 3.1). When they and this file differ, the docs page wins. ## The essentials - Base URL: `https://api.nudgenudge.app` (HTTPS only; plain http is refused with 426). - A code is 12 characters like `D4RY-YY78-PNRS` (a phone's) or 9 like `PN3-U6X-MD2` (a group's: every phone in it). Dashes and case don't matter. It's the address and the only credential. - Push: `curl https://api.nudgenudge.app/{code} --json '{"from": "GitHub", "icon": "github.com", "body": "Deploy finished"}'` → `{"ok": true, "left": 4, "receipt": "…"}`. Only `body` is required. `icon` is a domain (we fetch its logo) or an https image URL. - Ask: add `"ask": ["Yes", "No"]` (up to 4 buttons) or `"reply": true` (typed answer). The request holds ~90 s for the answer (`{"answer": "Yes"}`), else replies 202 with `ask`; collect with `GET /ask/{id}?wait=60`. - Groups: a group's 9-character code rings every phone in it (up to 25; 100 on Unlimited Teams). The reply adds `name` (the group's name, as its maker named it in the app: send a first nudge when connecting a group and keep it) and `phones` (how many it went to), and `over`, `flooded`, `off` (phones past their free day, past the flood guard, with notifications off). An Ask to a group: the first answer wins. - Receipts: `GET /receipt/{id}?wait=10` → how many phones it reached (`phones`: those Apple or Google took the push for) and how many confirmed it arrived (`delivered`). - 2FA: show a two-digit number on your sign-in page, then `POST /2fa/{code}` `{"site": "Acme Admin", "number": 68}` → waits up to 60 s → `{"approved": true}` or `{"approved": false, "reason": "wrong_number" | "denied" | "expired"}` (an expired one says `delivered`). It is the second step: use it after the site's own first step (a password, or whatever it already checks), not instead of it. - Errors are `{"reason", "error"}`: branch on `reason` (stable, never renamed); `error` is a sentence for people. - Limits: 5 nudges a day per phone free (429 `daily_limit` after); Unlimited has a 1,000-a-day flood guard. 2FA is free and never counted. Replies to a phone carry `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset`. - Safe retries: send `Idempotency-Key: ` and retry with the same key; you get the first reply again, never a second notification. A retried Ask still waiting gets its 202 ticket back; one whose first request already returned the answer gets `410 answer_collected` (answers aren't kept): treat it as no answer. ## Plans The person with the phone chooses; nothing changes in the API. Free: 5 nudges a day per phone (Push and Ask). Unlimited Solo (£2.99 a month or £24.99 a year): every nudge, a 1,000-a-day flood guard. Unlimited Teams (£9.99 a month or £99.99 a year): Solo, and every group made on that phone is unlimited for everyone in it (its nudges never count towards anyone's free five; up to 100 phones). The first week of either is free, once per person. NudgeNudge 2FA is free on every plan. ## Good uses - Tell me when a long job finishes or fails (builds, training runs, backups, cron jobs). - A person in the loop for an AI agent or a script: Ask before a deploy, a deletion or a payment, and only go ahead on the tapped answer. Treat anything but the expected answer (an error, `expired`) as no. - Tell a whole team: one group code, every phone. - Sign-in approval for an admin panel or internal tool (2FA), instead of an authenticator app. ## Pages - [Docs: every request, reply and error](https://nudgenudge.app/docs/) - [OpenAPI 3.1 spec](https://nudgenudge.app/openapi.json) - [NudgeNudge 2FA: sign-in by tapping a number](https://nudgenudge.app/2fa/) - [Everything on one page, as Markdown](https://nudgenudge.app/llms-full.txt) - [Status: is the API up](https://status.nudgenudge.app) (`/api` for JSON) - [Trust: what's stored, for how long, who else is involved](https://nudgenudge.app/trust/) - [Privacy](https://nudgenudge.app/privacy/) - [Data processing agreement](https://nudgenudge.app/dpa/) - [What's new in the app](https://nudgenudge.app/whatsnew/) --- # Docs NudgeNudge does two things: **Push** sends a notification to your phone, and **Ask** sends a question with buttons and gives your code the answer. Both are one HTTPS request. Writing it with an AI assistant? Give it [nudgenudge.app/llms-full.txt](https://nudgenudge.app/llms-full.txt): this whole page as Markdown. ## Basics | | | | --- | --- | | Endpoint | `POST https://api.nudgenudge.app/{code}` | | Your code | 12 characters from the app, like `D4RY-YY78-PNRS` (a group's code is 9, like `PN3-U6X-MD2`: see [Groups](https://nudgenudge.app/docs/#groups)). Dashes and case don't matter. It's the only credential: treat it like a password. | | Recommended format | A JSON body with `Content-Type: application/json` (curl's `--json` sets this). Other formats work too: see [below](https://nudgenudge.app/docs/#formats). | | HTTPS only | Plain `http://` is refused with `426`, because it would send your code in the clear. | | Every response | JSON. Success has `"ok": true`. Errors have `"reason"` (stable, for code) and `"error"` (a sentence, for people). | ## Push Send a notification. The request returns as soon as it's handed to Apple or Google. Request ``` curl https://api.nudgenudge.app/D4RY-YY78-PNRS \ --json '{"from": "GitHub", "icon": "github.com", "body": "Deploy finished: v4.2 is live"}' ``` Response: 200 ``` {"ok": true, "left": 4, "receipt": "Hq7…"} ``` `left` is how many free nudges remain today, or `null` on Unlimited. `receipt` tells you when it reaches the phone: see [Receipts](https://nudgenudge.app/docs/#receipts). Only `body` is required: ``` curl https://api.nudgenudge.app/D4RY-YY78-PNRS --json '{"body": "Backup finished"}' ``` ## Ask Send a question with buttons. The request waits for the tap and returns the answer. Request ``` curl https://api.nudgenudge.app/D4RY-YY78-PNRS \ --json '{"from": "Deploy bot", "body": "Deploy to production?", "ask": ["Yes", "No"]}' ``` Response: 200, once you tap ``` {"ok": true, "ask": "k3J9xQ2mVb7tLw0aZr5YcA", "answer": "Yes", "left": 3} ``` `answer` is the exact text of the button you tapped, or what you typed if the Ask has `"reply": true`. You answer on the notification itself (press and hold, tap, Face ID) or in the app. ### What can happen, and what to do | Response | Meaning | Do this | | --- | --- | --- | | `200` with `answer` | Answered. | Use `answer`. Done. | | `202` with `"waiting": true` | Delivered; not answered yet. The request holds for 90 seconds, then returns this. | Call `GET /ask/{ask}?wait=60` and repeat until you get `200` or `410`. | | `410`, reason `expired` | Nobody answered before the Ask closed (its `wait`, default 10 minutes). | Treat it as no answer. Don't proceed. | | Any other error | The question never reached the phone (wrong code, today's free 5 used, too big, the push service unavailable). | Nobody was asked. Check `reason`; retry later if it makes sense. | Response: 202, still waiting ``` {"ok": true, "ask": "k3J9xQ2mVb7tLw0aZr5YcA", "waiting": true, "expires": 1794830400000, "left": 3} ``` `expires` is when the Ask closes, in milliseconds since 1970 (UTC). Keep waiting ``` curl "https://api.nudgenudge.app/ask/k3J9xQ2mVb7tLw0aZr5YcA?wait=60" ``` Returns `200` with the answer, `202` still waiting or `410` expired, each with just `ok`, `ask` and its own field (`answer`, or `waiting` and `expires`): what the send reached (`left`, or a group's `name` and `phones`) is only in the send's own reply. `wait` is how many seconds to hold (0 to 90). The answer can be collected **once**: after a `200`, the Ask is deleted and later calls return `404`, reason `unknown_ask`. The `ask` id is the only key to it, so keep it private. In a shell script ``` r=$(curl -s https://api.nudgenudge.app/$CODE \ --json '{"body": "Deploy to production?", "ask": ["Yes", "No"], "wait": 3600}') while [ "$(echo "$r" | jq -r .waiting)" = true ]; do r=$(curl -s "https://api.nudgenudge.app/ask/$(echo "$r" | jq -r .ask)?wait=60") done [ "$(echo "$r" | jq -r .answer)" = Yes ] && ./deploy.sh ``` If the connection drops before you've seen a response, you don't have the `ask` id: send the Ask again. ## Groups A group is a code that rings several phones: one request, everyone's phone. Make one in the app (Settings › Groups), give its code to your scripts and to the people who should get them, and send to it exactly as you would to your own code: ``` curl https://api.nudgenudge.app/PN3-U6X-MD2 -d "Deploy finished" ``` A group's code is 9 characters in threes (`PN3-U6X-MD2`); a phone's is 12 in fours (`D4RY-YY78-PNRS`), so the two can't be mixed up. The reply says the group's name (the one its maker gave it in the app) and how many phones it reached: `{"ok": true, "name": "Acme", "phones": 3}`. Connecting a group to your system? Send it a first nudge ("We'll send alerts here") and keep the `name` from the reply. Every phone pays its own way: a group's nudge counts against each phone's own day (the same 5 as its personal nudges). An Unlimited phone gets them all; a free phone past its 5 gets its running summary instead, and the reply counts those as `"over": 1`. A phone past the flood guard gets nothing, and the reply counts it as `"flooded": 1`; a phone that hasn't allowed NudgeNudge notifications is skipped (not counted), as `"off": 1`. If no phone can take it: `429 daily_limit` (or `flood_guard` if every phone is past 1,000). A group whose maker has Unlimited Teams is the exception: its nudges count towards nobody's 5, so its replies never carry `over`. A group's replies (Push, Ask, and the `202` while an Ask waits) carry `name` and `phones` (and `over`, `flooded`, `off`) in place of `left`. An Ask goes to everyone, and the first answer is the one you get back. Anyone with a group's code can join it, so when someone leaves, its maker changes the code in the app; put the new one in your scripts and the old one stops. ## Fields | Field | Type | What it does | | --- | --- | --- | | `body` | string, required | The message, or the question. Long text is trimmed to fit a notification (about 3 KB). | | `from` | string | Who it's from. Nudges are grouped by it in the app; with none, "Unnamed". Names starting "NudgeNudge" are reserved for us (team announcements) and are filed as "Unnamed". | | `icon` | string | A domain (`github.com`) or an `https://` image URL. See [Logos](https://nudgenudge.app/docs/#logos). | | `title` | string | A bold line above the message. | | `url` | string | An `https://` link, shown under the nudge in the app (tapping the notification opens the app at that sender, to read it whole; the link is one more tap). | | `level` | string | `passive` (silent), `normal` (default), `time-sensitive` or `critical` (both break through Focus). | | `ask` | array of strings | Makes it an Ask: the buttons, in order. Up to 4, each up to 30 characters. `true` or `[]` means Yes and No. | | `reply` | boolean | Makes it an Ask that takes a typed answer (with or without buttons). | | `wait` | integer, seconds | How long an Ask stays open. Default 600 (10 minutes), maximum 86400 (a day). | ## Responses and errors | Status | `reason` | Meaning | | --- | --- | --- | | `200` | | Delivered (Push), or answered (Ask). | | `202` | | Ask delivered, still waiting for an answer. | | `400` | `bad_request` | Missing `body`, bad JSON (or JSON that isn't an object), an unknown `level`, or too many buttons. `error` says which. | | `404` | `not_a_code` | That isn't a NudgeNudge code at all. | | `404` | `unknown_code` | No phone or group has that code (mistyped, or replaced in the app; on an app older than 1.1.1, not yet allowed notifications). | | `404` | `unknown_receipt` | No such receipt (they're kept for a day). | | `404` | `unknown_ask` | No such Ask, or its answer was already collected. | | `404` | `not_found` | No such route: a method or path the API doesn't have (say, `PUT /CODE` or `/CODE/extra`). | | `409` | `notifications_off` | That phone hasn't allowed NudgeNudge notifications (for a group: no phone in it has). Not delivered, not counted. Switch them on in the app. | | `409` | `in_progress` | A request with that `Idempotency-Key` is still going. Wait for it, then retry. | | `410` | `expired` | The Ask closed with no answer. | | `410` | `answer_collected` | A retry (same `Idempotency-Key`) of an Ask whose first request already returned the answer. Answers aren't kept: treat it as no answer. | | `410` | `phone_gone` | That phone no longer receives (app deleted). The code is retired. | | `410` | `no_phones` | A group with nobody in it (or whose phones no longer receive). | | `413` | `too_big` | Too big for a notification. | | `426` | `https_required` | Use `https://`. | | `429` | `daily_limit` | Today's free 5 are used; not delivered. Resets at midnight UTC. | | `429` | `flood_guard` | 1,000 nudges today on this code (for a group: on every phone in it; for a group Teams covers: on the group). Resets at midnight UTC. | | `429` | `rate_limited` | Too many requests from your address in a minute. Slow down. | | `429` | `too_many_wrong` | 100 different wrong codes from your address today (the same old code sent again doesn't add up). Resets at midnight UTC. | | `502` | `push_failed` | The push service (Apple's or Google's) didn't accept it. Try again shortly. | | `500` | `server_error` | Our fault. Try again shortly. | ## 2FA [NudgeNudge 2FA](https://nudgenudge.app/2fa/): approve a sign-in by tapping the number your sign-in page shows. Free, and never counted towards anyone's 5. NudgeNudge 2FA is the second step. Use it after your own first step (a password, or whatever you already check), not instead of it. Show a two-digit number (10 to 99) on your sign-in page, then send it with the person's code (a phone's, 12 characters; a group's is refused). The request waits until they answer, or 60 seconds: ``` curl https://api.nudgenudge.app/2fa/D4RY-YY78-PNRS \ --json '{"site": "Acme Admin", "number": 68, "where": "London", "icon": "acme.com"}' ``` | Field | | | | --- | --- | --- | | `site` | string, required | Your site's name, up to 30 characters. The pause after a wrong answer is per site. | | `number` | integer, required | The number your page is showing, 10 to 99. | | `where` | string | Where the sign-in comes from (a city, a device), up to 40 characters. | | `icon` | string | Your site's logo, as a nudge's `icon`: a bare domain (`acme.com`, we fetch its logo) or an `https://` image. It shows beside each of your sign-ins in the app. | The phone gets a request from **NudgeNudge 2FA**: "Sign-in request · Acme Admin · London", your number with two others, and **Not me**. Every request is worded by us, not by you, and replaces the last. | Reply | Meaning | | --- | --- | | `200 {"approved": true}` | They tapped your number. Let them in. | | `200 {"approved": false, "reason": "wrong_number"}` | Another number. Send a new request (with a new number) if they try again. A second wrong number within 5 minutes adds `paused_until`. | | `200 {"approved": false, "reason": "denied", "denied": true, "paused_until": …}` | They tapped Not me: it wasn't them. Requests from your site to this code pause for 5 minutes. | | `200 {"approved": false, "reason": "expired", "delivered": false}` | No answer within 60 seconds. `delivered` says whether the request reached the phone at all: `false` means it never arrived (or the phone's app is older than 1.4.1), so offer your other way in. | | `429 {"reason": "paused", "until": …}` | Paused after a wrong answer or Not me. `until` is when it lifts (milliseconds since 1970). | | `429 {"reason": "flood_guard"}` | 1,000 requests today to this phone: the safety cut-off, against a runaway script. Resets at midnight UTC. | The usual errors apply too (`unknown_code`, `notifications_off`, `phone_gone`, `bad_request`…). Push delivery isn't guaranteed, so keep another way in (an emailed link, backup codes). ## Limits | | | | --- | --- | | Free | 5 nudges a day per phone (a group's nudges count towards each phone's own 5). A Push and an Ask each count as one; answers don't. Past 5, nothing more is delivered until midnight UTC, and the app shows how many didn't come through and from whom. | | Unlimited | No daily allowance (Solo or Teams). A flood guard stops a runaway loop at 1,000 a day per phone. | | Teams | A group made on a phone with Unlimited Teams has no limits: its nudges reach every phone in it and never count towards anyone's 5. Its flood guard is 1,000 a day for the group. Members' own nudges and other groups count as usual. | | 2FA | No daily limit, and never counted towards the 5; the same flood guard as every code (1,000 a day). A request lasts 60 seconds. | | Rate | About 120 requests a minute from one address. | | Groups | Up to 25 phones each; 100 for a group Teams covers. | | Size | Requests up to 16 KB; what fits in a notification is about 3 KB. | | Delivery | Through Apple's push service to an iPhone, Google's to an Android phone. A phone that's off for more than a day misses what was sent meanwhile; nothing is stored to resend. | ## Other request formats JSON is recommended. These are equivalent, if they suit your tool better. The field names are the same everywhere. Plain text body, fields as headers ``` curl https://api.nudgenudge.app/D4RY-YY78-PNRS -H "From: GitHub" -d "Deploy finished" curl https://api.nudgenudge.app/D4RY-YY78-PNRS -H "Ask: Yes, No" -d "Deploy to production?" ``` Headers: `From`, `Icon`, `Title`, `Url`, `Level`, `Ask` (comma-separated), `Reply: true`, `Wait`. Form fields ``` curl https://api.nudgenudge.app/D4RY-YY78-PNRS -d from=Cron -d body="Job ran" ``` Query string (GET), for tools that can only open a URL ``` https://api.nudgenudge.app/D4RY-YY78-PNRS?from=Pi&body=Garage+door+open ``` ## Logos `icon` is a domain (we find its logo) or an `https://` image URL. You only need it on the first nudge from each sender: after that, any nudge with the same `from` shows that logo automatically. Send a new `icon` to change it. Logos for a domain are fetched by our server, so your phone never contacts the site. ## Retries and your allowance Safe retries If a request times out, you can't tell whether the nudge went. Send an `Idempotency-Key` header (anything up to 200 characters, unique per nudge) and retry with the same key: you get the first reply again, with `Idempotent-Replayed: true`, and no second notification. ``` curl https://api.nudgenudge.app/D4RY-YY78-PNRS -H "Idempotency-Key: deploy-4812" -d "Deployed v4.2" ``` Keys are kept for a day. Only a reply that delivered (`2xx`) or hit a limit (`429`) is kept; anything else (a bad request, `502 push_failed`) can be retried for real with the same key. A retried Ask that's still waiting gets its ticket back (`202`, with `ask`): collect the answer at `GET /ask/{id}`. If the first request had already come back with the answer, the retry gets `410`, reason `answer_collected`: we don't keep answers, so it can't be given twice. Treat that as no answer. While the first request is still going, a retry gets `409 in_progress`. Allowance headers A reply to a phone's code that delivered (`200`, `202`) or hit a limit (`429`) carries the standard rate-limit headers (a replayed reply doesn't): ``` RateLimit-Limit: 5 today's allowance (1000 on Unlimited: the flood guard) RateLimit-Remaining: 4 what's left after this one RateLimit-Reset: 41260 seconds until midnight UTC, when it resets ``` A group's replies don't carry them: each phone in it has its own day, so the body's `phones`, `over` and `flooded` say how it went. ## Receipts Apple or Google accepting a push isn't the phone having it. Every reply carries a `receipt`; ask it whether the push arrived. ``` curl "https://api.nudgenudge.app/receipt/Hq7…?wait=10" ``` Response: 200 ``` {"ok": true, "receipt": "Hq7…", "phones": 1, "delivered": 1, "at": 1795218604465} ``` | | | | --- | --- | | `phones` | How many phones it reached: those Apple or Google took the push for (a group's phone whose push was refused isn't counted, so `wait` never waits on it). | | `delivered` | How many have confirmed it arrived. A phone on an app older than 1.4.1 never confirms. | | `at` | When the first confirmed (milliseconds since 1970), once one has. | | `wait` | Seconds to wait for every phone to confirm, 0 to 30 (default 0: answer now). | Receipts are kept for a day, then `404 unknown_receipt`. They hold no content: which code, how many phones, which confirmed and when. ## Keep your code safe Anyone with your code can nudge you. If it leaks, tap **Get a new code** in the app's Settings: the old one stops at once, and senders using it get `404 unknown_code`. Put the new one in your scripts. How we look after what we hold: [Trust](https://nudgenudge.app/trust/). The whole API as an [OpenAPI 3.1 spec](https://nudgenudge.app/openapi.json), and in brief for AI assistants at [/llms.txt](https://nudgenudge.app/llms.txt).