TurboFiles

Responses

The TurboFiles API implements the JSON:API specification, ensuring a consistent and predictable response structure across all endpoints.

Response Structure

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 resource
  • attributes: Object containing the resource's core data
  • relationships (optional): Defines connections to other resources
  • links (optional): Provides related URLs
  • meta (optional): Contains supplementary information

Error Handling

The API uses standard HTTP status codes to indicate request outcomes:

  • 2xx: Success
  • 4xx: 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"
    }
  ]
}