Getting Started
Errors
Every error the API returns, what it means, and what to do about it.
Every error comes back in the same envelope, with a stable code you can branch on. Branch on code, not on message: messages are written for people and can change.
{
"data": null,
"meta": { "request_id": "6f1c2a9e-3b7d-4c55-9a0e-2d8f1b4c7e10" },
"error": {
"code": "VALIDATION_ERROR",
"message": "date_of_birth must be a date (YYYY-MM-DD)",
"details": { "field": "date_of_birth" }
}
}error.detailsis present only when there is something more specific to say, such as the field at fault.- Every response, success or error, carries an
X-Request-Idheader with the same value asmeta.request_id. - Every error response also carries
X-Error-Code, so you can read the code without parsing the body.
Error codes
| Code | HTTP | What it means | What to do |
|---|---|---|---|
UNAUTHORISED | 401 | No Authorization header, a malformed key, or a key that is revoked or doesn't exist. | Check the key and that it is sent as Authorization: Bearer <key>. Don't retry unchanged. |
TEST_KEY_OUTSIDE_SANDBOX | 403 | A pk_test_ key was used against a practice. Test keys only work in a sandbox. | Create the key in your practice's sandbox. See Testing your integration. |
LIVE_KEY_IN_SANDBOX | 403 | A pk_live_ key was used against a sandbox. Live keys only work in a practice. | Use a pk_test_ key for the sandbox, or a live key against your practice. |
FORBIDDEN | 403 | The key lacks the scope this operation needs. The message names the missing scope and lists the key's scopes. | Add the scope to the key in Jump. Each operation's scope is shown in the API reference. |
FORBIDDEN | 405 | The operation exists but is never allowed, such as deleting a patient or an episode event. | Use the documented alternative (for a patient, archive with PATCH). |
NOT_FOUND | 404 | No record with that id in your organisation, or no endpoint at that path. | Check the id and path. A record in another organisation is reported as not found. |
VALIDATION_ERROR | 422 | The request is well-formed but a value is missing, the wrong type, or out of range. | Fix the field named in the message or details. Don't retry unchanged. |
INVALID_STATE_TRANSITION | 422 | The change isn't allowed from the record's current state, for example cancelling an appointment that is already completed. details gives the current status and the attempted action. | Read the record, then make a change its current state allows. |
CONFLICT | 409 | A value that must be unique is already in use (such as an NHS number in your organisation, named in details); an Idempotency-Key was reused with a different body; or a booking changed while it was being prepared. | For a duplicate, fetch the existing record. For an idempotency conflict, use a new key. For a booking, read availability again and retry. |
SLOT_UNAVAILABLE | 409 | The slot was taken or is no longer bookable. | Choose another slot from availability. |
HOLD_EXPIRED | 410 | The hold on the slot ran out before you booked. | Place a new hold, then book. |
HOLD_RELEASED | 410 | The hold was released before you booked. | Place a new hold, then book. |
HOLD_ALREADY_USED | 409 | An appointment has already been booked with this hold. | Fetch the appointment rather than booking again. |
RATE_LIMITED | 429 | The key has used its hourly allowance. | Wait until the top of the hour. See Rate limits. |
INTERNAL_ERROR | 500 | Something failed on our side. | Retry with backoff. If it persists, contact support with the request_id. |
Retrying safely
- Retry:
429,500, and network failures where you got no response at all. - Don't retry unchanged: any other
4xx. The same request will fail the same way. - Retrying a write? Send an
Idempotency-Keyon the original request and reuse it. A retry then returns the first result instead of applying the change twice. 429responses don't carry aRetry-Afterheader. The allowance resets on the hour.
When you contact support
Include the request_id (or the X-Request-Id header) from the failing response, the endpoint and method, and roughly when it happened. The request_id lets us find the exact request in our logs, so we won't need you to send any patient data to investigate.
Was this page helpful?
