Skip to main content

Class: ApiKeyManager

Manages API keys for the tenant.

Constructors

new ApiKeyManager()

new ApiKeyManager(ctx): ApiKeyManager

Internal

Parameters

ParameterType
ctxClientContext

Returns

ApiKeyManager

Defined in

4Players/cortex-typescript-sdk/src/resources/api-keys.ts:17

Methods

create()

create(body): Promise<object>

Create a new API key

Parameters

ParameterTypeDescription
bodyobjectAPI key creation payload
body.expiresAt?stringDescription Optional expiration date (ISO string) Example 2025-12-31T23:59:59Z
body.namestringDescription Human-readable name for the key Example Aiba Webhook
body.projectId?stringDescription Optional project ID to scope this key to Example my-project-id
body.scopesstring[]Description Scopes to grant to this key Example [ "plugin-endpoints" ]

Returns

Promise<object>

Created API key (includes the secret key, shown only once)

NameTypeDescriptionDefined in
createdAtstringFormat: date-time Description Creation date4Players/cortex-typescript-sdk/src/types.ts:2670
expiresAt?stringFormat: date-time Description Expiration date4Players/cortex-typescript-sdk/src/types.ts:2665
idstringDescription Unique identifier4Players/cortex-typescript-sdk/src/types.ts:2644
keystringDescription Full API key - shown only once at creation!4Players/cortex-typescript-sdk/src/types.ts:2672
keyPrefixstringDescription First characters of the key for identification Example ots_live_abc1...4Players/cortex-typescript-sdk/src/types.ts:2653
lastUsedAt?stringFormat: date-time Description When the key was last used4Players/cortex-typescript-sdk/src/types.ts:2660
namestringDescription Key name4Players/cortex-typescript-sdk/src/types.ts:2646
projectId?stringDescription Project ID this key is scoped to (null = all projects)4Players/cortex-typescript-sdk/src/types.ts:2648
scopesstring[]Description Scopes this key has access to4Players/cortex-typescript-sdk/src/types.ts:2655

Defined in

4Players/cortex-typescript-sdk/src/resources/api-keys.ts:34


getScopes()

getScopes(): Promise<void>

Get available API key scopes

Returns

Promise<void>

Defined in

4Players/cortex-typescript-sdk/src/resources/api-keys.ts:56


list()

list(): Promise<object[]>

List all API keys for the tenant

Returns

Promise<object[]>

Array of API keys

Defined in

4Players/cortex-typescript-sdk/src/resources/api-keys.ts:23


revoke()

revoke(keyId): Promise<void>

Revoke an API key

Parameters

ParameterTypeDescription
keyIdstringAPI key ID

Returns

Promise<void>

Defined in

4Players/cortex-typescript-sdk/src/resources/api-keys.ts:46