HTTP contract

Errors

Trestle returns stable machine-readable error codes without leaking database details.

{"error":{
  "code":"validation_failed",
  "message":"The request could not be applied.",
  "requestId":"req_2f",
  "fields":[{"path":"values.title","code":"required"}]
}}

Core statuses

  • 400 malformed input or invalid limits.
  • 401/403 missing identity or insufficient authority.
  • 404 collection or record not found.
  • 409 uniqueness, schema, or idempotency conflict.
  • 412/428 stale or missing optimistic version.
  • 422 field validation failure.

Use the response's request ID to correlate the failure with structured server logs.

Provider storage

Constraint failures are normalized into the same stable error envelopes on both providers: uniqueness, foreign-key, check and serialization errors map to consistent codes without leaking SQL or connection details.