Skip to main content

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.

409 Conflict
{
"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​

FieldRequiredPurpose
typeYesStable URI that identifies the failure. Branch on this value.
titleYesShort human label for the failure class.
statusYesHTTP status code, repeated in the body.
detailYesOne sentence that names the record, the field, or the limit that failed.
instanceNoRequest path that produced the failure.
request_idNoValue 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​

typeStatusAppears when
/errors/invalid-request400A parameter or body field fails its schema.
/errors/unauthorized401The request carries no credential, the credential expired, or a key is outside the registry.
/errors/insufficient-scope403The token authenticated and lacks a scope the route requires.
/errors/record-not-found404No record matches that identifier.
/errors/microchip-already-registered409The microchip number already belongs to another animal.
/errors/adoption-hold-conflict409Another applicant holds that animal.
/errors/duplicate-refund409A refund already covers that cost line on the application.
/errors/business-rule-rejected422The request parses, and a policy rule rejects it.
/errors/rate-limited429The 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. The WWW-Authenticate header carries error="invalid_token".
  • 403 covers a valid token without the scope the route declares. The challenge carries error="insufficient_scope" and a scope parameter 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.

422 Unprocessable Content
{
"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​

StatusRetryWhy
400NoThe same body fails again.
401Once, with a fresh tokenThe token expired.
403After the token requests that scopeA wider grant or a new consent fixes it.
404NoThe record doesn't exist at that identifier.
409After the hold expiresThe lock clears itself at expires_at.
422After the business rule changesQuarantine lifts, stock arrives, or a counselor overrides.
429After Retry-After secondsThe 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.