Create surface API key

Create a new API key for a surface. The plaintext key is only returned on creation.

Authentication

AuthorizationBearer
API key or Clerk session token

Path parameters

idstringRequired
surfaceIdstringRequired

Request

This endpoint expects an object.
environmentenumOptionalDefaults to test
Allowed values:
expiresAtdatetimeOptional
namestringOptional<=255 characters
rateLimitPerDayintegerOptional>=1
rateLimitPerMinuteintegerOptional>=1
scopeslist of stringsOptional

Capability restrictions. Prefer IDs from get_surface.scopeTargets; linked surface-item/capability IDs and unique names shown in that catalog are accepted and resolved to immutable authorization targets. Use * for unrestricted access.

Response

Surface key created
createdAtstring
environmentstring
expiresAtstring or null
idstring
isActiveboolean
keystring
keyHintstring or null
keyPrefixstring
namestring or null
rateLimitPerDayinteger or null
rateLimitPerMinuteinteger or null
scopeTargetIdslist of strings
scopeslist of strings
surfaceIdstring

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
500
Internal Server Error