ReferenceSDKClient
API Keys
SDK reference for api keys — Create, list, and revoke API keys for programmatic access.
Create, list, and revoke API keys for programmatic access.
createApiKey
Create a new API key for programmatic access. The secret is only returned once on creation - save it securely.
POST
Usage:
const result = await swirls.client.apiKeys.createApiKey({
name: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | |
description | string | No | |
scopes | string[] | No | |
expiresInDays | number | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
name | string | |
description | string | null | |
secret | string | |
scopes | string[] | null | |
expiresAt | string | null | |
createdAt | string |
listApiKeys
List all API keys for the current user
GET
Usage:
const result = await swirls.client.apiKeys.listApiKeys({})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
includeRevoked | boolean | No |
revokeApiKey
Revoke an API key. This immediately invalidates the key and cannot be undone.
POST
Usage:
const result = await swirls.client.apiKeys.revokeApiKey({
apiKeyId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKeyId | string | Yes | |
reason | string | No |
Output:
| Field | Type | Description |
|---|---|---|
success | boolean |