index/interfaces/CreateApiKeyResponse.md
Response when creating a new API key.
CRITICAL: rawKey is ONLY returned on creation and never again!
raw key
Example
const result = await sdk.createApiKey({ role: 'MODERATOR' });
console.log('Save this key:', result.rawKey); // Only chance to see it!
// rawKey format: "glp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Extends
api key data
Properties
| Property | Type | Description | Inherited from |
|---|---|---|---|
createdAt | string | Creation timestamp (ISO 8601) | ApiKeyData.createdAt |
delegateAllTokens | boolean | Whether key has access to all owner's tokens | ApiKeyData.delegateAllTokens |
description | string | null | User's description/label | ApiKeyData.description |
expiresAt | string | null | Expiration timestamp (ISO 8601) or null if never expires | ApiKeyData.expiresAt |
id | number | Unique identifier | ApiKeyData.id |
keyPrefix | string | First 8 characters for identification (e.g., "glp_abc1") | ApiKeyData.keyPrefix |
lastUsedAt | string | null | Last time key was used (ISO 8601) or null if never used | ApiKeyData.lastUsedAt |
rawKey | string | The full API key - ONLY shown once on creation! Format: glp_{base64url_encoded_random_bytes} Example: "glp_abc1234defghijklmnopqrstuvwxyz012345678" CRITICAL: Store this securely - it cannot be retrieved again! | - |
role | ApiKeyRole | Role determining permissions | ApiKeyData.role |
sourceType | ApiKeySource | Indicates whether the key holder owns tokens (OWNER) or only has moderator access (MODERATOR). Since 9.1.0 | ApiKeyData.sourceType |
tokenNames | string[] | null | List of specifically delegated token names (null if delegateAllTokens is true) | ApiKeyData.tokenNames |
tokenPermissions? | Record<string, Permission[]> | null | Per-token permission overrides (null if no overrides set). Maps tokenName to Permission[]. Since 5.8.0 | ApiKeyData.tokenPermissions |
updatedAt | string | Last update timestamp (ISO 8601) | ApiKeyData.updatedAt |
created at api key data delegate all tokens expires prefix last used raw role source type token names permissions updated