Errors and problem details
Every failure returns application/problem+json with an RFC 9457 body. One shape covers validation, authorization, missing records, and hold collisions, so a client writes one parser.
{
"type": "https://api.bludhavenpets.com/errors/adoption-hold-conflict",
"title": "Adoption Hold Conflict",
"status": 409,
"detail": "Animal pet_krypto_210 is currently reserved under active hold hld_77a28f expiring at 2026-11-17T08:15:00Z.",
"instance": "/adoptions/holds",
"request_id": "req_6c1f90ab3d4e"
}
Fields
| Field | Required | Purpose |
|---|---|---|
type | Yes | Stable URI that identifies the failure. Branch on this value. |
title | Yes | Short human label for the failure class. |
status | Yes | HTTP status code, repeated in the body. |
detail | Yes | One sentence that names the record, the field, or the limit that failed. |
instance | No | Request path that produced the failure. |
request_id | No | Value of the X-Request-Id header, for a support ticket. |
Branch on type. That URI stays fixed across releases, and detail is prose written for a human. A client that pattern-matches a sentence breaks the first time the copy changes.
The error catalog
type | Status | Appears when |
|---|---|---|
/errors/invalid-request | 400 | A parameter or body field fails its schema. |
/errors/unauthorized | 401 | The request carries no credential, the credential expired, or a key is outside the registry. |
/errors/insufficient-scope | 403 | The token authenticated and lacks a scope the route requires. |
/errors/record-not-found | 404 | No record matches that identifier. |
/errors/microchip-already-registered | 409 | The microchip number already belongs to another animal. |
/errors/adoption-hold-conflict | 409 | Another applicant holds that animal. |
/errors/duplicate-refund | 409 | A refund already covers that cost line on the application. |
/errors/business-rule-rejected | 422 | The request parses, and a policy rule rejects it. |
/errors/rate-limited | 429 | The credential passed its allowance for the current window. |
The prefix https://api.bludhavenpets.com is omitted from the table for width. Prepend it to any value above to build the full URI.
A 429 carries these headers rather than a data defect. The rate limit guide covers Retry-After, the allowance per credential, and the backoff.
Telling 401 from 403
A 401 means the gateway couldn't identify the caller, and a 403 means it did but the token grants too little.
- 401 covers a missing header, a forged signature, and a token past its
exp. TheWWW-Authenticateheader carrieserror="invalid_token". - 403 covers a valid token without the scope the route declares. The challenge carries
error="insufficient_scope"and ascopeparameter naming what to request.
Both answers repeat the failure in the type field, so a client branches on /errors/unauthorized or /errors/insufficient-scope instead of on the number.
Telling 400 from 422
Both mean the request was wrong. The difference decides who fixes it.
- 400 means the payload breaks its own schema. A required field is missing, a string sits where an integer belongs, or a value falls outside its range.
- 422 means the payload is well formed and the platform still refuses. Common causes include a quarantined animal, an out-of-stock SKU, and an applicant who fails the household check.
A 400 points at the client that built the request, and a 422 points at a business rule the user needs to see.
{
"type": "https://api.bludhavenpets.com/errors/business-rule-rejected",
"title": "Business Rule Rejected",
"status": 422,
"detail": "Animal pet_krypto_210 is under medical quarantine until 2026-11-24 and cannot accept a hold.",
"instance": "/adoptions/holds",
"request_id": "req_9a02ce41b8f7"
}
Retry policy by status
| Status | Retry | Why |
|---|---|---|
| 400 | No | The same body fails again. |
| 401 | Once, with a fresh token | The token expired. |
| 403 | After the token requests that scope | A wider grant or a new consent fixes it. |
| 404 | No | The record doesn't exist at that identifier. |
| 409 | After the hold expires | The lock clears itself at expires_at. |
| 422 | After the business rule changes | Quarantine lifts, stock arrives, or a counselor overrides. |
| 429 | After Retry-After seconds | The window refills on its own. |
A POST retry needs an Idempotency-Key first. POST /refunds requires one, and a replay with the same key returns the original refund instead of a second payment.
Tracing a failure in production
X-Request-Id appears on every response, including successful ones. Log it beside the call, and quote it in a support message. Support reads the platform trace for that identifier without asking you to reproduce the call.
Customers report the symptom, and a traced identifier turns that report into a record. Animal is stuck as reserved becomes one row in a log with a reason attached.
Related guides
- Authentication and scopes - the credential rules behind a 401.
- Rate limits - the 429 headers and a backoff that works.
- Holds and concurrency - the 409 that a second counselor triggers.
- Troubleshooting - symptom to cause to fix.