# 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.


---

# Agent Instructions: 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://dirolprotocols-organization.gitbook.io/dirol/api/get-quote.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.
