Skip to main content
The Claro API uses standard HTTP status codes and returns detailed error information in JSON format to help you diagnose and handle errors effectively.

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:

Common Error Codes

Authentication Errors

401 Unauthorized

Error Code: unauthorized The API key is missing or invalid.
Solutions:
  • Verify your API key is correct
  • Check that you’re using the Bearer prefix 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.
Solutions:
  • 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.
Solutions:
  • 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.
Solutions:
  • 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.
Solutions:
  • Wait for the duration specified in retry_after
  • Implement exponential backoff retry logic
  • Reduce request frequency
  • Contact support for higher rate limits
See Rate Limits for detailed guidance.

Server Errors

500 Internal Server Error

Error Code: internal_error An unexpected error occurred on the server.
Solutions:
  • 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.
Solutions:
  • 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

Symptoms: 401 Unauthorized responsesChecklist:
  • API key is correctly copied (no extra spaces)
  • Environment variable is set correctly
  • Using Bearer prefix in Authorization header
  • API key hasn’t been deleted
  • Testing with the correct API endpoint
Solution: Create a new API key and update your configuration.
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., :v1 not :1)
Solution: Verify the package name in the Claro dashboard.
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
Solution: Implement robust retry logic and error handling.
Symptoms: 429 Too Many Requests responsesChecklist:
  • Implement exponential backoff
  • Respect Retry-After header
  • Cache responses when possible
  • Batch requests efficiently
Solution: See Rate Limits guide.

Error Logging Best Practices

Log errors with sufficient context for debugging:

Next Steps

Rate Limits

Learn about rate limiting and retry strategies

Authentication

Understand API authentication

Python SDK

SDK error handling patterns

Examples

See error handling code examples