Skip to content
MCPProductDomains and accessAPI Key

API Key programs: issue, revoke, roll

The API Key Verbs issue, revoke, roll as MCP do programs, with inputs, result, refusals and an example.

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

APIKey.issue

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

Text
do: return await $.APIKey.issue(input)

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

JSON
{
  "name": "do",
  "arguments": {
    "code": "return await $.APIKey.issue({ 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
do: return await $.APIKey.revoke(input)

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

JSON
{
  "name": "do",
  "arguments": {
    "code": "return await $.APIKey.revoke({ 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
do: return await $.APIKey.roll(input)

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

JSON
{
  "name": "do",
  "arguments": {
    "code": "return await $.APIKey.roll({ apiKey: 'key_BG13nfhe26' })"
  }
}