Response Format

Content Type

All API responses are returned as JSON with Content-Type: application/json.

Success Responses

Successful responses return the requested data directly:

{
  "id": 1,
  "name": "Summer in Paris",
  "status": "planning"
}

For list endpoints, an array is returned:

[
  { "id": 1, "name": "Trip A" },
  { "id": 2, "name": "Trip B" }
]

Error Responses

Error responses follow a consistent format:

{
  "error": "Error message describing what went wrong"
}

Some endpoints may include additional details:

{
  "error": "Validation failed",
  "details": {
    "name": "Name is required",
    "startDate": "Invalid date format"
  }
}

HTTP Status Codes

CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
204No Content - Success with no response body
400Bad Request - Invalid parameters or request body
401Unauthorized - Invalid or missing API key
403Forbidden - Insufficient permissions for this action
404Not Found - Resource doesn't exist
409Conflict - Resource conflict (e.g., revision mismatch)
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Something went wrong on our end

Pagination

List endpoints that return many items support pagination:

GET /api/trips?page=1&limit=20

Paginated responses include metadata:

{
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 45,
    "totalPages": 3
  }
}

Timestamps

All timestamps are returned in ISO 8601 format with UTC timezone:

2024-01-15T10:30:00Z