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

# Get quote

### What `/quote` returns

`GET /quote` returns the best route and expected output amount.

It does not return transaction calldata.

### Request parameters

* `tokenIn` — input token address.
* `tokenOut` — output token address.
* `amount` — input amount in raw units.
* `slippageBps` — optional slippage in basis points. Default: `50`.
* `excludeSources` — optional comma-separated source IDs.

### Example request

```bash
curl "https://api.dirol.io/api/v1/quote?tokenIn=0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A&tokenOut=0x754704Bc059F8C67012fEd69BC8A327a5aafb603&amount=1000000000000000000"
```

### Example response

```json
{
  "tokenIn": "0x3bd359c1119da7da1d913d1c4d2b7c461115433a",
  "tokenOut": "0x754704bc059f8c67012fed69bc8a327a5aafb603",
  "amountIn": "1000000000000000000",
  "amountOut": "385274",
  "routes": [
    {
      "pool": "0xab12...ef34",
      "poolType": "V3",
      "tokenIn": "0x3bd359c1119da7da1d913d1c4d2b7c461115433a",
      "tokenOut": "0x754704bc059f8c67012fed69bc8a327a5aafb603",
      "tokenInSymbol": "WMON",
      "tokenOutSymbol": "USDC",
      "factory": "CapricornV3",
      "factoryAddress": "0x...",
      "amountIn": "1000000000000000000",
      "amountOut": "385274",
      "weight": 10000
    }
  ],
  "priceImpactBps": 12,
  "amountInUsd": "0.39",
  "amountOutUsd": "0.39"
}
```

### JavaScript example

```javascript
const params = new URLSearchParams({
  tokenIn: "0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A",
  tokenOut: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
  amount: "1000000000000000000",
  slippageBps: "50"
});

const res = await fetch(`https://api.dirol.io/api/v1/quote?${params}`);
const quote = await res.json();

console.log(quote.amountOut);
console.log(quote.routes);
```

### How to read `routes`

Each item in `routes` is one swap step.

#### Direct route

A direct route has one step.

The step moves from `tokenIn` to `tokenOut` through one pool.

#### Multi-hop route

A multi-hop route has multiple steps.

The `tokenOut` of one step matches the `tokenIn` of the next.

Example:

* Step 1: `USDT -> WMON`
* Step 2: `WMON -> USDC`

#### Split route

A split route uses multiple pools for the same swap.

In that case, steps can share the same `tokenIn` and `tokenOut` but use different pools.

Use `weight` to see each split in basis points.

* `10000` means `100%`
* `6000` means `60%`
* `2500` means `25%`

### Excluding sources

Pass source IDs in `excludeSources` to skip specific venues.

```bash
curl "https://api.dirol.io/api/v1/quote?tokenIn=0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A&tokenOut=0x754704Bc059F8C67012fEd69BC8A327a5aafb603&amount=1000000000000000000&excludeSources=Kuru,CapricornV3"
```

### Notes

* `amount` must be an integer string in raw units.
* `amountOut` is the optimized output estimate.
* `priceImpactBps` is the estimated price impact.
* Use `/swap` when you need an executable transaction.
