Authorization header of each request. Without a valid key, the API returns a 401 Unauthorized response and does not process your request.
Generating an API Key
You manage your API keys from inside the Pharen Hub dashboard:- Sign in to app.pharen.de.
- Navigate to Settings → API Keys in the left sidebar.
- Click Generate New Key.
- Give your key a descriptive name (e.g.,
ci-pipelineordata-export-script). - Copy the key immediately — it is only shown once in full at creation time.
Using Your API Key
Pass your API key as a Bearer token in theAuthorization header of every HTTP request:
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:| Status | Code | Cause |
|---|---|---|
401 Unauthorized | missing_token | No Authorization header was present in the request. |
401 Unauthorized | invalid_token | The token provided is malformed, expired, or does not exist. |
403 Forbidden | insufficient_permissions | The key is valid but lacks permission to access this resource or perform this action. |
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.