API Response Format

Standard Response Format

All API responses follow a consistent format to ensure predictable data handling. The response structure varies based on whether the request was successful or resulted in an error.

Success Response

{
  "success": true,
  "data": {
    // Response data specific to the endpoint
  },
  "timestamp": "2025-07-22T06:36:38Z"
}

Error Response

{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message",
    "details": {
      // Additional error context (if available)
    }
  },
  "timestamp": "2025-07-22T06:36:38Z"
}

HTTP Status Codes

The API uses standard HTTP status codes to indicate the result of requests:

  • 200 OK

    The request was successful

  • 201 Created

    A new resource was successfully created

  • 400 Bad Request

    The request was malformed or contained invalid parameters

  • 401 Unauthorized

    Authentication is required or the provided credentials are invalid

  • 403 Forbidden

    The authenticated user lacks necessary permissions

  • 404 Not Found

    The requested resource does not exist

  • 500 Internal Server Error

    An unexpected server error occurred

Response Headers

Important information is also conveyed through response headers:

  • X-Request-ID

    Unique identifier for the request, useful for debugging

  • X-Session-Expires

    ISO 8601 timestamp indicating when the current session will expire

  • X-Rate-Limit-Remaining

    Number of remaining requests allowed in the current time window