Skip to main content
Every Public API request needs an API key. This page shows how to send the key, create one, rotate it, and handle authentication errors.

Send your key

Put your API key in the X-API-Key header on every request.
If your HTTP client prefers it, you can send the key as an Authorization: Bearer header instead:

Key format

Create a key

Public API keys are self-service: you create them yourself, on any plan. What a key can call depends on your plan, which Huntd sets up for you.
1

Open Settings

In the Huntd Dashboard, go to Settings → API & webhooks.
2

Create the key

Any member of your organization can create a key. Creating a key does not affect any existing key.
3

Copy it right away

The key is shown once. Store it somewhere safe before you close the dialog.
We store only a SHA-256 hash of your key. If you lose the key, we cannot retrieve it. Create a new key and revoke the old one.

Rotate a key

An organization can hold several active keys at once. That means you can rotate a key with no downtime:
  1. Create the new key.
  2. Deploy the new key to your services.
  3. Revoke the old key once nothing uses it.
Revoking takes effect immediately. The revoked key returns 401 INVALID_API_KEY on its next request.

Authentication errors

All four causes return the same response body:
The identical body is deliberate. It stops anyone from using the endpoint to find out which key IDs exist. In your code, check error.code. Never check the message text.

Security best practices

Never hardcode a key in source code. Read it at runtime from an environment variable or a secrets manager.
If a key is pushed to a repository, even a private one, treat it as compromised. Revoke it immediately.
Anyone using your app can read a key placed in browser or mobile code. Make every Public API call from your backend.
Separate keys let you revoke one integration without breaking the others. They also make unexpected usage easier to trace.