Response envelopes
Every response from the CaseXchange Public API uses a consistent envelope so clients can parse success and error cases with minimal branching.Success envelope (single resource)
Endpoints that return a single resource wrap it indata alongside a meta object:
Success envelope (list with pagination)
List endpoints return an array indata and include a pagination object:
204 No Content
DELETE endpoints return204 No Content with no response body. Clients should treat any 2xx without a body as a successful deletion.
Error envelope
All error responses share a single shape built around theerror object:
Key fields
| Field | Description |
|---|---|
data | The resource object or array of resources. |
meta.requestId | Unique identifier for the request. Include this when contacting support or filing bug reports. |
meta.timestamp | ISO 8601 timestamp generated by the server when the response was produced. |
pagination | Present on list endpoints only. Contains page, limit, total, and totalPages. |
error.code | Machine-readable error category (e.g. validation_error, not_found). Use this for programmatic branching. |
error.message | Human-readable explanation suitable for logs or developer-facing output. |
error.details | Optional array of field-level validation errors. Each entry contains field and message. |
Status codes
Success codes
| Code | Meaning | When used |
|---|---|---|
200 OK | Request succeeded. | Reads, updates, and operational actions. |
201 Created | Resource created. | POST endpoints that create a new resource (e.g. cases, re-referrals). |
204 No Content | Action completed, no body returned. | DELETE endpoints. |
Error codes
| Code | Meaning | When used |
|---|---|---|
400 Bad Request | Invalid input. | Malformed payloads, invalid state transitions, unsupported file types. |
401 Unauthorized | Authentication failed. | Missing, expired, or invalid credentials. |
403 Forbidden | Insufficient permissions. | Role or ownership restrictions, environment-level access controls. |
404 Not Found | Resource does not exist. | The referenced ID could not be resolved. |
409 Conflict | Conflicting state. | Duplicate resources or invalid state transitions. |
429 Too Many Requests | Rate limit exceeded. | The client has sent too many requests in a given time window. |
Implementation tips
- Branch on
error.code, noterror.message. Thecodevalue is stable across releases;messagetext may change. - Treat
error.detailsas optional. Not every error includes field-level detail. Always check for its presence before iterating. - Handle both
200and201on success. Creation endpoints return201; most other writes return200. Accept any 2xx as success. - Preserve unknown fields. If you proxy or log payloads, do not strip unrecognized keys. The schema may add new fields in future releases without a version bump.