# Quote API reference

The quote API returns the best swap it can build on PulseChain: the amount out, a gas estimate and ready-to-send transaction data. Two endpoints, one request shape, no API key.

- **POST `/quotes`** — the standard routing algorithm: fast, and enough for common swaps.
- **POST `/quotes/advanced`** — a deeper route search: better multi-hop optimisation, better for large swaps and illiquid pairs, slightly slower.

## Base URL

```
https://quotes.pulseswap.io/api/v2
```

All endpoints are relative to that base, and every request carries `Content-Type: application/json`.

Both endpoints answered 200 when this page was written (August 2026). The `/quotes/best` endpoint that older documentation mentions does **not** exist — it answers 404. Use `/quotes` or `/quotes/advanced`.

## POST /quotes

A quote from the standard routing algorithm.

```ts
{
  chainId: number;
  platform: string;
  fromToken: string;
  toToken: string;
  amountIn: string;
  slippage: number;
  userAddress?: string;
  amountUSD?: number;
  extra?: {
    tokenInPrice?: number;
    tokenOutPrice?: number;
    gasPrice?: string;
    gasTokenPrice?: number;
  };
}
```

### Request schema

| Field                 | Type   |          | Description                                                                           |
| --------------------- | ------ | -------- | ------------------------------------------------------------------------------------- |
| `chainId`             | number | required | Must be `369` (PulseChain).                                                           |
| `platform`            | string | required | DEX platform identifier — see Platforms below.                                        |
| `fromToken`           | string | required | Source token address (42-character EVM address). Use `0x000…000` for native PLS.      |
| `toToken`             | string | required | Destination token address (42-character EVM address). Use `0x000…000` for native PLS. |
| `amountIn`            | string | required | Amount in wei / the token's smallest unit, as a string.                               |
| `slippage`            | number | required | Maximum allowed slippage, `0.0` to `100.0`.                                           |
| `userAddress`         | string | optional | EVM address the transaction data is built for.                                        |
| `amountUSD`           | number | optional | USD amount, for analytics.                                                            |
| `extra`               | object | optional | Additional pricing & gas parameters.                                                  |
| `extra.tokenInPrice`  | number | optional | Price of the input token in USD.                                                      |
| `extra.tokenOutPrice` | number | optional | Price of the output token in USD.                                                     |
| `extra.gasPrice`      | string | optional | Gas price in wei, as a string.                                                        |
| `extra.gasTokenPrice` | number | optional | Gas token price in USD.                                                               |

### Response schema

```ts
{
  success: boolean;
  data: {
    success: boolean;
    quoteId: string;
    amountIn: string;
    amountOut: string;
    amountOutUSD: string;
    gasEstimate: number;
    tx?: {
      from: string;
      to: string;
      data: string;
      value: string;
    };
  };
  message: string;
  timestamp: string;
}
```

### Example

```bash
curl -X POST https://quotes.pulseswap.io/api/v2/quotes \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 369,
    "platform": "pulsex_v2",
    "fromToken": "0xA1077a294dDE1B09bB078844df40758a5D0f9a27",
    "toToken": "0x95B303987A60C71504D99Aa1b13B4DA07b0790ab",
    "userAddress": "0x742d35Cc6634C0532925a3b8D221691B5c1b6b29",
    "amountIn": "1000000000000000000",
    "amountUSD": 1000.0,
    "slippage": 0.5,
    "extra": {
      "tokenInPrice": 1.0,
      "tokenOutPrice": 1.0,
      "gasPrice": "12345667890",
      "gasTokenPrice": 1.0
    }
  }'
```

```json
{
  "success": true,
  "data": {
    "success": true,
    "quoteId": "64fb81ce-ca44-437f-bfdd-b146403d18f9",
    "amountIn": "1000000000000000000",
    "amountOut": "1116325470237279900",
    "amountOutUSD": "1.115302211899885",
    "gasEstimate": 121948,
    "tx": {
      "from": "0x742D35Cc6634C0532925A3B8D221691b5C1b6b29",
      "to": "0xC994375187988C751C8fCb96A68A0f242947f0E6",
      "data": "0x2d09aed500000000000000…",
      "value": "0"
    }
  },
  "message": "OK",
  "timestamp": "2026-08-12T19:48:15.597696707Z"
}
```

Both example responses on this page are real captures from the live service, with `tx.data` truncated. Both pass `extra` prices, deliberately: without them the service still quotes but answers with `amountIn "0"`, `amountOutUSD "0"` and `gasEstimate 0` — it cannot value what it cannot price.

## Supported platforms

`platform` selects the routing logic. It is case-sensitive, and `mixed` is the one that searches across DEXes rather than inside a single one.

