← Back to DocsAPI Design
Recipe Response Schema Design
Consistent, predictable API response shapes are the foundation of a reliable integration. Every Meridian endpoint returns a uniform envelope so clients can handle success and error paths with a single code path.
Envelope Structure
All responses wrap payloads in a top-level object with three keys: status, data, and error.
{
"status": "success" | "error",
"data": { ... },
"error": null | {
"code": "VALIDATION_ERROR",
"message": "Human-readable detail",
"fields": { "email": "Invalid format" }
}
}Success payload
The data key carries the resource. Collections include a meta object with pagination cursors and total counts.
Error payload
Error codes are stable machine-readable strings. The optional fields map provides per-field validation details for forms.
Tip: Always check status before destructuring data. A 200 OK can still carry an error envelope when the request was syntactically valid but semantically rejected.