Skip to main content
Every request you make to the Pharen API must be authenticated. Send a scoped API key as a Bearer token in the 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:
  1. Sign in to pharen.app.
  2. Navigate to Settings → API Keys in the left sidebar.
  3. Click New API Key.
  4. Give your key a descriptive name (e.g., ci-pipeline or data-export-script).
  5. Choose an access target and scopes.
  6. Copy the key immediately — it is only shown once in full at creation time.
Treat your API key like a password. Anyone who holds it can make API calls on behalf of your workspace. Do not commit keys to source control, log them, or expose them in client-side code. Use environment variables or a secrets manager instead.
For a full walkthrough of key scopes, team targets, rotation, and storage, see API keys.

Use your API key

Pass your API key as a Bearer token in the Authorization header of every HTTP request:
The examples below call the calendar events endpoint. You can also use the interactive playground on each endpoint page.
If your HTTP client cannot set a Bearer token, send the same key through 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.

Key scopes and permissions

API keys combine explicit key scopes with the permissions of the workspace member who created them. If that member’s role is changed or their account is deactivated, all keys they created reflect the updated permissions or stop working. For production integrations, create keys under a dedicated service account with only the scopes your integration requires. See the API keys scope reference for the full list.