Sample Payloads & Mock Data
Sample Payloads & Mock Data
This section provides a library of JSON examples to help you integrate with the Testing API. These payloads represent the standard structures for interacting with the Supervised AI platform's testing environment.
1. Authentication
All requests to the API must include a Bearer token in the header.
Header Example:
{
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
2. Inference Requests
Use these payloads to simulate model predictions or evaluations.
Standard Text Inference
{
"model_id": "sup-ai-v1-text",
"input": {
"text": "The quick brown fox jumps over the lazy dog.",
"context": "General classification task"
},
"parameters": {
"temperature": 0.7,
"max_tokens": 150,
"top_p": 0.9
}
}
Image Classification Inference
{
"model_id": "sup-ai-vision-04",
"input": {
"image_url": "https://assets.supervised.ai/samples/img_01.jpg",
"detection_threshold": 0.85
}
}
3. Dataset Management
Examples for creating or updating datasets for supervised testing.
Create Dataset
{
"dataset_name": "Customer_Support_Feedback_Q3",
"type": "text-classification",
"labels": ["Positive", "Neutral", "Negative"],
"visibility": "private"
}
4. Success Responses
Expected response structures from the API upon successful execution.
Successful Prediction (200 OK)
{
"request_id": "req_88234af91",
"status": "success",
"data": {
"label": "Positive",
"confidence_score": 0.982,
"latency_ms": 142
},
"metadata": {
"version": "1.4.2",
"timestamp": "2023-10-27T10:00:00Z"
}
}
Resource Created (201 Created)
{
"id": "ds_550e8400-e29b",
"message": "Dataset successfully initialized.",
"created_at": "2023-10-27T10:05:12Z"
}
5. Error & Failure Scenarios
The API uses standard HTTP status codes and a consistent error object structure.
Validation Error (400 Bad Request)
Returned when mandatory fields are missing or data formats are incorrect.
{
"error": {
"code": "VALIDATION_FAILED",
"message": "The field 'model_id' is required.",
"details": [
{
"field": "model_id",
"issue": "must not be null"
}
]
}
}
Authentication Error (401 Unauthorized)
Returned when the API key is missing or invalid.
{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired API token provided."
}
}
Rate Limit Exceeded (429 Too Many Requests)
Returned when the usage quota has been exceeded.
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Request limit reached. Retry in 30 seconds.",
"retry_after_seconds": 30
}
}
Internal Server Error (500 Server Error)
Returned when an unexpected error occurs on the Supervised AI platform.
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred. Please contact support if the issue persists.",
"trace_id": "tr-99812-xyz"
}
}