Overview
The 1tx API uses API key authentication for all requests. API keys are tied to your account and can be managed through the dashboard. Some execution endpoints, such asPOST /transactions/buy and POST /transactions/sell, also require a bearer token because they are wallet-user scoped.
Getting an API Key
1
Create an Account
Sign up at https://app.1tx.fi/signup
2
Navigate to API Keys
Go to Settings → API Keys in your dashboard
3
Generate a New Key
Click “Generate New API Key” and give it a descriptive nameExample names:
production-appstaging-environmentdevelopment-local
4
Copy Your Key
Important: Copy the key immediately - it will only be shown once!
5
Store Securely
Store your API key in environment variables, never hardcode it:
Using API Keys
In HTTP Requests
Include your API key in thex-api-key header:
Transaction Build Endpoints
For execution-oriented endpoints, send both headers:POST /transactions/buyPOST /transactions/sellGET /transactions/balances/:userAddress
With JavaScript/TypeScript
With Python
With SDK
API Key Types
Test Keys
Prefix:dx_sk_test_
- Use in development and testing
- Access to test environment only
- Unlimited requests
- No charges
Live Keys
Prefix:dx_sk_live_
- Use in production
- Access to mainnet data
- Subject to rate limits
- Charges apply
Managing API Keys
View All Keys
Update an API Key
Delete an API Key
Create a New Key
Rate Limiting
Rate limits are enforced per API key:Error Responses
401 Unauthorized
Missing API key:403 Forbidden
Insufficient permissions:429 Too Many Requests
Rate limit exceeded:Next Steps
API Reference
Start making API calls
Instruments API
Query DeFi instruments
Integration Guide
Choose your integration model
How It Works
Understand the transaction flow