Pular para o conteúdo 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.

Autorizações

Authorization
string
header
obrigatório

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>.

Cabeçalhos

X-On-Behalf-Of
string

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

Corpo

application/json
audience
string<uri>
obrigatório

Reivindicação de público (aud) JWT para o token trocado. Defina isso para a URL da API/serviço de destino que deve aceitar o token.

externalUserId
string
obrigatório

Seu identificador de usuário externo a ser colocado na reivindicação (claim) do sujeito (sub) do JWT.

Minimum string length: 1
expiresIn
number
padrão:3600

Tempo de vida do token em segundos. Deve estar entre 300 (5 minutos) e 2592000 (30 dias). O padrão é 3600 (1 hora).

Intervalo obrigatório: 300 <= x <= 2592000
permissions
string[]

Conjunto opcional de permissões da chave API a serem incorporadas no token. Se omitido, todas as permissões da chave API serão utilizadas.

Resposta

Chave API trocada com sucesso por um token JWT

token
string
obrigatório

Signed JWT exchange token to use when calling downstream services.