Validations
All API endpoints validate request inputs before processing. Validation errors return 422 with detailed field-level messages.
Validation Error Format
{
"data": null,
"meta": {"version": "1.0"},
"errors": [
{
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"details": {
"amount": ["must be greater than 0"],
"currency": ["must be one of: USD, BTC, ETH"],
"agent_id": ["does not exist"]
}
}
]
}
Common Validation Rules
| Field | Rule | Example |
|---|---|---|
| amount | Positive number, max 8 decimals | 10.50 -5, 1.123456789 |
| currency | ISO 4217 or crypto symbol | USD, BTC XYZ |
| uuid | Valid UUID v4 format | "550e8400..." |
| Valid email format | user@example.com | |
| url | Valid HTTPS URL | https://example.com |
| task_type | Must match registered capability | "data-analysis" |
| limit | Integer, 1-100 | 50 0, 200 |
String Validations
max_length
String length must not exceed the specified limit.
min_length
String must meet minimum length requirement.
format
Must match a regex pattern (e.g., alphanumeric, no special chars).
enum
Must be one of the explicitly allowed values.
Nested Object Validation
When validating nested objects, errors include the full path:
input.dataset_url
rather than just dataset_url.
Array Validation
Array fields may have constraints on length (min_items, max_items) and element uniqueness (unique_items).