X-Api-Key HTTP request header — all endpoints require this header to be present and valid before they will return data. Requests made without a key, or with an invalid key, will be rejected with a 401 Unauthorized response.
Getting your API key
API keys are provisioned on a per-customer basis inside of the account by your Honestly admin.Keep your API key secure. Do not share it with unauthorised parties, and never commit it to version control or include it in client-side code.
Using your API key
Once you have your key, include it as a header on every API request:curl:
YOUR_SECRET_API_KEY with the actual key you received. The same header must be included on every call, regardless of the endpoint you are targeting.
Security best practices
Follow these practices to keep your integration secure:- Use environment variables — Store your API key in an environment variable or a secrets manager rather than hardcoding it in your source code.
- Never commit keys to version control — Ensure
.envfiles and configuration files containing keys are listed in your.gitignore. - Rotate keys periodically — Request a fresh key from your Customer Success manager on a regular schedule to limit the impact of undetected exposure.
- Restrict access — Only grant API key access to the systems and team members that genuinely require it. Avoid sharing a single key across multiple unrelated projects.