TypeScript SDK: API keys

The methods of the TypeScript client under API keys. Credentials for agents: account-wide keys from the console, inbox-scoped keys from the API.

client.inboxes.keys.create

TypeScript

client.inboxes.keys.create(inboxId: string, body: CreateApiKey = {}): Promise<CreatedApiKey>

Sends inboxes.keys.create: POST /v1/inboxes/{inboxId}/api-keys

A key that reads and operates exactly one inbox. The token is returned once.

Access account: an account-scoped key or a console session; an inbox-scoped key gets 403 forbidden. App tokens are refused.

client.inboxes.keys.list

TypeScript

client.inboxes.keys.list(inboxId: string): Promise<ApiKeyList>

Sends inboxes.keys.list: GET /v1/inboxes/{inboxId}/api-keys

The inbox's active keys, oldest first.

Access account: an account-scoped key or a console session; an inbox-scoped key gets 403 forbidden. App tokens are refused.

client.inboxes.keys.get

TypeScript

client.inboxes.keys.get(inboxId: string, keyId: string): Promise<ApiKey>

Sends inboxes.keys.get: GET /v1/inboxes/{inboxId}/api-keys/{keyId}

One active key of the inbox, without its token.

Access account: an account-scoped key or a console session; an inbox-scoped key gets 403 forbidden. App tokens are refused.

client.inboxes.keys.revoke

TypeScript

client.inboxes.keys.revoke(inboxId: string, keyId: string): Promise<void>

Sends inboxes.keys.revoke: DELETE /v1/inboxes/{inboxId}/api-keys/{keyId}

The key stops authenticating on its next request.

Access account: an account-scoped key or a console session; an inbox-scoped key gets 403 forbidden. App tokens are refused.

client.apiKeys.list

TypeScript

client.apiKeys.list(params: ListApiKeysParams = {}): Promise<ApiKeyList>

Sends apiKeys.list: GET /v1/api-keys

The account's active account-wide keys, oldest first; scope: "all" adds the inbox-scoped ones.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.apiKeys.create

TypeScript

client.apiKeys.create(body: CreateApiKey = {}): Promise<CreatedApiKey>

Sends apiKeys.create: POST /v1/api-keys

An account-wide key. The token is returned once.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.apiKeys.get

TypeScript

client.apiKeys.get(keyId: string): Promise<ApiKey>

Sends apiKeys.get: GET /v1/api-keys/{keyId}

One active account-wide key, without its token.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.apiKeys.revoke

TypeScript

client.apiKeys.revoke(keyId: string): Promise<void>

Sends apiKeys.revoke: DELETE /v1/api-keys/{keyId}

The key stops authenticating on its next request.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

Up Down to move, Enter to open, Esc to close