Authentication
Generate API keys, understand scopes, and rate limits.
Authentication
Claro's REST API uses API key authentication for programmatic access. API keys provide secure, scoped access to your tenant's data without sharing user credentials.
Generating an API Key
Navigate to API Settings
Log in as a Tenant Admin and go to Settings > API Keys.
Create a Key
Click Create API Key and configure:
| Field | Description |
|---|---|
| Name | A descriptive label (for example, "SIEM Integration" or "Reporting Dashboard") |
| Scopes | read (GET endpoints only) or write (GET, POST, PUT, DELETE) |
| IP Allowlist | Optional. Restrict the key to specific IP addresses for additional security. |
| Expiry | Optional. Set an expiration date after which the key is automatically disabled. |
Store the Key Securely
After creation, the full API key is displayed once. Copy it and store it securely (for example, in a secrets manager or vault).
The API key is only shown once at creation time. If you lose it, you must generate a new key. Claro does not store the plaintext key.
Key Format
API keys use the following format:
claro_<48 hexadecimal characters>Example:
claro_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6The claro_ prefix makes it easy to identify Claro API keys in your configuration and to detect accidental exposure in logs or code repositories.
Using the API Key
Include the API key in the Authorization header of every request:
curl -X GET https://your-instance.com/api/campaigns \
-H "Authorization: Bearer claro_a1b2c3d4e5f6..." \
-H "Content-Type: application/json"All API requests must use HTTPS. Requests over plain HTTP are rejected.
Scopes
API keys have one of two scope levels:
| Scope | Allowed Methods | Use Case |
|---|---|---|
| read | GET | Dashboards, reporting integrations, monitoring |
| write | GET, POST, PUT, DELETE | Automation, user provisioning, campaign management |
Use the read scope whenever possible. Only use write scope for integrations that need to create or modify data.
Rate Limits
Claro enforces rate limits to protect the platform and ensure fair usage:
| Limit | Value |
|---|---|
| Per API key | 1,000 requests per hour |
| Per tenant | 5,000 requests per hour (across all keys) |
| Per IP address | 100 requests per minute |
Rate Limit Headers
Every API response includes rate limit headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 987
X-RateLimit-Reset: 1710900000| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in the current window |
X-RateLimit-Remaining | Requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp when the rate limit resets |
Handling Rate Limits
When you exceed the rate limit, the API returns a 429 Too Many Requests response with a Retry-After header indicating how many seconds to wait:
HTTP/1.1 429 Too Many Requests
Retry-After: 45Implement exponential backoff in your integration to handle rate limits gracefully.
IP Allowlisting
For additional security, restrict API key usage to specific IP addresses:
- Navigate to Settings > API Keys
- Click on the key you want to restrict
- Add one or more IP addresses or CIDR ranges to the allowlist
Requests from IP addresses not on the allowlist will receive a 403 Forbidden response.
Error Responses
The API returns standard HTTP status codes for authentication errors:
| Status Code | Meaning | What to Do |
|---|---|---|
| 401 Unauthorized | Missing, invalid, or expired API key | Check the key is correct and has not expired |
| 403 Forbidden | Insufficient scope or IP not in allowlist | Use a key with the required scope; check IP allowlist |
| 429 Too Many Requests | Rate limit exceeded | Wait for the duration specified in the Retry-After header |
Error Response Format
All error responses follow a consistent JSON format:
{
"statusCode": 401,
"message": "Invalid API key",
"error": "Unauthorized"
}Example Requests
List Campaigns
curl -X GET https://your-instance.com/api/campaigns \
-H "Authorization: Bearer claro_a1b2c3d4e5f6..." \
-H "Content-Type: application/json"Get Campaign Results
curl -X GET https://your-instance.com/api/campaigns/CAMPAIGN_ID/results \
-H "Authorization: Bearer claro_a1b2c3d4e5f6..." \
-H "Content-Type: application/json"List Users
curl -X GET "https://your-instance.com/api/users?page=1&limit=50" \
-H "Authorization: Bearer claro_a1b2c3d4e5f6..." \
-H "Content-Type: application/json"Create a User (requires write scope)
curl -X POST https://your-instance.com/api/users \
-H "Authorization: Bearer claro_a1b2c3d4e5f6..." \
-H "Content-Type: application/json" \
-d '{
"email": "john.doe@company.com",
"first_name": "John",
"last_name": "Doe",
"department": "Engineering"
}'Key Management Best Practices
- Use separate keys for each integration. If one key is compromised, you can revoke it without affecting other integrations.
- Use the minimum scope needed. Read-only integrations should use
readscope. - Set expiration dates for keys used by external vendors or temporary integrations.
- Enable IP allowlisting for production integrations with static IP addresses.
- Rotate keys periodically. Generate a new key, update your integration, then revoke the old key.
- Never embed keys in client-side code. API keys should only be used in server-side applications.
- Monitor usage. Review API key activity in the audit log to detect unusual patterns.