Skip to content
CLIProductDomains and accessAPI Key

API Key commands: issue, revoke, roll

The API Key Verbs issue, revoke, roll as CLI commands, with inputs, result, refusals and an example.

Reference for API Key, one group of API Key commands.

APIKey.issue

Issue creates an API Key for one Customer and returns its secret once; afterwards only the prefix shows. Verb page.

Text
npx startup-builder do APIKey.issue --json '<input>' [--try | --send | --do]

Emits APIKey.issued.

Inputs

InputTypeRequiredDescription
customerCustomerrequiredThe Customer whose calls it signs.
namestringrequiredWhat the key is for.
environmentstringrequiredOne of test or live.
verbslist of VerbThe Verbs it may call; unset reaches every Verb the Customer’s Entitlements grant.
expiresAtdatetimeWhen it stops working on its own.

Returns

OutputTypeRequiredDescription
apiKeyAPI KeyrequiredThe API Key, with its prefix.
secretstringrequiredThe full secret. It is returned here once and never again.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
npx startup-builder do APIKey.issue --json '{"customer":"cus_wjAFWuKWIV","name":"Nightly sync","environment":"test"}'

APIKey.revoke

Revoke stops an API Key at once: its next call fails with 401, and the record and its history stay. Verb page.

Text
npx startup-builder do APIKey.revoke --json '<input>' [--try | --send | --do]

Emits APIKey.revoked.

Inputs

InputTypeRequiredDescription
apiKeyAPI KeyrequiredThe API Key to stop.
reasontextWhy, shown to the Customer’s admins.

Returns

OutputTypeRequiredDescription
apiKeyAPI KeyrequiredThe API Key, with revokedAt set.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
npx startup-builder do APIKey.revoke --json '{"apiKey":"key_BG13nfhe26"}'

APIKey.roll

Roll issues a replacement API Key with the same scope and keeps the old one working until a set time. Verb page.

Text
npx startup-builder do APIKey.roll --json '<input>' [--try | --send | --do]

Emits APIKey.rolled.

Inputs

InputTypeRequiredDescription
apiKeyAPI KeyrequiredThe API Key to replace.
expireInstringHow long the old key keeps working, from 0h to 7d. Defaults to 24h.

Returns

OutputTypeRequiredDescription
apiKeyAPI KeyrequiredThe replacement API Key.
secretstringrequiredThe replacement’s full secret, returned once.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
npx startup-builder do APIKey.roll --json '{"apiKey":"key_BG13nfhe26"}'