The TurboFiles API implements the JSON:API specification, ensuring a consistent and predictable response structure across all endpoints.
Every successful response includes a top-level data
field containing either a single resource object or an array of resource objects. Each resource object comprises:
type
: Identifies the resource category (e.g., files
, tasks
)id
: Unique identifier for the resourceattributes
: Object containing the resource's core datarelationships
(optional): Defines connections to other resourceslinks
(optional): Provides related URLsmeta
(optional): Contains supplementary informationThe API uses standard HTTP status codes to indicate request outcomes:
2xx
: Success4xx
: Client-side errors (e.g., missing parameters, failed actions)5xx
: Server-side errors (rare)For 4xx
errors, the response includes a JSON:API-compliant errors array. Each error object provides detailed information through fields like detail
, status
, and title
:
{ "jsonapi": { "version": "1.1" }, "errors": [ { "code": "401", "detail": "Max file size exceeded", "title": "Bad Request" } ] }