Create a partner tenant API key
Defaults to partner administration, including customer, configuration, publishing, and key management. Billing and team membership are excluded. Explicit permissions narrow the grant. The secret is returned once. Create a replacement, update your integration, then revoke the old key to rotate.
/v1/tenants/{tenantId}/api-keysAuthorizationBearer token · headerrequiredBetter Auth session, OAuth access token, OAuth client-credentials token, or sfm_ Space machine credential.
tenantIdstringrequiredTenant id. Must be the credential's own tenant.
application/jsonnamestringHuman-readable key name.
permissionsstring[]Finite permission set the derived policy grants, and nothing beyond it.
metadataobjectCaller-supplied metadata.
ipAllowliststring[] | nullCIDR/IP allowlist for the new key.
Show propertiesHide properties
stringstringnullexpiresAtstring<date-time> | string | nullExpiry instant.
Show propertiesHide properties
string<date-time>stringnullnotBeforestring<date-time> | string | nullActivation instant.
Show propertiesHide properties
string<date-time>stringnullResponse for status 201
$schemastring<uri>Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.
dataobjectrequiredShow propertiesHide properties
idstringrequiredAPI key id.
namestring | nullrequiredHuman-readable key name.
tenantIdstring | nullrequiredTenant the key belongs to.
modestringrequiredtest when the key belongs to a linked test tenant, live otherwise.
livetestsubjectobject | nullrequiredSubject the key acts as.
Show propertiesHide properties
typestringrequiredSubject kind the key acts as in audit records.
userteamexternalsystemidstringrequiredStable subject id.
nullownerPrincipalobject | nullrequiredOwning principal (ownership metadata, never the authorization gate).
Show propertiesHide properties
typestringrequiredPrincipal type that owns this key.
teamexternalidstringrequiredStable principal id (Better Auth team id, or external id).
nullcreatedByUserIdstring | nullrequiredUser who created the key, or null for automation. Tenant-key creators are recorded for audit and do not own the key's authority.
collectionstringrequiredDisjoint resource collection this key addresses.
teamtenantpresetstring | nullrequiredPreset the policy was compiled from, if any.
Show propertiesHide properties
stringnullteamScopeobject | nullrequiredMembership-following team scope for a device-login key, or null for legacy keys.
Show propertiesHide properties
modestringrequiredmodestringrequiredteamIdsstring[]requiredmodestringrequirednullpolicyobject | nullrequiredEffective access policy. A key authorizes by policy only.
Show propertiesHide properties
versionstringrequiredMust be the current platform policy version.
statementsobject[]requiredEvaluation order: explicit deny wins, explicit allow permits, otherwise implicit deny.
Show propertiesHide properties
objecteffectstringrequiredExplicit deny always wins over allow.
allowdenyactionsstring[]requiredActions this statement covers.
resourcesstring[]requiredResource URIs this statement covers (wildcards cover subtrees).
conditionsobjectAND condition attributes. Unresolvable attributes fail closed: no match for allow, and match for deny.
Show propertiesHide properties
request.clientstringRestricts the statement to one resolved request client.
dashboardcliapiworkernullmetadataobjectrequiredCaller-supplied metadata.
secretPreviewstringrequiredMasked secret preview (prefix and last characters).
notBeforestring<date-time> | nullrequiredKey is rejected before this instant.
Show propertiesHide properties
string<date-time>nullexpiresAtstring<date-time> | nullrequiredKey is rejected from this instant.
Show propertiesHide properties
string<date-time>nullipAllowliststring[] | nullrequiredCIDR/IP allowlist. Requests from other addresses are rejected.
Show propertiesHide properties
stringstringnullrevokedAtstring<date-time> | nullrequiredRevocation instant.
Show propertiesHide properties
string<date-time>nullenabledbooleanrequiredWhether the key currently authenticates.
createdAtstring<date-time>requiredCreation instant.
updatedAtstring<date-time>requiredLast update instant.
lastRequestAtstring<date-time> | nullrequiredLast authenticated request instant.
Show propertiesHide properties
string<date-time>nullsecretstringrequiredProblem details (RFC 9457). Any 4xx/5xx response is one application/problem+json document.
$schemastring<uri>Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.
typestringrequiredProblem type URI resolving to the error docs page. The server derives it mechanically from code against the docs origin.
titlestringrequiredShort human-readable summary of the problem type. The server derives it mechanically from code.
statusintegerrequiredHTTP status code of this response, repeated in the body.
detailstringrequiredHuman-readable failure explanation for this occurrence.
codestringrequiredStable snake_case error code naming the failed public contract.
pointerstringRFC 6901 JSON Pointer into the failing request field, for example "/files/37/path", on validation failures.
detailsobjectMachine-readable context for the error code.
fixstringOne sentence on what to do about this error code, the same text as the type page. Read it before retrying.
suggestionsstring[]Actionable recovery steps safe to show in dashboards, SDKs, and CLI output.
nextstring[]Copy-pasteable commands or API requests an agent can run next.
requestIdstringrequiredThe request id to quote when contacting support.