| Platform        | DEX type | Description         |
| --------------- | -------- | ------------------- |
| `pulsex_v1`     | UniV2    | PulseX V1           |
| `pulsex_v2`     | UniV2    | PulseX V2           |
| `pulsex_stable` | Stable   | PulseX Stable       |
| `9inch_v2`      | UniV2    | 9inch v2            |
| `9inch_v3`      | UniV3    | 9inch v3            |
| `9mm_v2`        | UniV2    | 9mm v2              |
| `9mm_v3`        | UniV3    | 9mm v3              |
| `phux_v2`       | BalV2    | Phux.io             |
| `tide_v3`       | BalV3    | 0xTide              |
| `mixed`         | Mixed    | Cross-DEX routing   |

## POST /quotes/advanced

The same request and response schema as `/quotes`, with a more exhaustive search:

- deeper route exploration
- better multi-hop optimisation
- better for large swaps or illiquid pairs
- slightly slower

```bash
curl -X POST https://quotes.pulseswap.io/api/v2/quotes/advanced \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 369,
    "platform": "mixed",
    "fromToken": "0xA1077a294dDE1B09bB078844df40758a5D0f9a27",
    "toToken": "0x95B303987A60C71504D99Aa1b13B4DA07b0790ab",
    "userAddress": "0x742d35Cc6634C0532925a3b8D221691B5c1b6b29",
    "amountIn": "1000000000000000000",
    "amountUSD": 1000.0,
    "slippage": 0.5,
    "extra": {
      "tokenInPrice": 1.0,
      "tokenOutPrice": 1.0,
      "gasPrice": "12345667890",
      "gasTokenPrice": 1.0
    }
  }'
```

```json
{
  "success": true,
  "data": {
    "success": true,
    "quoteId": "119894cf-1d73-4728-81c0-3786aa7c43a1",
    "amountIn": "1000000000000000000",
    "amountOut": "1139200458120526767",
    "amountOutUSD": "1.130490564732796",
    "gasEstimate": 744566,
    "tx": {
      "from": "0x742D35Cc6634C0532925A3B8D221691b5C1b6b29",
      "to": "0xC994375187988C751C8fCb96A68A0f242947f0E6",
      "data": "0x2d09aed500000000000000…",
      "value": "0"
    }
  },
  "message": "OK",
  "timestamp": "2026-08-12T09:37:58.770168918Z"
}
```

## Validation rules

- **Chain ID** — must be `369` (PulseChain).
- **Token addresses** — valid 42-character EVM addresses; `0x000…000` is native PLS, which the service wraps to WPLS for you.
- **Amount** — a positive integer string in wei.
- **Slippage** — between `0.0` and `100.0`.
- **Platform** — one of the identifiers above, case-sensitive.
- **User address** — optional, but must be a valid EVM address when present.

## Errors

Validation failures answer `400` with an `error` string and the status repeated in the body. A `platform` the service does not know is rejected one layer earlier — by the JSON deserialiser, with `422` and a plain-text body listing the accepted values.

```
// HTTP 400 — unsupported chain
{ "error": "Unsupported chain_id: 1. Only PulseChain (369) is supported", "status": 400 }

// HTTP 400 — token address of the wrong length
{ "error": "Validation failed: fromToken: Validation error: length […]", "status": 400 }

// HTTP 400 — slippage outside [0.0, 100.0]
{ "error": "Validation failed: slippage: Validation error: range […]", "status": 400 }

// HTTP 422 — unknown platform (rejected before validation, plain text)
platform: unknown variant `invalid_platform`, expected one of `pulsex_v1`, …
```

**Do not branch on a `success` field for errors.** It exists on _successful_ responses only; an error body carries `error` and `status` instead. Branch on the HTTP status code, then read `error`. (Older documentation shows an error envelope with `success`, `data` and `message` — the live service does not send one.)

## Rate limits & CORS

- **60 requests per minute per IP.** Requests from `pulseswap.io` and `pulsecoinlist.com` bypass the limit.
- **CORS is open.** Responses carry `Access-Control-Allow-Origin: *` and preflight `OPTIONS` is answered automatically, so the API can be called straight from a browser.

## Best practices

- **Slippage** — 0.1–0.5% for stablecoins, 1–3% for volatile assets.
- **Platform choice** — `pulsex_v2` or `9inch_v2` for standard swaps, `pulsex_stable` for stablecoins, `9inch_v3` / `9mm_v3` for concentrated liquidity, and `mixed` for the best overall price.
- **Execution** — quotes are short-lived. Fetch, then send promptly, and validate the gas cost against the size of the trade.
- **Amounts** — always send `amountIn` as a string; a large wei value does not survive a JavaScript number.
- **Transaction data** — `tx` comes back built for the address in `userAddress`; omit it and `tx.from` falls back to the zero address, which is not sendable.
- **Errors** — check the HTTP status, handle validation failures explicitly, and log `quoteId` when you need support to trace a quote.
- **Gas estimates are approximate** — treat `gasEstimate` as a planning figure, not a limit to send as-is.

---

Canonical HTML page: <https://pulseswap.io/docs/api>
