Describe the calling key
const url = 'https://api.ebitex.io/content/management/v1/whoami';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.ebitex.io/content/management/v1/whoami \ --header 'Authorization: Bearer <token>'Reports what the key you are calling with is: the organization it belongs to, the authoring environment it reads and writes, the realm it acts in, the role it acts as, its own id and name, its scopes, and the permissions of the role it acts as.
A management key is an opaque string, so call this before acting on a key you did not mint yourself: it tells you where your writes will land, and which scopes you hold, so you can skip calls that would only be refused. A scope is the key’s ceiling and a permission is the role’s, so a key with the authoring scope can still be refused: creating a Contract needs the content.contracts.manage permission, and permissions is how to find out first. It works with any valid key, whatever its scopes, so a key that can only publish can still find out that publishing is all it can do.
Key: any valid management key, whatever its scopes.
Authorizations
Section titled “Authorizations”Responses
Section titled “ Responses ”{ "organizationId", "organizationName", "organizationSlug", "environmentId", "environmentName", "realmId", "realmKey", "realmName", "roleId", "roleName", "keyId", "keyName", "scopes": [ … ], "permissions": [ … ] }. scopes and permissions are sorted; permissions is absent when the role is not known. realmKey is root for a key minted before realms; a key is bound to one realm, so the realm is the key’s and is never chosen per request.
missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired.
payment_required: the organization’s subscription needs attention.
scope_denied: the key lacks this route’s scope. tier_required: the Content Management API needs the Pro plan or above. ip_denied: the caller’s address is outside the key’s allowed ranges. app_not_available: Content is not enabled for the organization.
Rate limit or quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.