Getting an API key
Subscribe to API Access
API access is a separate subscription from your standard StratAlerts plan. Visit the API Access subscription page and complete checkout.
Generate a key
After subscribing, go to your account settings and generate a new API key. Give it a descriptive label so you can identify it later.
Passing your key
You can pass your API key in either of two request headers. Both are accepted on every REST endpoint and on the WebSocket handshake.- X-API-Key header
Code examples
Key scopes
When you generate a key, you choose which scopes to grant. A request to an endpoint whose scope is not on the key returns a403 missing_scope error. The table below lists all available scopes.
| Scope | Grants access to |
|---|---|
metadata:read | GET /instruments, GET /instruments/{symbol}, GET /market-status |
prices:read | GET /prices/latest, WebSocket quotes channel |
candles:read | GET /candles/{symbol} |
states:read | GET /states/{symbol}, GET /setups/current, WebSocket states channel |
alerts:read | GET /alerts/in-force, GET /alerts/simultaneous-breaks, WebSocket alerts.in_force and alerts.simultaneous_breaks channels |
ws:connect | Establish a WebSocket connection (required in addition to channel-specific scopes) |
Error responses
Authentication failures return a JSON error envelope. The HTTP status code andcode field tell you exactly what went wrong.
| HTTP status | Error code | Meaning |
|---|---|---|
401 | missing_api_key | No key was found in the request headers — either the header is absent or the value is empty |
403 | inactive_entitlement | Your API Access subscription has lapsed or been cancelled |
403 | missing_scope | The key is valid but does not have the scope required by this endpoint |
401 response looks like this:
403 scope error looks like this:
Security best practices
- Store your key in an environment variable or secrets manager, not in source code.
- Use a separate key per integration so you can revoke one without affecting others.
- Grant only the scopes each key requires — avoid creating full-access keys for read-only integrations.
- Rotate keys on a regular schedule or immediately if you suspect exposure.
WebSocket authentication
The WebSocket connection handshake also requires your API key. Pass it in the same headers (Authorization: Bearer or X-API-Key) during the initial HTTP upgrade request. Your key must include both ws:connect and the scope for every channel you plan to subscribe to.
If authentication fails during the WebSocket handshake, the connection is closed with one of these close codes before any messages are exchanged:
| Close code | Meaning |
|---|---|
4401 | No valid API key found in the handshake headers |
4403 | Active subscription not found, or key lacks ws:connect scope |