Skip to content

Authenticate

Exchange API Key credentials for JWT tokens

POST/auth/token

Request body schema

{
// Target workspace
workspace: string;
// API Key id
apiKeyId: string;
// API Key secret
apiKeySecret: string;
}

Response schema

{
// JSON Web Token used to authenticate requests
accessToken: string;
// JWT validity period (in seconds)
expiresInSeconds: number;
// Refresh token used to obtain new JWT
refreshToken: string;
// Refresh token validity period (in seconds)
refreshExpiresInSeconds: number;
}

Examples

bash
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {jwt}" \
  --data '{json-data}' \
  "$API_BASE_URL/auth/token"
ts
const url = "<base-url>/auth/token";

const headers = {
  "Content-Type": "application/json",
  Authorization: "Bearer <jwt>"
};

const payload = {}; // <- fill with the expected payload

fetch(url, { headers, method: "POST", body: JSON.stringify(payload) }).then(res => {
  console.log(res)
});
python
import requests

url = "<base-url>/auth/token"

headers = {
  "Content-Type": "application/json",
  "Authorization": "Bearer <jwt>"
}

data = {} # <- fill with the expected payload

print(requests.post(url, headers=headers, data=data))