Skip to navigation

Create API key

Issues an API key for an active M2M client in the caller’s organization and returns HTTP 201. The apiToken is shown only once; store it securely. The key carries its M2M client’s scopes, and its sk_live_ or sk_test_ prefix follows the client’s environment. A bearer caller may issue a key only for its own authenticated M2M client (403 PERMISSION_DENIED for another client, even when its scopes fit). The bearer must also hold every scope of that client (403 PERMISSION_DENIED with details.exceedingScopes otherwise). An unknown or other-organization client returns 404, and an inactive client 400. The organization’s API key plan limit applies (403).

Requires every scope: api-keys:write.

Authentication

AuthorizationBearer

JWT returned by POST /api/auth/token-exchange. Amazon, authorization invitations, and developer credentials require API-key-derived tokens.

Request

This endpoint expects an object.
namestringRequired>=1 character
m2mClientIdintegerRequired>=1
Numeric M2M client ID in the caller's organization.
descriptionstringOptional
expiresInDaysintegerOptional1-3650
Days until the key expires. Omit for a key that never expires.

Response

Created. apiToken is returned only in this response.
apiKeyobject

Errors

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