Keys and access
Credential types, workspaces and scopes, and which credential to use for each part of your integration.
Every request to AbuseZero carries one credential, and every credential reaches only the workspaces it was granted. Choose the credential by where the code runs and what it needs to do.
Workspaces
Everything in AbuseZero belongs to a workspace: benefits, policies, evaluations, outcomes, allow and block lists, keys and billing. Workspace IDs start with ws_. See the workspace object.
Each workspace's data stays in that workspace. A credential can never be used to read or change another workspace, and no request parameter widens what a credential can reach.
Members, roles and permissions are managed in the dashboard under Workspace settings → Members & access.
Credential types
| Credential | Starts with | Runs in | Access |
|---|---|---|---|
| Secret key | sk_ | Your server | Every server scope in one workspace. |
| Restricted key | rk_ | Your server | Only the scopes you choose. You can change its scopes later. |
| Publishable key | pk_ | Your pages | Browser collection only. |
| OAuth access token | The AbuseZero CLI, MCP clients and OAuth apps | The scopes the user approved, in the workspaces they can access. | |
| Machine client | Scripts and CI | OAuth client credentials for one workspace. |
Keys are sent in the Authorization header:
Authorization: Bearer sk_…The full list of scopes and which endpoints need them is in REST API authentication.
Secret and restricted keys
Server keys are created in Developers → API keys.
- Secret keys have full access to the workspace. Use them where one service runs your whole integration.
- Restricted keys have only the scopes you choose. Use them to give each service exactly what it needs, such as
evaluations:createandoutcomes:writefor the service that grants trials. - A key's type and expiry are set when you create it and never change. Choose an expiry from 1 to 3,650 days, or none.
- When a key is revoked or expires, requests with it fail with
INVALID_API_KEYorAPI_KEY_EXPIRED(see REST API errors). Create a new key and replace it in your environment.
Secret and restricted keys belong on your server only. Never put them in browser code, mobile apps, URLs or logs.
Key emails
AbuseZero emails the workspace's owners and admins about every server key, so a key never stops working without warning.
| Sent | Also sent to the key's creator | |
|---|---|---|
| Key created | When a member creates a key. A secret key is marked as having full access. | No |
| Scopes changed | When a restricted key's scopes change. | No |
| Expires soon | 7 days before the key expires. A key used in the last 7 days also gets a reminder 14 days and 1 day before. | Yes |
| Expired | Within minutes of the key expiring. | Yes |
| Revoked | When the key is revoked. | Yes |
| Still in use | Once, when requests keep arriving with the key in the 7 days after it expired or was revoked. | Yes |
Each email names the key, shows its prefix and last four characters, and gives the exact time in UTC. The key's creator gets these emails while they're still a member of the workspace. The publishable key doesn't expire and can't be revoked, so it gets none of them.
Publishable key
Your publishable key is for the AbuseZero browser SDK and the standalone browser script. It can only send browser data for your claims, so it is safe in your page source.
- Browser data is accepted only from HTTPS sites in your site list, under Your sites in Developers → Browser setup, or through
PATCH /v1/browser-collection. - The publishable key can't call server endpoints. A server request with it fails with
KEY_TYPE_NOT_ALLOWED(see Troubleshooting).
OAuth
The AbuseZero CLI, the AbuseZero MCP server and other OAuth apps sign in with OAuth instead of a key. The user signs in to AbuseZero in the browser and approves the scopes the app asks for.
-
An OAuth token acts as the user who approved it, with that user's role and permissions in each workspace.
-
Requests made with an OAuth token choose the workspace with the
AbuseZero-Workspaceheader (see How requests choose a workspace):Authorization: Bearer <access token> AbuseZero-Workspace: ws_1c9e7b42-5d3a-4f81-a6e2-0b7d94c3f518 -
GET /v1/workspaceslists the workspaces a token can use. A token granted for one workspace lists only that workspace. -
Apps you've authorized appear in Developers → Connected apps. Disconnecting an app revokes its access.
Machine clients
Machine clients let the AbuseZero CLI run in scripts and CI without a person signing in (see Use the CLI in scripts and CI). Create one in Developers → Connected apps. It works only in the workspace it was created in.
export ABUSEZERO_CLIENT_ID="…"
export ABUSEZERO_CLIENT_SECRET="…"
abusezero benefits listChoosing a credential
| You're building | Use |
|---|---|
| The server code that evaluates claims and reports outcomes, with the AbuseZero Node.js SDK or the AbuseZero REST API | A restricted key with evaluations:create and outcomes:write, or a secret key |
| Browser protection on your pages | Your publishable key |
| An internal tool that manages benefits and policies | A restricted key with the matching scopes |
| A script or CI job using the AbuseZero CLI | A machine client |
| An AI app working with your workspace | The AbuseZero MCP server, signed in with OAuth |
Next steps
How is this guide?
Last updated on