ClaroDocs
API Reference

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

Log in as a Tenant Admin and go to Settings > API Keys.

Create a Key

Click Create API Key and configure:

FieldDescription
NameA descriptive label (for example, "SIEM Integration" or "Reporting Dashboard")
Scopesread (GET endpoints only) or write (GET, POST, PUT, DELETE)
IP AllowlistOptional. Restrict the key to specific IP addresses for additional security.
ExpiryOptional. 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_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6

The 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:

ScopeAllowed MethodsUse Case
readGETDashboards, reporting integrations, monitoring
writeGET, POST, PUT, DELETEAutomation, 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:

LimitValue
Per API key1,000 requests per hour
Per tenant5,000 requests per hour (across all keys)
Per IP address100 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
HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the current window
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix 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: 45

Implement exponential backoff in your integration to handle rate limits gracefully.

IP Allowlisting

For additional security, restrict API key usage to specific IP addresses:

  1. Navigate to Settings > API Keys
  2. Click on the key you want to restrict
  3. 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 CodeMeaningWhat to Do
401 UnauthorizedMissing, invalid, or expired API keyCheck the key is correct and has not expired
403 ForbiddenInsufficient scope or IP not in allowlistUse a key with the required scope; check IP allowlist
429 Too Many RequestsRate limit exceededWait 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 read scope.
  • 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.