Skip to contents

Authentication

How to authenticate your API requests with Statsnet.

View as Markdown

Statsnet 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

Getting 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-Used and X-API-Calls-Limit headers; exceeding the allowance returns 429.

Code Examples

API request example

Error Handling

An invalid, revoked or missing key on a protected endpoint returns a JSON error with the matching HTTP status:

Error response
StatusMeaning
401Session or credentials expired.
402The key’s account has no active subscription (canceled or expired).
403No access — anonymous caller on a protected endpoint, or the plan tier is too low.
429Monthly API allowance exhausted or rate limit hit. Check X-API-Calls-Used / X-API-Calls-Limit.