Skip to main content

Function: createAPIToken()

createAPIToken(client, props): Promise<{ id: number; name: string; description: string; token: string; type: "SECRET" | "FRONTEND"; domainWhitelist: string | null; lastUsedAt: string | null; usedCount: number; createdAt: string; updatedAt: string; userId: number; userName: string; }>

Creates a new API token for a service account.

Parameters​

client​

ApiClient

The API client instance

props​

The request properties

query​

{ orgName: string; projectName: string; } | { orgName: string; } = createApiTokenQuerySchema

Query parameters (orgName, optional projectName)

body​

{ serviceAccountName: string; name: string; description?: string; type: "SECRET" | "FRONTEND"; domainWhitelist?: string; } = createApiTokenBodySchema

Request body with token details

body.serviceAccountName​

string = ...

body.name​

string = ...

body.description?​

string = ...

body.type​

"SECRET" | "FRONTEND" = ...

body.domainWhitelist?​

string = ...

Returns​

Promise<{ id: number; name: string; description: string; token: string; type: "SECRET" | "FRONTEND"; domainWhitelist: string | null; lastUsedAt: string | null; usedCount: number; createdAt: string; updatedAt: string; userId: number; userName: string; }>

Promise resolving to the created API token (includes the token value)

Operation Id​

create-api-token