First requests against the Statsnet API
Quick answer. Start with the public endpoints, which need no key: fetch a Markdown profile or resolve a national identifier to an internal ID. Then add the x-api-key header for search and paid calls. Handle 401, 402, 403, 404 and 429 as five distinct outcomes, not one generic failure.
Steps
-
Try a public call
Request a Markdown profile for a Kazakhstan identifier. No key, no quota, rate limited.
-
Create a key
Keys look like sk_live_... and inherit the owner’s subscription. An account can hold up to 10.
-
Search and pin
POST a query with a jurisdiction filter, then store the internal ID of the match.
-
Pull what the review needs
Paid profile, relations or contacts. Each first paid request per company is one report.
Reading the errors
Statsnet uses 401 when the key is missing or invalid and 402 when the subscription behind it has lapsed. Those two look alike to a user but need different people to fix them: an engineer for the first, billing for the second. A 403 means the plan does not include the endpoint. A 429 covers both quota and rate limiting, so a retry with backoff is reasonable but should not loop forever.
For larger projects, Statsnet publishes SDKs for Python (pip install statsnet-python-sdk), JavaScript and Go, plus an OpenAPI 3.1 spec at https://statsnet.co/api/v1/openapi.json for generating a typed client. The Swagger reference and the Statsnet API documentation list every parameter.
Example requests
curl "https://statsnet.co/api/v1/companies/kz/000740000728/md" curl "https://statsnet.co/api/v1/companies/get_id/kz/000740000728" curl -X POST "https://statsnet.co/api/v1/companies/search?limit=10" \
-H "x-api-key: sk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "Kazakhtelecom", "filters": {"jurisdiction": ["kz"]}}' import requests
r = requests.get(
f"https://statsnet.co/api/v1/companies/{company_id}/relations",
headers={"x-api-key": API_KEY},
)
if r.status_code == 200:
relations = r.json()
elif r.status_code == 401:
raise RuntimeError("key missing or invalid")
elif r.status_code == 402:
raise RuntimeError("subscription inactive")
elif r.status_code == 403:
raise RuntimeError("endpoint not on this plan")
elif r.status_code == 404:
relations = None # no such company: log it, do not guess
elif r.status_code == 429:
pass # quota or rate limit: back off and retry later