Error Response Format
All error responses follow a consistent structure:HTTP Status Codes
The API uses standard HTTP status codes to indicate success or failure:| Status Code | Meaning | Common Causes |
|---|---|---|
| 200 | OK | Request succeeded |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource doesn’t exist |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error |
| 503 | Service Unavailable | Temporary service disruption |
Common Error Codes
Authentication Errors
401 Unauthorized
Error Code:unauthorized
The API key is missing or invalid.
- Verify your API key is correct
- Check that you’re using the
Bearerprefix in the Authorization header - Ensure the key hasn’t been deleted from your account
- Get a new API key from claro.baytos.ai
403 Forbidden
Error Code:forbidden
Your API key is valid but lacks permission to access the resource.
- Verify you’re a member of the workspace
- Check that the prompt exists and is accessible to you
- Ensure your workspace subscription is active
Resource Errors
404 Not Found
Error Code:not_found
The requested resource doesn’t exist.
- Verify the package name is spelled correctly
- Check that the version exists (e.g.,
:v1,:v2) - Ensure you have access to the workspace
Validation Errors
400 Bad Request
Error Code:validation_error
The request contains invalid parameters.
- Check the request parameters match the expected format
- Review the API documentation for the endpoint
- Ensure all required fields are provided
Rate Limiting Errors
429 Too Many Requests
Error Code:rate_limit_exceeded
You’ve exceeded the rate limit.
- Wait for the duration specified in
retry_after - Implement exponential backoff retry logic
- Reduce request frequency
- Contact support for higher rate limits
Server Errors
500 Internal Server Error
Error Code:internal_error
An unexpected error occurred on the server.
- Retry the request after a short delay
- Check status.baytos.ai for service status
- Contact support if the issue persists
503 Service Unavailable
Error Code:service_unavailable
The service is temporarily unavailable.
- Wait a few moments and retry
- Implement exponential backoff
- Check service status page
Error Handling Examples
Python SDK
The SDK provides specific exception types for different errors:Python with requests
JavaScript with fetch
Troubleshooting Guide
Invalid API key errors
Invalid API key errors
Symptoms: 401 Unauthorized responsesChecklist:
- API key is correctly copied (no extra spaces)
- Environment variable is set correctly
- Using
Bearerprefix in Authorization header - API key hasn’t been deleted
- Testing with the correct API endpoint
Prompt not found errors
Prompt not found errors
Symptoms: 404 Not Found responsesChecklist:
- Package name format is correct:
@namespace/prompt-name:version - The prompt exists in your workspace
- You have access to the workspace
- The version number is correct (e.g.,
:v1not:1)
Intermittent failures
Intermittent failures
Symptoms: Requests sometimes fail with 500 or timeout errorsChecklist:
- Implement retry logic with exponential backoff
- Add timeout to requests (30s recommended)
- Check network connectivity
- Monitor API status page
Rate limit errors
Rate limit errors
Symptoms: 429 Too Many Requests responsesChecklist:
- Implement exponential backoff
- Respect
Retry-Afterheader - Cache responses when possible
- Batch requests efficiently