Class: ApiKeyManager
Manages API keys for the tenant.
Constructors
new ApiKeyManager()
Internal
Parameters
| Parameter | Type |
|---|---|
ctx | ClientContext |
Returns
Defined in
4Players/cortex-typescript-sdk/src/resources/api-keys.ts:17
Methods
create()
Create a new API key
Parameters
| Parameter | Type | Description |
|---|---|---|
body | object | API key creation payload |
body.expiresAt? | string | Description Optional expiration date (ISO string) Example 2025-12-31T23:59:59Z |
body.name | string | Description Human-readable name for the key Example Aiba Webhook |
body.projectId? | string | Description Optional project ID to scope this key to Example my-project-id |
body.scopes | string[] | Description Scopes to grant to this key Example [ "plugin-endpoints" ] |
Returns
Promise<object>
Created API key (includes the secret key, shown only once)
| Name | Type | Description | Defined in |
|---|---|---|---|
createdAt | string | Format: date-time Description Creation date | 4Players/cortex-typescript-sdk/src/types.ts:2670 |
expiresAt? | string | Format: date-time Description Expiration date | 4Players/cortex-typescript-sdk/src/types.ts:2665 |
id | string | Description Unique identifier | 4Players/cortex-typescript-sdk/src/types.ts:2644 |
key | string | Description Full API key - shown only once at creation! | 4Players/cortex-typescript-sdk/src/types.ts:2672 |
keyPrefix | string | Description First characters of the key for identification Example ots_live_abc1... | 4Players/cortex-typescript-sdk/src/types.ts:2653 |
lastUsedAt? | string | Format: date-time Description When the key was last used | 4Players/cortex-typescript-sdk/src/types.ts:2660 |
name | string | Description Key name | 4Players/cortex-typescript-sdk/src/types.ts:2646 |
projectId? | string | Description Project ID this key is scoped to (null = all projects) | 4Players/cortex-typescript-sdk/src/types.ts:2648 |
scopes | string[] | Description Scopes this key has access to | 4Players/cortex-typescript-sdk/src/types.ts:2655 |
Defined in
4Players/cortex-typescript-sdk/src/resources/api-keys.ts:34
getScopes()
Get available API key scopes
Returns
Promise<void>
Defined in
4Players/cortex-typescript-sdk/src/resources/api-keys.ts:56
list()
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 an API key
Parameters
| Parameter | Type | Description |
|---|---|---|
keyId | string | API key ID |
Returns
Promise<void>
Defined in
4Players/cortex-typescript-sdk/src/resources/api-keys.ts:46