Authentication
How to authenticate your API requests with Statsnet.
View as MarkdownStatsnet authenticates API requests with API keys. A key looks like sk_live_... and can be passed in either of two headers — both are equivalent:
Authentication headers
x-api-key: sk_live_YOUR_KEY
# or
Authorization: Bearer sk_live_YOUR_KEYGetting a key
Create keys in your account settings — up to 10 per account. The full key value is shown once at creation; store it securely. You can rename and revoke keys at any time, and see per-key usage for the current month.
If you don’t have a Statsnet account yet, sign up — it takes a few minutes.
What a key can access
A key inherits the subscription of the account that created it:
- No active plan — the key works, but only on public endpoints (company card
meta/beta, search, markdown card). - Report plans (Basic, Premium, Enterprise) — paid endpoints consume one report per company; repeat views of the same company within 2 weeks are free.
- API plans — every API call is metered against a monthly allowance with a burst limit. Current usage is returned on every response in the
X-API-Calls-UsedandX-API-Calls-Limitheaders; exceeding the allowance returns429.
Code Examples
API request example
import requests
url = 'https://statsnet.co/api/v1/companies/search'
headers = {
'Authorization': 'Bearer sk_live_YOUR_KEY',
'Content-Type': 'application/json'
}
body = {'query': 'kaspi', 'filters': {'jurisdiction': ['kz']}}
response = requests.post(url, json=body, headers=headers).json()
print(response)Error Handling
An invalid, revoked or missing key on a protected endpoint returns a JSON error with the matching HTTP status:
Error response
{
"status": 403,
"message": "access denied"
}| Status | Meaning |
|---|---|
401 | Session or credentials expired. |
402 | The key’s account has no active subscription (canceled or expired). |
403 | No access — anonymous caller on a protected endpoint, or the plan tier is too low. |
429 | Monthly API allowance exhausted or rate limit hit. Check X-API-Calls-Used / X-API-Calls-Limit. |