Skip to main content
Every Antigen request is authorized against an organization. There are two credential kinds, and which one you want depends on whether a person or an application is acting. API keys begin with atg_sk_ and belong to the organization rather than to the person who created them. Your organization administrator issues and revokes them. An interactive member does not need a key at all: antigen login stores a user access token for the CLI.

Configure a credential

Read the key from your secret source at startup. Keep it out of URLs, source files, command arguments, and logs, where shell history and process listings expose it. From TypeScript:
From the CLI, sign in once as a member. The organization ID is a UUID:
Over HTTP, send the key in x-api-key on every request:
The SDK also accepts a user access token through its object form. Pass exactly one of apiKey and accessToken; see new Antigen for the full option set.

Confirm it works

The atg_sk_ prefix identifies the credential kind, not its validity, expiry, or scope, so a shape check cannot tell you whether a key still works. Read your approved targets instead. It is the cheapest authenticated call and it returns something you need anyway. Use antigen targets, GET /v1/targets, or getApprovedTargets(). An empty list means the credential authenticated but your organization has no approved target yet, which is a question for your administrator rather than an integration bug.

Scopes

A credential carries scopes, and each endpoint requires one: Scopes are checked per request, so a credential that can create a Run cannot necessarily read its findings. Grant the narrowest set each integration needs.

Resolve an authorization error

None of these are fixed by retrying or by starting a new assessment. A Run ID is a locator, not a credential, so possession of an ID grants nothing and a permission problem follows you to the next Run. Fix the credential and recover the existing assessment through its saved ID. Keep the requestId from any error response with the saved Run ID. It lets support identify the failing request without exposing the credential. Related: Get started, Reliability and security, and the TypeScript SDK, CLI, and HTTP API references.