Authentication
Authenticate API requests with an organization API key sent as a Bearer token.
The Prets API authenticates every request with an API key. Send it in the Authorization header as a Bearer token:
curl https://api.prets.app/v1/quotes \
-H "Authorization: Bearer ak_..."API keys
An API key belongs to your organization, not to a person. Requests made with it act on that organization's quotes, cases, and event destinations. Keys start with ak_.
To create a key, open the partner portal and go to API keys. You need the org:sys_api_keys:manage permission; ask an organization admin if you don't see the button.
- Name each key after the system that uses it, for example "Production backend".
- The secret is shown only once, when you create the key. Copy it straight into your secret store.
- Keep keys on your server. Never put them in a browser, a mobile app, or a public repository.
Revoking a key
Revoke a key from the same API keys page. Requests with a revoked key fail with 401.
Prets caches a verified key for up to one hour. After you revoke a key, requests that use it can keep working for up to an hour. If a key leaks, revoke it right away and replace it in your systems.
To rotate a key without downtime, create the new key, deploy it, then revoke the old one.
Permissions
A request with a valid key can still be refused for a specific action. For example, POST /v1/quotes needs the org:quotes:create permission. A key without the permission gets 403.
Failed authentication
A missing, malformed, unknown, or revoked key returns 401:
{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "Unauthorized",
"requestId": "..."
}
}Other credentials
Prets' own apps, such as the partner portal, call the same API with short-lived user session tokens in the same Authorization: Bearer header. Those tokens are for Prets' apps. Integrations should use an API key.
Events
Events that Prets sends to you carry their own credential: Authorization: Bearer {bearerSecret}, where the bearer secret belongs to your event destination. It is not an API key. See Create an event destination.