# FiveClose Partner API Let your device, app or service work with [FiveClose](https://fiveclose.com): say someone is OK, report a fall, tell their circle when they'll be back or that they're away, and see whether their circle has been asked to check on them. FiveClose is a safety circle: a person picks up to five people who are told if they go quiet for too long, or if something happens. Pressing **I'm OK** in the app restarts that timer. This API lets a watch, a fall-detection pendant, a home sensor, a pill box, a travel app or a care provider's daily call do the same on the person's behalf. ``` POST https://fiveclose.com/api/v1/ok Authorization: Bearer fco_… ``` One key per person, made by that person, with only the permissions they tick. No partner sign-up. - [How it works](#how-it-works) - [Quick start](#quick-start) - [Getting a key](#getting-a-key) · [Permissions](#permissions) - Endpoints: [I'm OK](#post-apiv1ok) · [Fall](#post-apiv1fall) · [Back by](#post-apiv1back-by) · [Away](#post-apiv1away) · [Status](#get-apiv1status) · [Check a key](#get-apiv1key) - [What the circle receives](#what-the-circle-receives) · [Quiet days](#quiet-days) - [Errors](#errors) · [Limits](#limits) - [When to send a signal](#when-to-send-a-signal) - [Apple Health and Google](#apple-health-and-google) - [Security and privacy](#security-and-privacy) · [Testing](#testing) - [Examples](#examples) · [OpenAPI spec](openapi.yaml) · [Changelog](CHANGELOG.md) ## How it works 1. The person opens FiveClose → **You** → **Safety** → **More safety settings** → **Connected devices and services**, types a name for your service (for example "Acme pendant"), ticks what it may do and taps **Make a key**. 2. They copy the key (it is shown once) and paste it into your app's settings. 3. Your **server** calls the API with that key. 4. FiveClose acts on it as if the person had done it in the app: an I'm OK restarts their circle's timers, a fall asks the person and then alerts their circle, and so on. The key is the person's consent. They see when each key was last used and can remove it at any time; a removed key stops working at once. ## Quick start ```sh curl -X POST https://fiveclose.com/api/v1/ok \ -H "Authorization: Bearer $FIVECLOSE_KEY" ``` ```json { "ok": true, "at": "2026-11-27T09:15:02.481Z" } ``` ## Getting a key Keys are made by the person, never by you: there is no partner sign-up, client id or OAuth flow. | | | |---|---| | Where | FiveClose app or [fiveclose.com](https://fiveclose.com): You → Safety → More safety settings → Connected devices and services | | Looks like | `fco_` followed by 200 to 300 URL-safe characters (`A-Z a-z 0-9 - _ .`). Treat it as opaque and allow up to 512. | | Lasts | Until the person removes it | | Per person | Up to 10 keys, one per device or service | Suggested wording for your app: > In FiveClose, go to **You → Safety → More safety settings → Connected devices and services**, name it > "*Your product*", tick **Report a fall**, tap **Make a key**, then paste the key here. Store the key like a password: on your server, encrypted at rest, never in logs, URLs or a shipped app binary. ## Permissions Every key can say **I'm OK**. Everything else is ticked by the person when they make the key, and can't be added later (they make a new key instead). Call [`GET /api/v1/key`](#get-apiv1key) to see what a key may do. | Scope | Ticked as | Endpoints | |---|---|---| | `ok` | always | `POST /api/v1/ok` | | `falls` | "Report a fall" (ticked by default) | `POST /api/v1/fall` | | `plans` | "Set a 'back by' time or a trip away" | `POST /api/v1/back-by`, `POST /api/v1/away` | | `status` | "See whether your circle has been asked to check on you" | `GET /api/v1/status` | A call outside the key's permissions returns `403` with code `not_allowed`. ## Endpoints Base URL: `https://fiveclose.com`. Send the key as `Authorization: Bearer fco_…`, or as `X-FiveClose-Key: fco_…` if your platform can't set `Authorization`. Bodies are JSON (`Content-Type: application/json`). Times may be ISO 8601 strings or milliseconds since 1970; responses use ISO 8601 in UTC. ### `POST /api/v1/ok` The person is OK, now. No body needed. ```json { "ok": true, "at": "2026-11-27T09:15:02.481Z" } ``` ### `POST /api/v1/fall` Scope `falls`. Your device noticed a fall. | Field | | | |---|---|---| | `at` | optional | When it happened, within the last 24 hours. Default: now. | | `tz` | optional | The person's IANA time zone (`Asia/Singapore`), so the circle's email shows their local time. | ```json { "received": true, "alerting": true } ``` What happens next: 1. The person gets a notification at once: "Your Acme pendant noticed a fall. Are you OK?" 2. If they don't open FiveClose or say I'm OK (in the app, or through `POST /api/v1/ok`) within **10 minutes**, everyone in their close circle is alerted on [every channel](#what-the-circle-receives), and a check-on opens so one of them takes it. `alerting: false` means nothing new will be sent: a fall is already waiting for an answer, or the person said they were OK after `at`. If the person tells your device they're fine, send `POST /api/v1/ok` so the circle isn't alerted. FiveClose is not an emergency service. If your device detects a hard fall with no response, follow your own emergency procedure (calling emergency services or a monitoring centre) as well. ### `POST /api/v1/back-by` Scope `plans`. "I'll be back by 18:30": if the person hasn't checked in by then, their circle is asked to check on them. | Field | | | |---|---|---| | `until` | required unless `off` | A time between 1 minute and 24 hours from now. | | `off` | optional | `true` clears it: "I'm back" (this also counts as I'm OK). | ```json { "backBy": "2026-11-27T10:30:00.000Z" } ``` ### `POST /api/v1/away` Scope `plans`. Trip mode: the person is away until a date. Their circle sees it on their card, and FiveClose pauses its place-based nudges ("not home yet", "still somewhere too long"). The I'm OK timer still runs. | Field | | | |---|---|---| | `until` | required unless `off` | Within the next two months. | | `note` | optional | Up to 60 characters, shown to the circle ("Tokyo"). | | `off` | optional | `true` ends trip mode. | ```json { "away": { "until": "2026-12-02T00:00:00.000Z", "note": "Tokyo" } } ``` ### `GET /api/v1/status` Scope `status`. What a care provider needs to know whether to act, and nothing else: no names, places or circle. ```json { "lastSignAt": "2026-11-27T08:02:11.000Z", "checkOn": { "open": true, "since": "2026-11-27T09:40:00.000Z", "reason": "fall", "taken": false }, "fall": { "at": "2026-11-27T09:29:40.000Z", "circleToldAt": "2026-11-27T09:40:00.000Z" }, "backBy": null, "away": null, "today": { "level": "normal", "signs": 4, "usualSigns": 5, "shareBy": 1 } } ``` | Field | Meaning | |---|---| | `lastSignAt` | The latest sign the person is OK (app opened, I'm OK from anywhere, health readings). | | `checkOn` | `null`, or open: the circle has been asked to check on them. `reason`: `timer`, `watch`, `out` (missed back-by), `up` (not up at their usual time), `fall`, `quiet` (quieter than usual), `meal`. `taken`: someone in the circle said they'd do it. | | `fall` | `null`, or a fall waiting for an answer; `circleToldAt` is `null` until the circle is alerted. | | `backBy` | A back-by time still ahead, or `null`. | | `away` | `{ until }` while in trip mode, or `null`. | | `today` | How today compares with the person's usual day ([quiet days](#quiet-days)). `level`: `learning` (not enough history yet), `normal`, `low` (far fewer signs than usual by now), `quiet` (no sign yet, past the time they're usually around), `very_quiet` (well past it: their circle is asked to check). `signs` / `usualSigns`: signs so far today and the usual number by this time. `shareBy`: on this share of their days they had shown a sign by now. | Poll at most a few times an hour. ### `GET /api/v1/key` Is this key still connected, and what may it do? Doesn't count as an I'm OK. ```json { "valid": true, "name": "Acme pendant", "scopes": ["ok", "falls"] } ``` ## What the circle receives When a fall goes unanswered for 10 minutes, every person in the close circle who has joined gets, all at once: | Channel | What | |---|---| | Notification | On every phone and computer where they use FiveClose: "Mum's Acme pendant noticed a fall". | | Email | "Mum may have fallen": the time where Mum is, what noticed it, and her emergency contact with a call link. In the circle's language (English, 中文, Melayu, தமிழ், Indonesia, 日本語, 한국어, Español). | | WhatsApp | To anyone who linked their WhatsApp to FiveClose (WhatsApp only lets FiveClose message people who wrote to its number in the last 24 hours). | | In the app | A check-on card on Home: "I'll do it", "They're fine" or "Couldn't reach them". | Other check-ons (missed back-by, quiet for too long, a quiet day) use the notification, with email where no notification got through. ## Quiet days Besides its timers ("no sign for 7 days", "back by 18:30"), FiveClose learns each person's usual day from every sign of life: the app opened, I'm OK from anywhere (including your `POST /api/v1/ok`), health readings, and FiveClose's other apps. For each hour of the day it knows how often they've usually shown a sign by then, weighted towards recent weeks and the same weekday. When someone who is almost always around by, say, 08:30 has shown no sign by mid-morning, they get a gentle "All well today?" first, and if they still don't answer, their circle is asked to check on them. Trip mode and back-by times pause it. So your I'm OK signals do more than restart a timer: they make the person's usual day, and their quiet days, clearer. Send them when they really happen, at the time they happen. ## Errors Errors are JSON with a human-readable `error` and a stable `code`: ```json { "error": "That key isn’t connected to FiveClose. It may have been removed: ask the person to make a new one.", "code": "invalid_key" } ``` | Status | `code` | What to do | |---|---|---| | `400` | `bad_request` | Fix the request (a time out of range, for example). | | `401` | `invalid_key` | Key missing, mistyped or removed by the person. **Stop sending** with this key and ask the person to connect again. Don't retry. | | `403` | `not_allowed` | The key doesn't have that permission. The person makes a new key with it ticked. | | `405` | `method` | Wrong HTTP method. | | `409` | `no_circle` | The person has no circle any more. Nothing to do until they set one up. | | `429` | `rate_limited` | Over the limit. Wait for `Retry-After` seconds. | | `503` | `unavailable` | Try again later, with backoff. | | `5xx` | | Try again later, with backoff (for example 1, 5, 15 minutes). For a fall, retry quickly (every 30 seconds for a few minutes): the circle can only be told once FiveClose has it. | ## Limits - **60 calls per key per hour**, all endpoints together. A request over the limit returns `429` and does nothing. - One I'm OK restarts the timer, and timers are measured in hours or days: the first sign of activity in the morning plus at most one every 1 to 3 hours is plenty. ## When to send a signal Send **I'm OK** only when there is a real sign **from the person** that they are fine: - the watch was worn and the person walked, or woke up - a motion sensor at home saw them in the kitchen in the morning - they answered a care provider's daily phone call - they opened the pill box, or the fridge, or switched on the kettle Don't send it on a fixed schedule with no sign from the person, when a device merely has power or network, or when someone else did something. A false "OK" is worse than none: it can stop their circle hearing that something is wrong. Send **fall** only for a fall your device detected or the person reported. If the person cancels it on your device ("I'm fine"), send I'm OK. ## Apple Health and Google FiveClose's own iPhone app already reads falls an Apple Watch records in Apple Health (with the person's permission), so for Apple Watch wearers you don't need to send falls yourself. On Android, Health Connect has no fall data. Falls detected by Wear OS watches (Pixel Watch, Galaxy Watch) come from FiveClose's own Wear OS watch app instead (coming to Google Play), paired with the FiveClose Android app, so for those wearers you don't need to send falls either. For any other fall-detection device (a pendant, another brand of watch, a home sensor), use `POST /api/v1/fall`. ## Security and privacy - **Server to server only.** Call the API from your backend. Don't put keys in a browser page or ship them inside a mobile app where they can be extracted. (Browsers block calls from other websites: CORS allows only FiveClose's own pages.) - **HTTPS only.** - **One key per person and per service.** Never share a key between people. - **Removal is final.** A key that returns `401` will never work again. Delete it on your side. - **What FiveClose keeps** for each key: its id, the name the person gave it, its permissions, when it was made, when it was last used and how many times. A fall keeps the key's name (so the circle knows what noticed it) and the time zone you sent. Nothing else you send is stored. - **What flows back:** only `GET /api/v1/status`, and only with the `status` permission. FiveClose never sends you names, contacts, places or messages. ## Testing A staging copy of FiveClose runs at `https://fiveclose-staging.web.app`. Make a test account there, make a key in the same place, and use `https://fiveclose-staging.web.app` as the base URL. Staging keys work only on staging, and live keys only on `fiveclose.com`. To try a fall alert end to end, put a second test account in the first one's circle. ## Examples - [curl](examples/curl.sh) - [Node.js](examples/node.mjs) (no dependencies, Node 18 or newer) - [Python](examples/python.py) (standard library only) ## Support Questions, or want to be listed as a FiveClose partner? Email info@nightingaley.com. FiveClose is made by Nightingale Pte. Ltd., Singapore. The documentation and examples in this repository are under the [MIT licence](LICENSE).