Global Request Parameters
Global Request Parameters
To ensure consistent behavior across the Supervised AI Testing API, certain parameters and headers are applied globally. These parameters control authentication, data formatting, and pagination across all available endpoints.
Standard Headers
All requests to the API must include the following headers to ensure proper authentication and response handling.
| Header | Type | Description | Required |
| :--- | :--- | :--- | :--- |
| Authorization | string | Your API key prefixed with Bearer. Example: Bearer YOUR_API_KEY. | Yes |
| Content-Type | string | Must be set to application/json for all POST, PUT, and PATCH requests. | Yes |
| X-API-Version | string | Specifies the version of the API to use (e.g., 2023-10-01). | No |
| X-Request-ID | string | A unique string to identify the request, useful for debugging and tracing. | No |
Example Header Configuration:
curl -X GET "https://api.supervised.ai/v1/tests" \
-H "Authorization: Bearer <your_access_token>" \
-H "Content-Type: application/json" \
-H "X-Request-ID: req_882910"
Global Query Parameters
These parameters can be appended to any GET request to modify the returned data set, particularly when dealing with collections of resources.
| Parameter | Type | Description | Default |
| :--- | :--- | :--- | :--- |
| limit | integer | The maximum number of records to return. Range: 1-100. | 20 |
| offset | integer | The number of records to skip before starting to return results. | 0 |
| sort | string | The field name to sort by. Prefix with - for descending order (e.g., -created_at). | created_at |
| include | string | A comma-separated list of related resources to expand in the response. | null |
Example Pagination Request:
GET /v1/test-suites?limit=10&offset=20&sort=-updated_at
Standard Body Parameters
For write operations (POST, PUT, PATCH), the API expects a JSON-formatted body. While specific endpoints have unique fields, the following structure is commonly supported for metadata and tagging.
| Field | Type | Description |
| :--- | :--- | :--- |
| metadata | object | A set of key-value pairs used to store additional information about the object. |
| tags | array | A list of strings used to categorize or filter resources. |
Example Request Body:
{
"name": "Production Validation Test",
"metadata": {
"environment": "production",
"priority": "high"
},
"tags": ["regression", "v2-release"]
}
Error Responses
If a global parameter is missing or malformed (e.g., an invalid Authorization header), the API will return a standard error object:
{
"error": {
"code": "unauthorized",
"message": "The provided API key is invalid or expired.",
"request_id": "req_882910"
}
}