Authentication
Create API tokens, send them with each request, keep them out of client code, and revoke them.
Every request needs an API token in the Authorization header. A token belongs to the user account that created it: its requests count against that account, and it only sees files that this account uploaded.
Authorization: Bearer pp-...Create a token
Sign in to PeakPrivacy and open API Tokens.
Click Generate Token. Optionally name the token, for example after the application and environment. Only you see the name.
Copy the token from the API Token Created dialog. Tokens start with pp- and are shown only once.
If the page says that API token creation is not enabled for your account, ask PeakPrivacy to enable it. It is switched on per user account, not in your organisation's settings.
Send the token
curl https://api.peakprivacy.ch/v1/ai/models \
-H "Authorization: Bearer $PEAKPRIVACY_API_KEY" \
-H "Accept: application/json"If a proxy strips or rewrites Authorization, send the token in an api-token header instead. Both headers work on every endpoint, including the Files API. If a request carries both, the API uses api-token.
curl https://api.peakprivacy.ch/v1/ai/models \
-H "api-token: $PEAKPRIVACY_API_KEY" \
-H "Accept: application/json"Keep tokens safe
A token gives full API access for its account, including the files uploaded with it.
- Call the API from your backend. Don't put tokens in browser code or in apps you distribute.
- Keep tokens out of source control, URLs and logs.
- Tokens don't expire. Use one token per application and environment, so you can revoke one without breaking the others. The Last used column shows which tokens are still in use.
- To rotate a token, generate a new one, deploy it, check that requests succeed, then revoke the old one.
Revoke a token
Open API Tokens and find the token by its name or masked value.
Click Revoke Token, enter your account password and click Revoke Token in the dialog.
If your account has no password, for example because you signed up with Google, GitHub or LinkedIn, the dialog shows a notice instead of the password field and you can't revoke. Click Profile in the notice, set a password, then revoke the token.
Irreversible: revoking takes effect immediately and can't be undone. Every application that uses the token gets 401 from its next request. The list keeps the token, marked Revoked.
Errors
A missing, unknown or revoked token returns 401:
{ "error": "Unauthenticated" }Check the header name, the Bearer prefix and whether the token was revoked. Retrying with the same token won't help.
See also
API quickstart
Call PeakPrivacy models from your code through the OpenAI-compatible API: base URL, first request, differences from OpenAI and rate limits.
Choosing a model
Pick a model by security level, capability and speed, choose it at runtime from GET /v1/ai/models and start from recommendations per task.