Skip to main content

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 as POST /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

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-app
  • staging-environment
  • development-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 the x-api-key header:

Transaction Build Endpoints

For execution-oriented endpoints, send both headers:
Use this pattern for:
  • POST /transactions/buy
  • POST /transactions/sell
  • GET /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

Response:

Update an API Key

Delete an API Key

Create a New Key

Response:
The full API key is only returned once during creation. Store it securely!

Rate Limiting

Rate limits are enforced per API key:

Error Responses

401 Unauthorized

Missing API key:
Invalid 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