Last updated: 2026-04-10
Your First Request¶
This guide walks you through the two steps needed to call the Dxtra API: authenticate with your Personal Access Token (PAT) to get a JWT, then send a GraphQL query.
Prerequisites¶
- A Dxtra account with a Personal Access Token. See Authentication for how to generate one.
Step 1: Exchange your PAT for a JWT¶
Personal Access Tokens are long-lived credentials that must be exchanged for a short-lived JWT access token before making API calls.
Response:
JSON
{
"session": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"accessTokenExpiresIn": 3600,
"refreshToken": "abc123..."
}
}
accessToken— JWT valid for 1 hour (3600 seconds). Use this in the next step.refreshToken— Valid for 12 hours. Exchange it viaPOST /v1/tokento get a new access token without re-using your PAT.
Step 2: Send a GraphQL query¶
Use the JWT from Step 1 as a Bearer token in the Authorization header.
JavaScript
const query = `
query {
dataControllers {
id
title
}
}
`;
const response = await fetch('https://api.dxtra.ai/v1/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`
},
body: JSON.stringify({ query })
});
const { data } = await response.json();
Response:
JSON
{
"data": {
"dataControllers": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "My Organisation"
}
]
}
}
Next steps¶
- Authentication — Token lifecycle, roles, and refresh flows
- GraphQL Reference — Full schema documentation
- Error Handling — HTTP status codes and error response shapes