Skip to main content

index/interfaces/CreateApiKeyResponse.md

Response when creating a new API key. CRITICAL: rawKey is ONLY returned on creation and never again!

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​

Properties​

PropertyTypeDescriptionInherited from
createdAtstringCreation timestamp (ISO 8601)ApiKeyData.createdAt
delegateAllTokensbooleanWhether key has access to all owner's tokensApiKeyData.delegateAllTokens
descriptionstring | nullUser's description/labelApiKeyData.description
expiresAtstring | nullExpiration timestamp (ISO 8601) or null if never expiresApiKeyData.expiresAt
idnumberUnique identifierApiKeyData.id
keyPrefixstringFirst 8 characters for identification (e.g., "glp_abc1")ApiKeyData.keyPrefix
lastUsedAtstring | nullLast time key was used (ISO 8601) or null if never usedApiKeyData.lastUsedAt
rawKeystringThe 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!-
roleApiKeyRoleRole determining permissionsApiKeyData.role
sourceTypeApiKeySourceIndicates whether the key holder owns tokens (OWNER) or only has moderator access (MODERATOR). Since 9.1.0ApiKeyData.sourceType
tokenNamesstring[] | nullList of specifically delegated token names (null if delegateAllTokens is true)ApiKeyData.tokenNames
tokenPermissions?Record<string, Permission[]> | nullPer-token permission overrides (null if no overrides set). Maps tokenName to Permission[]. Since 5.8.0ApiKeyData.tokenPermissions
updatedAtstringLast update timestamp (ISO 8601)ApiKeyData.updatedAt