Error Response Format
All errors follow a consistent structure:Error Codes
UNAUTHORIZED (401)
UNAUTHORIZED (401)
INVALID_API_KEY (401)
INVALID_API_KEY (401)
The provided API key is invalid or expired.Solution: Generate a new API key from your account settings.
CREDITS_EXHAUSTED (402/400)
CREDITS_EXHAUSTED (402/400)
Insufficient credits for the operation.Solution: Purchase credits from your Precital account or wait for credits to be added.
VALIDATION_ERROR (400)
VALIDATION_ERROR (400)
Request validation failed (missing required fields, invalid format, etc.).Solution: Check the error details for specific field validation issues.
NOT_FOUND (404)
NOT_FOUND (404)
The requested resource was not found.Solution: Verify the resource ID and ensure it belongs to your workspace.
PROVIDER_ERROR (500)
PROVIDER_ERROR (500)
An error occurred with an upstream AI provider.Solution: Retry the request. If the issue persists, contact support.
RATE_LIMITED (429)
RATE_LIMITED (429)
Rate limit exceeded.Solution: Wait for the time specified in the
Retry-After header before retrying.Example Error Response
HTTP Status Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request (validation error or insufficient credits) |
| 401 | Unauthorized (missing or invalid API key) |
| 402 | Payment Required (insufficient credits) |
| 404 | Not Found |
| 429 | Too Many Requests (rate limit exceeded) |
| 500 | Internal Server Error (provider error) |

