# Catch up after an outage

> Read a checkup or a member with the read API, and list the checkups your system missed.
>
> Preview: proposed, may change.

A webhook is a hint, not the record. Your backend reads the record from the read API: a checkup's
bundle, a member as they are now, and the checkups you missed while your receiver was down.

## The read API

Your backend calls it with an access token, as [Authentication](/docs/authentication) describes:
tokens last about five minutes, and each request for one names the scopes it wants.

| Route                                            | Answers                                                                | Scope           |
| ------------------------------------------------ | ---------------------------------------------------------------------- | --------------- |
| `GET /v1/checkups/{checkup_id}/fhir`             | The checkup's FHIR `Bundle`: the same one every time                   | `checkups:read` |
| `GET /v1/patients/{patient_id}/fhir`             | The member's FHIR `Patient`, as it is now                              | `patients:read` |
| `GET /v1/checkups?completed_from=&after=&limit=` | Your completed checkups, a page at a time, to catch up after an outage | `checkups:read` |

These routes answer health data, so they have rules of their own:

- **A Doctor gives the scopes.** Only one of your organization's Doctors can give an integration
  `checkups:read` or `patients:read`: see [Health data](/docs/credentials#health-data).
- **Only with consent.** They answer the members who consented to share their data with your
  organization, and their checkups.
- **Every read is logged**, before it is answered.

A checkup or member that is not your organization's answers `404`, as if it did not exist. What the
bundle and the `Patient` hold is on [FHIR](/docs/data/fhir). The list pages as every list does:
pass a page's `next` as `after`.

## List what you missed

Ask for the checkups completed since a little before the newest `occurred_at` you have, an hour
before for example. Start early: an `occurred_at` can be a moment after the completion that
`completed_from` filters on, and a checkup can join the list a moment after it completed.

```bash
curl "https://api.youth-platform.io/v1/checkups?completed_from=2026-10-01T08:30:00Z" \
  --header "Authorization: Bearer $YOUTH_ACCESS_TOKEN"
```

Then read the bundle of each checkup you do not have yet.

## Skip what you already have

A checkup you stored from a delivery, or from the last time you caught up, comes again in the
list. Skip the checkup ids you already have, as you skip an `event_id` you have seen.

## Make it routine

Run the same list on a schedule, every hour for example, from a little before the newest
checkup you have. Then an event lost on the way, or a receiver that answered `200` but failed
afterwards, costs a delay and never a checkup.
