Skip to main content

Standard response envelope

All API responses share a consistent structure:
{
  "success": true,
  "message": "Optional message",
  "data": { ... }
}
FieldTypeDescription
successbooleantrue on success, false on error
messagestringHuman-readable message (always present on errors)
dataobject / arrayResponse payload (present on success)

Paginated responses

List endpoints return paginated results:
{
  "success": true,
  "data": [
    { "id": 1, ... },
    { "id": 2, ... }
  ],
  "meta": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 15,
    "total": 72
  },
  "links": {
    "first": "https://yourdomain.com/v1/invoices?page=1",
    "last": "https://yourdomain.com/v1/invoices?page=5",
    "next": "https://yourdomain.com/v1/invoices?page=2",
    "prev": null
  }
}
Use the page query parameter to navigate pages:
GET /v1/invoices?page=2

Error responses

Validation error (422):
{
  "success": false,
  "message": "The given data was invalid.",
  "errors": {
    "email": ["The email field is required."],
    "password": ["The password must be at least 8 characters."]
  }
}
Authentication error (401):
{
  "success": false,
  "message": "Unauthenticated."
}
Not found (404):
{
  "success": false,
  "message": "Resource not found."
}
Rate limited (429):
{
  "success": false,
  "message": "Too Many Attempts."
}
Server error (500):
{
  "success": false,
  "message": "An unexpected error occurred."
}

HTTP status codes

CodeMeaning
200Success
201Created
204No content (delete operations)
401Unauthenticated
403Forbidden (insufficient permissions)
404Not found
422Validation error
429Rate limit exceeded
500Server error