Saltar al contenido principal
POST
/
api
/
v1
/
authentication
/
api-key
/
exchange-token
Python (SDK)
from mka1 import SDK


with SDK(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as sdk:

    res = sdk.auth.api_key.get_jwt_from_key(body={
        "audience": "https://my-awesome-website.com",
        "external_user_id": "the-user-id-in-your-system",
        "permissions": [
            "agent:create",
            "agent:read",
        ],
    })

    # Handle response
    print(res)
{
  "token": "the-jwt-token"
}

Documentation Index

Fetch the complete documentation index at: https://docs.mka1.com/llms.txt

Use this file to discover all available pages before exploring further.

Autorizaciones

Authorization
string
header
requerido

Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.

Encabezados

X-On-Behalf-Of
string

Optional external end-user identifier forwarded by the API gateway.

Cuerpo

application/json
audience
string<uri>
requerido

Reclamación de audiencia (aud) del JWT para el token intercambiado. Establezca esto en la URL de la API/servicio objetivo que debe aceptar el token.

externalUserId
string
requerido

Su identificador de usuario externo para colocar en el reclamo de sujeto (sub) del JWT. Debe ser de 1 a 150 caracteres imprimibles en ASCII y no puede ser el carácter comodín *.

Required string length: 1 - 150
Pattern: ^[\x20-\x7E]+$
expiresIn
number
predeterminado:3600

Tiempo de vida del token en segundos. Debe estar entre 300 (5 minutos) y 2592000 (30 días). Por defecto es 3600 (1 hora).

Rango requerido: 300 <= x <= 2592000
permissions
string[]

Conjunto opcional de permisos de clave API para incrustar en el token. Si se omite, se utilizan todos los permisos de clave API.

Respuesta

Intercambio exitoso de la clave API por un token JWT

token
string
requerido

Signed JWT exchange token to use when calling downstream services.