> For the complete documentation index, see [llms.txt](https://dexhunter.gitbook.io/dexhunter-partners/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dexhunter.gitbook.io/dexhunter-partners/api-reference/api.md).

# Overview

The DexHunter API lets you integrate Cardano's most powerful DEX aggregator into your application. Build swaps, limit orders, and DCA schedules with optimal routing across 15+ DEXes.

{% hint style="warning" %}
**Authentication Required**

All API requests must include the `X-Partner-Id` header with your API key.

Get your API key at [app.dexhunter.io/partners](https://app.dexhunter.io/partners) → Dashboard Tab
{% endhint %}

***

## Base URLs

| Service    | URL                              |
| ---------- | -------------------------------- |
| Main API   | `https://api-us.dexhunterv3.app` |
| Charts API | `https://charts.dhapi.io`        |

***

## Authentication

Include this header on every request:

```javascript
const headers = {
  'X-Partner-Id': 'YOUR_API_KEY',
};
```

***

## Endpoints

### 📈 Trading

Build and execute orders with smart routing.

| Endpoint                    | Description                         |
| --------------------------- | ----------------------------------- |
| `POST /swap/build`          | Build market swap transaction       |
| `POST /swap/estimate`       | Get swap quote without building tx  |
| `POST /swap/limit/build`    | Build limit order transaction       |
| `POST /swap/limit/estimate` | Get limit quote without building tx |
| `POST /dca/create`          | Build DCA order transaction         |

### 📋 Orders

Fetch, filter, and manage orders.

| Endpoint                   | Description                   |
| -------------------------- | ----------------------------- |
| `POST /swap/orders/{addr}` | Get orders for a user address |
| `POST /swap/ordersByPair`  | Get orders for a trading pair |
| `POST /swap/cancel`        | Cancel single order           |
| `POST /swap/bulkcancel`    | Cancel multiple orders        |

### 📊 Data

Token discovery and market data.

| Endpoint                          | Description                   |
| --------------------------------- | ----------------------------- |
| `GET /swap/adaValue`              | Get ADA price in USD          |
| `GET /swap/averagePrice/ADA/{id}` | Get token price in ADA        |
| `GET /stats/pools/ADA/{id}`       | Get liquidity pools           |
| `GET /stats/pairs/{id}`           | Get trading pairs             |
| `GET /stats/daily_stats/ADA/{id}` | Get 24h trading stats         |
| `GET /swap/tokens`                | Search tokens by name/ticker  |
| `GET /swap/token/{id}`            | Get token metadata            |
| `POST /charts`                    | Get OHLCV candlestick data    |
| `POST /trending`                  | Get trending tokens by volume |

***

## Transaction Flow

All trading endpoints follow the same build → sign → submit pattern:

```
1. Build   →  POST to endpoint  →  get CBOR transaction
2. Sign    →  wallet.signTx(cbor, true)  →  get signatures
3. Witness →  POST /swap/sign  →  get signed CBOR
4. Submit  →  wallet.submitTx(signedCbor)  →  get tx hash
```

```javascript
const headers = { 'X-Partner-Id': 'YOUR_API_KEY' };

// 1. Build the transaction
const { data: swap } = await axios.post(
  'https://api-us.dexhunterv3.app/swap/build',
  payload,
  { headers }
);

// 2. Sign with wallet
const signatures = await wallet.signTx(swap.cbor, true);

// 3. Add witness
const { data: signed } = await axios.post(
  'https://api-us.dexhunterv3.app/swap/sign',
  { txCbor: swap.cbor, signatures },
  { headers }
);

// 4. Submit to blockchain
const txHash = await wallet.submitTx(signed.cbor);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dexhunter.gitbook.io/dexhunter-partners/api-reference/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
