Development Environment Setup¶
Set up your development environment for Dxtra API integration.
Part of the Developer Journey
This is Step 1 in the developer workflow. After setup, proceed to First API Request.
First API Request API Overview
Prerequisites¶
| Requirement | Version | Purpose |
|---|---|---|
| Node.js | 18+ | JavaScript runtime |
| Python | 3.8+ | Alternative runtime |
| Git | Any | Version control |
| Code editor | VS Code recommended | Development |
| Dxtra account | With API access | Authentication |
Step 1: Get API Credentials¶
Create Your API Key¶
- Log in to the Dxtra Dashboard
- Navigate to Developers > API Keys
- Click Create API Key
- Copy and store the token securely (displayed only once)
Security
API keys provide full access to your account. Never commit them to version control or expose them in client-side code.
Environment Configuration¶
Create a .env file in your project root:
# .env (never commit this file)
DXTRA_PAT=your_personal_access_token_here
DXTRA_AUTH_URL=https://auth.dxtra.ai
DXTRA_API_URL=https://api.dxtra.ai/v1/graphql
Add .env to your .gitignore:
Step 2: Install Dependencies¶
Dxtra uses a GraphQL API - use any GraphQL client in your preferred language.
Step 3: Verify Your Setup¶
Run this test to confirm your environment is configured correctly:
import { GraphQLClient } from 'graphql-request';
import 'dotenv/config';
async function testConnection() {
// Exchange PAT for JWT
const authResponse = await fetch('https://auth.dxtra.ai/v1/signin/pat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ personalAccessToken: process.env.DXTRA_PAT })
});
const { session } = await authResponse.json();
// Create GraphQL client
const client = new GraphQLClient('https://api.dxtra.ai/v1/graphql', {
headers: {
'Authorization': `Bearer ${session.accessToken}`,
'X-Hasura-Role': 'user'
}
});
// Test query
const data = await client.request(`
query { dataControllers { id title } }
`);
console.log('Connected! Data controllers:', data);
}
testConnection();
import os
import requests
from gql import gql, Client
from gql.transport.requests import RequestsHTTPTransport
from dotenv import load_dotenv
load_dotenv()
def test_connection():
# Exchange PAT for JWT
response = requests.post(
'https://auth.dxtra.ai/v1/signin/pat',
json={'personalAccessToken': os.getenv('DXTRA_PAT')}
)
session = response.json()['session']
# Create GraphQL client
transport = RequestsHTTPTransport(
url='https://api.dxtra.ai/v1/graphql',
headers={
'Authorization': f'Bearer {session["accessToken"]}',
'X-Hasura-Role': 'user'
}
)
client = Client(transport=transport, fetch_schema_from_transport=True)
# Test query
query = gql('query { dataControllers { id title } }')
result = client.execute(query)
print('Connected! Data controllers:', result)
test_connection()
Expected output:
Connected! Data controllers: {'dataControllers': [{'id': '...', 'title': 'Your Organization'}]}
Troubleshooting¶
| Issue | Solution |
|---|---|
Invalid personalAccessToken | Verify API key is correct and not expired |
Connection refused | Check internet connectivity and firewall settings |
Module not found | Run npm install or pip install again |
Environment variable undefined | Ensure .env file exists and is loaded |
Next Steps¶
Your environment is ready. Continue with:
| Step | Time | Guide |
|---|---|---|
| 2. First API Request | 5 min | Make your first API call |
| 3. Choose Integration | - | Browse integration options |
| 4. Authentication Deep Dive | 10 min | Learn JWT token handling |
-
First API Request
Make your first successful API call with a complete walkthrough.
-
Browse Integrations
Choose your integration path: API, widgets, or platform connectors.