Authentication
Authenticate your requests to the Sentrial API.
API Keys
Sentrial uses API keys to authenticate requests. Your API keys carry many privileges, so be sure to keep them secure and never expose them in client-side code.
Security Best Practices
- Store API keys in environment variables
- Never commit API keys to version control
- Rotate keys regularly
- Use different keys for development and production
Getting Your API Key
- 1Sign in to your Sentrial dashboard
- 2Navigate to Settings → API Keys
- 3Click "Generate New Key"
- 4Copy and securely store your API key (it will only be shown once)
Authentication Methods
HTTP Header (Recommended)
Include your API key in the Authorization header:
Authorization: Bearer your-api-key-hereExample with cURL:
curl https://api.realm.ai/v1/sessions \
-H "Authorization: Bearer your-api-key-here" \
-H "Content-Type: application/json"SDK Authentication
When using the SDK, pass your API key to the client:
Python
from sentrial import SentrialClient
client = SentrialClient(
api_key="your-api-key-here",
project_id="your-project-id"
)TypeScript
import { SentrialClient } from '@sentrial/sdk';
const client = new SentrialClient({
apiKey: 'your-api-key-here',
projectId: 'your-project-id'
});Environment Variables
Store credentials in environment variables to keep them secure:
# .env
SENTRIAL_API_KEY=your-api-key-here
SENTRIAL_PROJECT_ID=your-project-idPython
from sentrial import SentrialClient
# Automatically uses SENTRIAL_API_KEY and SENTRIAL_PROJECT_ID
client = SentrialClient()TypeScript
import { SentrialClient } from '@sentrial/sdk';
// Automatically uses process.env.SENTRIAL_API_KEY
const client = new SentrialClient();Error Responses
401 Unauthorized
Your API key is missing or invalid.
{
"error": {
"code": "unauthorized",
"message": "Invalid API key"
}
}403 Forbidden
Your API key doesn't have permission for this resource.
{
"error": {
"code": "forbidden",
"message": "API key does not have access to this project"
}
}429 Rate Limit Exceeded
You've exceeded the rate limit for your plan.
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Retry after 60 seconds.",
"retry_after": 60
}
}Rate Limits
| Plan | Rate Limit | Burst |
|---|---|---|
| Free | 100 requests/min | 200 |
| Pro | 1,000 requests/min | 2,000 |
| Enterprise | Custom | Custom |
Rate limits are enforced per API key. Contact us for higher limits.
