Skip to main content
The Claro API uses API keys to authenticate requests. All API requests must include a valid API key in the Authorization header using Bearer authentication.

Getting Your API Key

1

Log into Claro

Navigate to claro.baytos.ai and sign in to your account
2

Access API Keys

Click API Keys from the sidebar navigation
3

Create New Key

Click Create API Key and give it a descriptive name (e.g., “Production Server”, “Development”)
4

Copy and Save

Copy the API key immediately and store it securely
You won’t be able to see the API key again after closing the dialog. If you lose it, you’ll need to create a new one.

API Key Format

API keys follow this format:
  • Prefix: sk_live_ for production keys, sk_test_ for test keys
  • Length: 50 characters total
  • Encoding: Base62 (alphanumeric)
Test keys (with sk_test_ prefix) are not yet available but will be coming soon for sandbox environments.

Making Authenticated Requests

Include your API key in the Authorization header using the Bearer scheme:

cURL Example

Python Example

Using the SDK (recommended):
Using requests library:

JavaScript Example

Using fetch:
Using axios:

Environment Variables

Store your API key in environment variables rather than hardcoding it:

Bash/Zsh

Add to ~/.bashrc or ~/.zshrc to persist across sessions.

Python (.env file)

Load with python-dotenv:

Node.js (.env file)

Load with dotenv:

Security Best Practices

Add your API keys to .gitignore:
Use environment variables or secret management services instead.
Create separate API keys for:
  • Development/testing
  • Staging
  • Production
This allows you to rotate keys without affecting all environments.
Create a new API key, update your application, then delete the old key.We recommend rotating production keys at least every 90 days.
Regularly audit your API keys in the Claro dashboard and delete any that are no longer needed.
Never expose API keys in client-side code (JavaScript in browsers, mobile apps, etc.).Always make API calls from your backend server.

Authentication Errors

401 Unauthorized

Your API key is missing or invalid:
Solutions:
  • Verify the API key is correct
  • Check that you’re using the Bearer prefix
  • Ensure the key hasn’t been deleted from your Claro account

403 Forbidden

Your API key is valid but doesn’t have permission to access the resource:
Solutions:
  • Verify you have access to the workspace
  • Check that the prompt exists and you have permission to view it
  • Ensure your workspace subscription is active

Testing Authentication

Test your API key with the health endpoint:
Expected response:

Next Steps

Rate Limits

Learn about API rate limits and how to handle them

Error Handling

Understand error responses and how to handle them

Quick Start

Get started making your first API call

Python SDK

Use the Python SDK for easier authentication