Create an API key (admin). The secret is returned only here.
const url = 'https://example.com/v1/orgs/example/keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","role":"viewer","purpose":"agent"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/orgs/example/keys \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "role": "viewer", "purpose": "agent" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Organization (tenant) slug, e.g. alpenrobotik
Request Bodyrequired
Section titled “Request Bodyrequired”object
What the key is for, e.g. site Zurich collectors
Default viewer (read only). Collectors and SBOM uploads need member. Anything else answers 400 key.roleInvalid.
Default agent. Anything else answers 400 key.purposeInvalid.
Responses
Section titled “Responses”Created
object
User who created it; empty for keys from the key file
What an API key may do. viewer reads; member also submits reports, uploads SBOMs and makes VEX statements. A key never acts above member.
Integration: collectors, CI uploads, scripts; agent: an AI agent or MCP host. Informational.
When the key last authenticated a request, recorded at most once a minute; null if never
Made before keys had roles; such keys act as member. Replace any handed to an AI agent with a viewer key.
The secret. Store it now; it cannot be shown again.
Example
{ "role": "viewer", "purpose": "integration"}Caller is not an admin
Over the operation’s rate-limit budget (x-affectra-budget): code request.rateLimited with params.budget. Wait Retry-After seconds before trying again.
Every error answer, Content-Type
application/problem+json. The web app and integrations translate code; detail is English,
for people reading curl output or CI logs, and may change wording at
any time. Match on code, never on detail.
object
The HTTP status
Stable error codes. A code is never renamed; new ones may be added, so
a client falls back to detail for a code it doesn’t know. Another
organization’s object answers notFound, the same as a missing one.
What went wrong
Values the code’s message needs, e.g. {“field”: “version”}. Only values the caller sent or may see. Empty when the message needs none.
object
Example
{ "code": "notFound"}Headers
Section titled “Headers”Seconds until a request would be allowed again, at least 1