Guide: Webhooks and the events feed
PlaySpace calls your server when something changes, so your product can stay in step with what clinicians do inside the frame: a client added, an appointment moved, a session started, a note signed. An event says what happened and to which record. It never carries a name, a date of birth, a time, a note or a join link: you fetch the record through the authenticated Partner API when you want the details.
Three things make this work, and this guide covers each:
- Webhooks push each event to an HTTPS URL you register.
- The events feed,
GET /v1/partner/events, lists the same events for 30 days, so you can catch up after downtime or fill a gap. versionandchanged_sinceon patients and appointments let you reconcile your copy from the records themselves.
Register an endpoint
An endpoint is an HTTPS URL that receives events. Create one with practitioners:write:
POST /v1/partner/webhook-endpoints HTTP/1.1
Host: agentic-ps-dev.playspace.health
Authorization: Bearer <access token>
Content-Type: application/json
{
"url": "https://partner.example.com/playspace/events",
"enabled_events": ["appointment.created", "appointment.updated", "appointment.cancelled", "patient_message.due"],
"description": "Production scheduling sync"
}
{
"data": {
"id": "7c0f1d4e-2b6a-4f0e-9d51-3a8e6b2c9f10",
"url": "https://partner.example.com/playspace/events",
"description": "Production scheduling sync",
"enabled_events": ["appointment.created", "appointment.updated", "appointment.cancelled", "patient_message.due"],
"status": "active",
"disabled_reason": null,
"created_at": "2026-11-16T18:00:00.000Z",
"updated_at": "2026-11-16T18:00:00.000Z",
"secret": "whsec_K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4="
},
"meta": { "request_id": "8f1c9b40-6c1e-4a2f-9a44-0d5e2b7c3a11", "generated_at": "2026-11-16T18:00:00.000Z" }
}
- The
secretis returned once, here and when you rotate it. Store it now; no call returns it again. - Omit
enabled_eventsto receive every event type.nullon an update means the same. - PlaySpace sends a
webhook.testevent straight away, so you can see the endpoint answer before any real event arrives.POST /v1/partner/webhook-endpoints/{id}/testsends another on demand. A test event goes only to the endpoint you name, whatever itsenabled_events. - Creating an endpoint, and rotating its secret, take no
Idempotency-Key: the response carries a credential, and PlaySpace never stores a replayable copy of one. A retried create makes a second endpoint, so read the list before you retry a create that timed out. Every other write on these endpoints takes a key like any other write. - The URL must be reachable from the public internet. PlaySpace accepts only
https, with no credentials in the URL, and refuses any name that resolves to a private, loopback or otherwise internal address. It checks at registration and again before every delivery. A refused URL answers422with the reason infields[0].code:not_https,credentials,unresolvable,blocked_addressorinvalid_url. For local development, put a tunnel in front of your machine. - An organisation can have a limited number of endpoints (the limit is 5). Another create answers
409webhook-endpoint-limit.
Manage endpoints with GET /v1/partner/webhook-endpoints and GET, PATCH and DELETE on /v1/partner/webhook-endpoints/{id}. PATCH changes url, enabled_events or status; description is set when you create the endpoint. DELETE stops delivery and removes the endpoint. Reading takes practitioners:read, as settings do.
Pause and resume
PATCH with "status": "disabled" pauses delivery. While an endpoint is disabled it receives nothing, and events keep accumulating in the events feed, so resuming is "status": "active" followed by a catch-up read. disabled_reason says who stopped it: partner (you did), gone (your server answered 410) or failing (every retry failed).
See what was delivered
GET /v1/partner/webhook-endpoints/{id}/deliveries lists recent deliveries, newest first: the event id and type, status (pending, succeeded, failed or skipped), attempt_count, last_response_status, last_failure_code and delivered_at.
What PlaySpace sends
One POST per event per endpoint:
POST /playspace/events HTTP/1.1
Host: partner.example.com
content-type: application/json
user-agent: PlaySpace-Webhooks/1.0
webhook-id: evt_01JD3W8Q9V6Z0K5X2M7R4T1N8C
webhook-timestamp: 1763316251
webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
{
"id": "evt_01JD3W8Q9V6Z0K5X2M7R4T1N8C",
"type": "appointment.updated",
"timestamp": "2026-11-16T18:04:11.123Z",
"sequence": 1042,
"data": {
"object": "appointment",
"id": "e036804f-3c96-43ee-8c6b-efbfb2869431",
"version": 7,
"url": "https://agentic-ps.playspace.health/v1/partner/appointments/e036804f-3c96-43ee-8c6b-efbfb2869431",
"related": {
"patient_id": "cf1bda21-bd30-4c82-850f-d0cb30d20af6",
"practitioner_id": "33bda49f-3b06-4462-8a9f-ff33d45c98ce",
"clinic_id": "09d28317-fbac-4dad-aa80-fc5bb714d007"
}
}
}
The envelope is the same for every event type, and the events feed returns the same envelope.
idequals thewebhook-idheader and stays the same across every retry and redelivery. It is your deduplication key.timestampis when the change happened. Thewebhook-timestampheader is when this delivery attempt was made.sequencenumbers the events of your organisation in the order they committed, across every type. See the events feed.data.idis the identifier the Partner API already returns for that record, never an internal one.data.versionincreases on every change to the record. Keep the highest version you have applied.data.urlis where to fetch the current record. It is present for patients and appointments, and omitted for notes, forms and tests, which have nothing to fetch.data.relatedcarries the ids of the records around it. Which ids depends on the object.
The event types
| Type | Sent when | data.object |
|---|---|---|
patient.created |
A patient is created through the API, or by a clinician in the frame | patient |
patient.updated |
A patient's name, preferred name, date of birth, email, phone or time zone changes, anywhere | patient |
patient.archived |
A clinician archives the patient | patient |
patient.deleted |
The patient is deleted through the API, or by a clinician | patient |
appointment.created |
An appointment is booked through the API, in the frame, or on the clinician's booking page | appointment |
appointment.updated |
The start or end time, time zone, session type, join link or status changes |
appointment |
appointment.cancelled |
The appointment is cancelled or deleted, from anywhere. Wins over appointment.updated when both happen in one change |
appointment |
patient_message.due |
PlaySpace would have contacted a client and, because patient contact is off, did not: below | appointment |
session.started |
The first participant joined the live session. Once per appointment | appointment |
session.patient_joined |
The client joined the live session. Once per appointment | appointment |
session.ended |
The session ended. data.duration_seconds runs from the first join to the last leave. Once per appointment |
appointment |
note.signed |
A clinician signed a clinical note, or created one already signed | note |
form.completed |
A client completed a form | form_submission |
webhook.test |
An endpoint was created, or you asked for a test | endpoint |
A few of these deserve a line of their own.
session.endedis best effort. It is sent when the live room closes after the last participant has left, and PlaySpace's live server can be restarted or lost before it reports. A session can therefore end without one. If you depend on it, treat a missingsession.endedafter asession.startedas unknown, not as a session still running. It is recorded once per appointment, so a clinician who rejoins after the room closed does not produce a second.note.signedandform.completedcarry ids only.data.idis an opaque id for the note or form submission, anddata.relatednames the patient and, where there is one, the clinician (practitioner_id) and appointment (appointment_id). The Partner API does not return clinical content, so there is nothing to fetch: use the event to prompt your own system or your clinician.- An appointment's
statusisscheduled,completed,cancelledorno_show. Marking a session completed or no-show sendsappointment.updated. - A clinician adding a caregiver as a client can produce
patient.createdfollowed bypatient.deletedfor that caregiver. Treatpatient.deletedas final. - A change that raises
versiondoes not always send an event. The first time a join link is set on an appointment raisesversionwithout one, and so does a change to an appointment's notes alone: the clinician's note panel saves as they type. If you need notes, poll withchanged_since, below.
patient_message.due: you send the message
While your organisation's patient_contact_enabled is off, which is the default, PlaySpace emails your patients nothing. When PlaySpace would have contacted a client and did not, it records patient_message.due instead, so you know a message is yours to send. data is the usual appointment data plus message_type:
appointment_confirmation,appointment_updateandappointment_cancellation: for a booking made through the API, only when the request setnotify_patienttotrue; for a booking made or changed in the frame, whenever the clinician's action would have sent that email. A request withnotify_patientfalse records nothing.appointment_reminder: a reminder came due. Reminders are checked when they are due, so this follows the clinician's reminder schedule for every booking, API or frame.session_link: a clinician asked the PlaySpace assistant to send the client their session link.
Fetch the appointment, request the join link with POST /v1/partner/appointments/{id}/session-links, and send the message yourself. The link is a credential: deliver it securely. While patient contact is on, PlaySpace sends the emails itself and records nothing.
Verify every delivery
Check the signature before you trust a body. PlaySpace follows the Standard Webhooks specification, so an open source library does the work in most languages; use one rather than writing the comparison yourself. The signed content is {webhook-id}.{webhook-timestamp}.{raw body}, signed with HMAC-SHA256 under the endpoint's secret and sent as v1,<base64>.
In Node, with the standardwebhooks package:
import express from 'express'
import { Webhook } from 'standardwebhooks'
const webhook = new Webhook(process.env.PLAYSPACE_WEBHOOK_SECRET) // the whsec_ secret, as returned
const app = express()
// The signature covers the raw bytes: read the body raw, before any JSON parsing.
app.post('/playspace/events', express.raw({ type: 'application/json' }), (req, res) => {
let event
try {
event = webhook.verify(req.body.toString('utf8'), req.headers)
} catch {
return res.sendStatus(400) // bad signature, missing header or a stale timestamp
}
res.sendStatus(200) // acknowledge first; do the work after
void handleEvent(event) // yours: dedupe on event.id, fetch event.data.url
})
- Verify the raw body. A signature checked against a re-serialised object fails, because the bytes differ.
- The library refuses a
webhook-timestampmore than five minutes from your clock, which stops a captured delivery being replayed later. - Reply
2xxwithin 15 seconds. Acknowledge, queue the work and process it after. Anything else counts as a failure and is retried. - Standard Webhooks libraries exist for other languages, and accept the
whsec_secret as returned. Use the library's verify call, not your own hash comparison.
Delivery, retries and ordering
At least once, and not in order. Expect a repeat, and expect two events about one record to arrive in either order. That is safe because an event only tells you something changed: fetch data.url and keep the record with the highest version. Deduplicate on id.
What counts as a failure. Any 2xx is success. A timeout after 15 seconds, a connection or TLS error, a 4xx or a 5xx fails the attempt, and so does a 3xx: redirects are never followed, so register the final URL. A 429 or 503 with a Retry-After header is honoured, and the next attempt waits at least that long, up to 24 hours.
Retries. A failed delivery is attempted ten times in all: straight away, then after about 5 seconds, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, 14 hours, 20 hours and 24 hours, each wait varying by up to 10 percent. That is about three days.
When retries run out, or your server says it is gone.
- If every attempt fails, the delivery is
failed, the endpoint is disabled withdisabled_reason: "failing", and PlaySpace emails your organisation's registered contact once. - If your server answers
410 Gone, the endpoint is disabled at once withdisabled_reason: "gone". - Either way, fix the endpoint,
PATCHit to"status": "active"and read the events feed from the lastsequenceyou processed.
What is skipped. Before each attempt PlaySpace re-checks that your organisation is active and the endpoint is active and subscribed to the event type. If not, the delivery is skipped. An endpoint you paused misses the events from that time, and the feed has them.
The events feed: catch up and gaps
GET /v1/partner/events returns the events of the last 30 days in ascending sequence order, in the same envelope a webhook carries. GET /v1/partner/events/{id} returns one event by its evt_ id.
GET /v1/partner/events?after_sequence=1042&limit=100 HTTP/1.1
Authorization: Bearer <access token>
after_sequence: return events with a higher sequence. Pass the highest sequence you have applied. Omit it to start from the oldest event still kept.type: only one event type.limit: 1 to 100, default 25. Followmeta.pagination.next_cursoruntilhas_moreis false; a cursor takes precedence overafter_sequence.- Events older than 30 days are gone:
GET /v1/partner/events/{id}answers404. Past that horizon, reconcile from the records withchanged_since.
Use the feed in two cases:
- After downtime. Your endpoint was down for hours, or paused. Read from your last
sequenceuntil the feed runs dry, and process each event as if it had been delivered. - When you see a gap.
sequencenumbers every event of your organisation in commit order, with no number skipped, so a jump from 1042 to 1045 means you missed 1043 and 1044. Readafter_sequence=1042.
Gaps are not always a loss. The numbering covers every event type, so some jumps are by design:
- An endpoint with
enabled_eventsset never receives the other types, so its sequences skip them. - A token that cannot read some types does not see them in the feed. Patient, note and form events need
patients:read; appointment, message and session events needappointments:read;webhook.testneedspractitioners:read. A token missing one of those scopes sees gaps for those types.
Decide what a gap means for your integration with that in mind: a gap in a feed you read with a full set of read scopes is a missed event; a gap on a filtered endpoint is not.
version and changed_since
Patients and appointments carry two fields that let you reconcile from the records themselves:
versionincreases on every change to the record, and matchesdata.versionon events. Keep the highest version you have applied, and ignore anything lower.changed_atis when the change that raisedversionhappened.
GET /v1/partner/patients?changed_since=<ISO 8601 time with offset> and the same on /v1/partner/appointments return the records whose changed_at is at or after that instant. Patients also carry archived, true once a clinician has archived them.
changed_at is the start time of the transaction that made the change, so a change can become visible after a later one with an earlier changed_at. Overlap your windows: read from the previous read's time minus a minute, and deduplicate by version. Read changed_since after a long outage, after the 30-day horizon, or when you need notes changes, which send no event.
Records clinicians create in the frame
A clinician in your organisation who creates a client or an appointment in the frame creates it in PlaySpace, not through your API. Those records now appear in the Partner API too, so your copy can include them:
- Patients and appointments created in the frame, and appointments on the clinician's booking page, are returned by the list and
GETby id, and sendpatient.createdandappointment.created. A patient belongs to the clinic of the clinician who created it. Records that existed before webhooks were enabled were added once, quietly, so you see your full list from the first read, without a wave of events. - A group appointment, or a walk-in session with no client record, has no appointment in the API.
notesreadsnullon an appointment a clinician created in the frame. The notes are the clinician's own. Anotesyou send on aPATCHto such an appointment is accepted and ignored, with no error. Appointments you booked through the API keep their notes as before.- Deleting a patient in the frame closes the partner record and sends
patient.deleted.
Secret rotation
POST /v1/partner/webhook-endpoints/{id}/rotate-secret returns a new secret, once. For the next 24 hours every delivery carries two signatures in the webhook-signature header, separated by a space, one per active secret, and a Standard Webhooks library accepts a request that matches either. So:
- Rotate and store the new secret.
- Deploy it. The old secret still verifies until you do.
- After 24 hours only the new secret signs.
Rotating again inside the 24 hours ends the first secret at once, so wait for the deploy to finish.
Checklist
- The endpoint verifies the signature on the raw body, and refuses a bad or stale one.
- It replies
2xxwithin 15 seconds and works after replying. - It deduplicates on
id, and keeps the highestversionof each record. - It stores the last
sequenceit applied and reads the feed after downtime. - It sends
patient_message.duemessages itself, if patient contact is off. - It reconciles with
changed_since, overlapping its windows, for notes and for anything older than 30 days. - The secret is stored like any credential, and rotation is rehearsed.