ByteStack authenticates every API request using API keys. You include your key in theDocumentation Index
Fetch the complete documentation index at: https://docs.bytestack.com/llms.txt
Use this file to discover all available pages before exploring further.
Authorization header of each request, and ByteStack validates it before executing the query. This page explains how to create keys, which scopes are available, how to include keys in requests across different languages, and how to respond to authentication errors.
Creating an API key
To generate a new API key:- Open Settings → API Keys in the ByteStack dashboard.
- Click New Key.
- Enter a descriptive name for the key (for example,
production,development, orci-pipeline). - Select the scopes the key should have (see Key scopes below).
- Click Create and copy the key.
Never commit API keys to source control. Use environment variables, a secrets manager, or a CI/CD secrets store to inject keys at runtime.
Including keys in requests
Pass your API key as a Bearer token in theAuthorization header of every request.
Key scopes
Each API key is issued with one or more scopes that control what it can do. Assign only the scopes a key actually needs.| Scope | What it allows |
|---|---|
read | Fetch query results, retrieve job status, and list sources |
write | Submit new queries, create and manage scheduled jobs |
admin | Manage API keys, update billing settings, and configure integrations |
Rotating keys
If a key is compromised or you want to cycle credentials as part of a security policy, rotate it from Settings → API Keys:- Generate a new key with the same scopes as the key you are replacing.
- Update your application or secrets manager with the new key.
- Verify that requests succeed with the new key.
- Revoke the old key by clicking Revoke next to it in the key list.
401 Unauthorized response.
Authentication errors
| HTTP status | Meaning | Common cause |
|---|---|---|
401 Unauthorized | The key is missing, malformed, or has been revoked | Missing Authorization header, typo in the key, or key revoked |
403 Forbidden | The key is valid but lacks the required scope | Using a read-scoped key to submit a new query |
401, check that the Authorization header is formatted as Bearer YOUR_API_KEY (note the space after Bearer) and that the key has not been revoked. When you receive a 403, review the scopes assigned to the key and generate a new key with the correct scope if needed.
A
402 Payment Required response means your account has an unpaid balance. ByteStack provides a 7-day grace period for failed charges. Resolve billing in Settings → Plans & Billing to restore full API access.