POST
/v1/organizations/{organizationId}/service-principals/{principalId}/api-keysIssue an API Key for an Organization-scoped ServicePrincipal
Issue one named expiring credential and return its secret once. An identical committed retry returns only safe metadata; different input under the same Idempotency-Key returns Conflict.
Authentication
Send an API key as a Bearer token in the Authorization header.
Parameters
Request body
Required.
application/jsonResponses
201ServicePrincipalApiKeyIssuanceapplication/json400The request path, headers, query, or JSON body did not satisfy the published schema401Unauthorizedapplication/json403Forbiddenapplication/json404NotFoundapplication/json409Conflictapplication/jsonReusable schemas
IdempotencyKey
stringA caller-chosen key of 1–200 visible ASCII characters that makes an identical request safe to retry.- maximum length
200 - minimum length
1 - pattern
^[!-~]+$
ServicePrincipalApiKeyIssuance
UnauthorizedEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"Unauthorized"
- allowed values
reasonrequiredstringA safe explanation of why the credential was rejected.
ForbiddenEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"Forbidden"
- allowed values
permissionrequiredstringThe permission required by the refused operation.
NotFoundEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"NotFound"
- allowed values
resourcerequiredstringThe resource type relevant to the error.idrequiredstringThe identifier supplied for the resource that was not found.
ConflictEncoded
object- unknown properties allowed
false
_tagrequiredstringThe stable machine-readable error type.- allowed values
"Conflict"
- allowed values
resourcerequiredstringThe resource type relevant to the error.reasonrequiredstringA safe explanation of the state conflict.
ServicePrincipalApiKeyIssueRequest
object- unknown properties allowed
false
namerequiredstringThe human-readable resource name.expiresAtrequiredstringWhen the resource expires, in UTC, or null when it does not expire.- format
date-time
- format
IssuedServicePrincipalApiKeyEncoded
object- unknown properties allowed
false
outcomerequiredstringWhether this request issued a credential or reconciled a previously committed issuance.- allowed values
"issued"
- allowed values
credentialrequired- ApiKeyMetadataEncodedThe safe metadata for the newly issued credential.
apiKeyrequiredstringThe complete credential secret, returned exactly once.
ReusedServicePrincipalApiKeyEncoded
object- unknown properties allowed
false
outcomerequiredstringWhether this request issued a credential or reconciled a previously committed issuance.- allowed values
"reused"
- allowed values
credentialrequired- ApiKeyMetadataEncodedThe safe metadata for the previously committed credential.
ApiKeyMetadataEncoded
object- unknown properties allowed
false
apiKeyIdrequiredstringThe identifier of the issued API key.- maximum length
64 - pattern
^apikey_[\s\S]+$
- maximum length
principalIdrequiredstringThe Principal identifier.- maximum length
64 - pattern
^principal_[\s\S]+$
- maximum length
creationIdempotencyKeyrequired- The caller-chosen issuance key that identifies this committed credential.Any of
null namerequiredstringThe human-readable resource name.displayPrefixrequiredstringThe non-secret leading characters used to distinguish this credential.createdByPrincipalIdrequiredstringThe Principal that created this immutable record.- maximum length
64 - pattern
^principal_[\s\S]+$
- maximum length
createdAtrequiredstringWhen the resource was created, in UTC.- format
date-time
- format
expiresAtrequiredstringWhen the resource expires, in UTC, or null when it does not expire.- format
date-time
- format
lastUsedAtrequired- Approximately when this credential was last presented, in UTC, or null before its first use.
- format
date-time
Any ofstringnull - format
revokedAtrequired- When the resource was revoked, in UTC, or null while it remains active.
- format
date-time
Any ofstringnull - format
revokedByPrincipalIdrequired- The Principal that revoked this resource, or null while it remains active.Any of
stringA Cantora Principal identifier, prefixed with `principal_`.- maximum length
64 - pattern
^principal_[\s\S]+$
null - maximum length