Skip to main content

Exchange an API key for a JWT

Use POST /api/v1/authentication/api-keys/exchange-token when you need a short-lived JWT for a downstream service. Send your MKA1 API key in Authorization. Then pass a JSON body with:
  • audience: The service URL that should accept the token.
  • externalUserId: Your end user ID for the JWT subject.
  • expiresIn: Optional token lifetime in seconds. The OpenAPI spec allows 300 to 2592000.
  • permissions: Optional subset of the key’s scopes (its permissions, for example read:responses or read:files) to embed in the token. If omitted, the token carries every scope the key has. A token can narrow the key’s scopes but never widen them.
A successful response returns a JSON object with token.

Use a JWT for subsequent requests

Once you have a JWT from the exchange endpoint, use it as a bearer token in place of your API key. This lets you issue short-lived credentials to downstream services or end users without exposing your API key.
See End-user identity for delegated requests and Tenant isolation for the validation path.