Authentication
API keys, scoping, and the Bearer token header.
API keys
Create and manage API keys from your API Keys page in the dashboard. Keys are prefixed with sk_live_ and are tied to your organization.
Header format
Include your API key in every request using the Authorization header:
Authorization: Bearer sk_live_YOUR_API_KEYExample request
curl -X POST "https://api.redpine.ai/api/v1/search/query" \
-H "Authorization: Bearer sk_live_abc123def456" \
-H "Content-Type: application/json" \
-d '{"collection": "my-collection", "query": "search text"}'Key scoping
API keys can be scoped to control access:
- Organization-wide -- access all collections in your organization.
- Collection-specific -- restrict access to one or more named collections. Requests to other collections return
403.
Authentication errors
If the API key is missing or invalid, the API returns 401 Unauthorized:
{
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "Invalid or missing API key",
"request_id": "req_a1b2c3d4"
}
}If the key is valid but lacks access to the requested collection, the API returns 403 Forbidden.
Security best practices
- Never expose API keys in client-side code or public repositories.
- Use collection-scoped keys when possible to limit blast radius.
- Rotate keys periodically and revoke unused keys.
- Store keys in environment variables or a secrets manager.
Was this page helpful?