Authorization header. Without a valid key, the API returns 401 Unauthorized and does not process the request.
Generate an API key
You manage your API keys from inside the Pharen Hub dashboard:- Sign in to pharen.app.
- Navigate to Settings → API Keys in the left sidebar.
- Click New API Key.
- Give your key a descriptive name (e.g.,
ci-pipelineordata-export-script). - Choose an access target and scopes.
- Copy the key immediately — it is only shown once in full at creation time.
Use your API key
Pass your API key as a Bearer token in theAuthorization header of every HTTP request:
X-API-Key:
In the examples above, the API key is read from an environment variable (
PHAREN_API_KEY). This is the recommended approach — it keeps secrets out of your codebase and makes rotating keys straightforward.Authentication Errors
If your request cannot be authenticated, the API responds with one of the following errors:
An error response looks like this:
Revoking a Key
If a key is compromised or no longer needed, revoke it immediately from Settings → API Keys in the dashboard. Revoked keys stop working instantly. You can generate a replacement key at any time without disrupting other keys.Rotating keys periodically is a good security practice, even if you have no reason to suspect a compromise. Consider setting a reminder to rotate production keys every 90 days.