Page cover

Request & Response Model

Design goals

Acceso enforces a unified request and response contract across all endpoints. Clients get predictable envelopes, stable error shapes, and consistent metadata.

  • Clients should branch on success, not on ad-hoc fields.

  • Errors should be machine-actionable and human-readable.

  • Responses should carry correlation and timing metadata.

  • Backward compatibility should be explicit and versioned.

Requests are validated against expected parameter schemas. Invalid input returns a structured error before any domain processing occurs.

Request validation

  • Required vs optional parameters.

  • Type correctness (string vs number vs object).

  • Allowed ranges and enums.

  • Pagination knobs (limits, cursors, sorting).

  • Payload size and content-type.

Response envelope

Successful responses use a consistent envelope:

meta is reserved for platform metadata. Domain data must stay in data.

  • request_id: correlation identifier for tracing and support.

  • timestamp: server timestamp (epoch seconds).

Pagination conventions

Endpoints that return collections should expose pagination in meta. The shape is consistent even when the internal store differs.

HTTP status mapping

HTTP status codes convey broad intent:

  • 200 / 201: success.

  • 400: invalid request shape or parameters.

  • 401: authentication failure (missing or invalid API key).

  • 403: authenticated, but not authorized for that API surface.

  • 404: resource not found (when applicable).

  • 429: rate limited or quota exceeded.

  • 500: unexpected platform error.

Error envelope

Internal stack traces and upstream identifiers are intentionally not exposed.

  • code: stable identifier for programmatic handling.

  • message: safe, user-facing summary.

  • details: optional structured context for debugging.

Error fields

Idempotency and retries

For endpoints that mutate state (when supported), use idempotency to make retries safe.

  • Client generates an idempotency key per logical operation.

  • Client sends it on retries with the same payload.

  • Server returns the original result when appropriate.

Example: idempotent request header

Last updated