Authentication
Learn how to authenticate requests to the Quant Risk API using your API key.
Overview
The Quant Risk API uses API key authentication to identify and authorize client requests. Every request to protected API endpoints must include a valid API key.
API Key Authentication
API keys are used to authenticate requests to the Quant Risk API. Your API key is issued when your API access is activated.
API Key Format
qr_live_xxxxxxxxxxxxxxxxxxxxThe qr_live_ prefix identifies a live API key.
Sending Your API Key
Include your API key in the X-API-Key HTTP header when making requests to authenticated endpoints.
HTTP Header
X-API-Key: qr_live_xxxxxxxxxxxxxxxxxxxxExample Request
The following example sends an authenticated request to the Quant Risk API.
cURL
curl -X POST "https://quant-risk.scratio.com/api/v1/risk/calculate" \
-H "Content-Type: application/json" \
-H "X-API-Key: qr_live_xxxxxx" \
-d '{
"dataset_id": "ds_xxxxxx",
"method": "monte_carlo_normal",
"portfolio_value": 10000,
"currency": "USD",
"portfolio": [
{
"symbol": "AAPL",
"weight": 0.6
},
{
"symbol": "BTC-USD",
"weight": 0.4
}
],
"portfolio_mode": "buy_and_hold",
"confidence_level": 0.95,
"time_horizon": 10,
"simulations": 10000
}'API Key Security
Your API key should be treated as a secret. Anyone with access to your API key may be able to make authenticated requests on your behalf.
Keep your API key private
Do not expose your API key in public repositories, client-side applications, screenshots, or other publicly accessible locations.
Recommended practices
- Store API keys in environment variables.
- Use a secret management system in production environments.
- Keep API keys on server-side infrastructure whenever possible.
- Do not commit API keys to source control.
API key visibility
For security reasons, your API key is displayed only once when it is issued. Copy and securely store your key before leaving the reveal page.