AbuseZero

REST API authentication

Authenticate AbuseZero REST API requests: credential types, workspace selection, scopes and permissions.

Every request to the AbuseZero REST API carries one credential. The credential decides which workspace the request reaches and what it may do there. A credential can never reach a workspace it wasn't granted, and no request parameter can widen its access.

Credential types

CredentialFormatUse it inAccess
Secret key (full access)sk_…Your serverEvery server scope in one workspace.
Restricted keyrk_…Your serverOnly the scopes chosen for it, in one workspace. Its scopes can be changed later.
Publishable keypk_…The browser SDK and standalone browser scriptBrowser data collection only. Safe to ship in browser code.
OAuth access tokenOpaque tokenThe AbuseZero CLI, MCP clients and OAuth appsThe scopes the user approved, in the workspaces they can access.

Create and manage keys in the dashboard under Developers. A key's type and expiry never change after it's created. An expired or revoked key stops working at once.

Keep secret and restricted keys on your server. Never put them in browser code, mobile apps, URLs or logs. Use a restricted key with only the scopes a service needs.

Send a credential

Send the credential as a bearer token in the Authorization header.

curl https://api.abusezero.com/v1/benefits \
  -H "Authorization: Bearer $ABUSEZERO_SECRET_KEY"

Choose a workspace

An API key belongs to exactly one workspace, so requests made with it need no workspace header.

An OAuth access token reaches the workspaces it was granted: only that workspace when it was granted for one workspace, otherwise every workspace its user can access. Every request made with one chooses the workspace in the AbuseZero-Workspace header, using the workspace's ws_ ID. List the available workspaces with GET /v1/workspaces, the one endpoint that works without the header.

const abusezero = new AbuseZero({
  accessToken: process.env.ABUSEZERO_ACCESS_TOKEN!,
  workspace: "ws_6d2a8f14-3c9e-4b71-a5d0-8e2f6c4a9b13",
  outage: "throw",
});

The AbuseZero CLI and the AbuseZero MCP server handle OAuth sign-in and workspace selection for you. See AbuseZero CLI and AbuseZero MCP server.

Scopes

Each endpoint requires one scope. Secret keys hold every server scope. Restricted keys and OAuth access tokens hold only the scopes granted to them.

ScopeAllows
workspaces:readList the workspaces the credential can use.
evaluations:createEvaluate claims with POST /v1/evaluations.
evaluations:readList and read evaluations, and read their association graphs.
evaluation_evidence:readRead the retained request details of an evaluation. Also needed, together with the export scopes, to create or download exports that include them.
outcomes:readList and read outcomes.
outcomes:writeReport outcomes.
simulations:runRun previews, simulations and replays.
benefits:readList and read benefits.
benefits:writeCreate, update and delete benefits.
policies:readList and read policies, policy versions and the conditions available to custom rules.
policies:writeCreate, update, duplicate and delete custom policies.
access_lists:readList and read allow and block list entries.
access_lists:writeAdd and delete allow and block list entries.
custom_identifiers:readList and read custom identifiers.
custom_identifiers:writeRegister and delete custom identifiers.
imports:readList and read imports and their error reports.
imports:writeCreate, validate, confirm and cancel imports.
exports:readList and read exports, and download finished ones.
exports:createRequest exports.
data_deletions:readList and read data deletions.
data_deletions:writePreview and request data deletions.
analytics:readRead daily evaluation totals.
request_logs:readList and read request logs.
audit_logs:readList and read audit events.
browser_collection:readRead browser setup: your site list and recent browser data coverage.
browser_collection:writeUpdate your site list.
agents:readList the AI agents AbuseZero recognizes.
observations:createSend browser data. Publishable keys only; the browser SDK uses it for you.

A request without the required scope returns KEY_PERMISSION_DENIED for API keys and OAUTH_SCOPE_REQUIRED for OAuth access tokens.

Member permissions for OAuth

An OAuth access token acts for a person, so some scopes also need that person to hold a permission in the workspace. Workspace owners hold every permission, and admins also hold Manage integrations, lists, and imports. Owners grant permissions to other members in the dashboard.

ScopePermission the member needs
evaluation_evidence:readReveal personal identifiers
exports:createExport data
data_deletions:read, data_deletions:writeDelete matching history
audit_logs:readManage integrations, lists, and imports
benefits:write, policies:writePublish policies and benefits

Without the permission, the request returns PERMISSION_REQUIRED. API keys don't need member permissions; their scopes decide their access.

Errors

StatusCodeMeaningWhat to do
401AUTHENTICATION_REQUIREDThe request has no credential.Send Authorization: Bearer with a key or access token.
401INVALID_API_KEYThe key is unknown or revoked.Create a new key in Developers.
401API_KEY_EXPIREDThe key passed its expiry.Create a new key in Developers and replace the old one.
401INVALID_ACCESS_TOKENThe OAuth access token is invalid or expired. A value that isn't a complete API key is read as an access token.Sign in again, then retry. If you meant to send an API key, check that it was copied in full.
403KEY_TYPE_NOT_ALLOWEDA publishable key was used on a server endpoint, or a server key in the browser.Use a secret or restricted key on your server, and the publishable key in the browser.
403KEY_PERMISSION_DENIEDThe API key lacks the endpoint's scope.Use a key with the scope named in the message.
403OAUTH_SCOPE_REQUIREDThe access token lacks the endpoint's scope.Authorize the scope named in the message, then retry.
403WORKSPACE_REQUIREDAn OAuth request has no valid AbuseZero-Workspace header.Send a ws_ ID from GET /v1/workspaces.
403WORKSPACE_ACCESS_DENIEDThe credential can't reach that workspace.Choose a workspace the credential belongs to.
403PERMISSION_REQUIREDThe signed-in member lacks a permission the scope needs.Ask the workspace owner for the permission.
403EVIDENCE_SCOPE_REQUIREDAn export with evidence needs evaluation_evidence:read.Add the scope, or request the export without evidence.
403ONBOARDING_REQUIREDThe workspace hasn't finished setup.Ask the workspace owner to finish onboarding in the dashboard.

See REST API errors for the full list.

How is this guide?

Last updated on

On this page