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. Endpoints scoped to a wallet user, such as the portfolio analysis routes, accept either an API key or a Privy bearer token. The calldata endpoints need neither beyond your API key: they build and simulate calls from public chain state and never touch a user’s account.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:
Wallet-Scoped Endpoints
Endpoints tied to a wallet user accept a Privy bearer token in place of the API key, for calls made from a signed-in front end:POST /portfolios/analyzePOST /portfolios/comparePOST /portfolios/simulate
x-api-key alone. The calldata endpoints —
GET /instruments/:instrumentId/calldata, GET /bridge/calldata and GET /loops/:loopId/calldata
— always take x-api-key alone.
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