Passer au contenu principal
POST
/
auth
/
token
Obtenir un JWT depuis une clé d'API
import requests

url = "https://app.ubik-agent.com/api/v1/auth/token"

payload = {
    "external_user_id": "user_123",
    "expires_in_minutes": 60
}
headers = {
    "X-API-KEY": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({external_user_id: 'user_123', expires_in_minutes: 60})
};

fetch('https://app.ubik-agent.com/api/v1/auth/token', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
curl --request POST \
  --url https://app.ubik-agent.com/api/v1/auth/token \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "external_user_id": "user_123",
  "expires_in_minutes": 60
}
'
{
  "access_token": "<string>",
  "token_type": "<string>"
}
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Autorisations

X-API-KEY
string
header
requis

Corps

application/json
external_user_id
string
requis

The unique identifier of the end-user to scope this token to.

Exemple:

"user_123"

expires_in_minutes
integer
défaut:60

Token expiration time in minutes.

Plage requise: 5 <= x <= 1440

Réponse

Successful Response

access_token
string
requis
token_type
string
requis