# Quote a direct swap on any pool

`POST /dex/pools/{poolNft}/swap/check` · Lithos client API · Lithos Dex

Source: https://lithosprotocol.org/docs/api/check-ld-pool-direct-swap

What a swap spending the pool now would return, with its price impact and fees. No executor is paid; the wallet pays the network fee.

## Parameters

| Name | In | Type | Required | Description |

|---|---|---|---|---|

| `poolNft` | path | string | yes | The pool's NFT id, 64 hex characters |

## Request body

`LDPoolSwapRequest`, application/json.

- `tokenIn` (string, required): ERG, or one of the pool's tokens
- `amountIn` (string, required): Base units sold
- `executorFee` (string): nanoERG the filler keeps. Omitted, from lithosdex.orders.
- `maxMinerFee` (string): Most of the executor fee a broadcast fill may pay as a network fee. Below executorFee.

## Responses

### 200: The quote

`LDPoolDirectSwapQuote`

- `poolNFT` (string, required)
- `tokenIn` (string, required)
- `tokenOut` (string, required)
- `amountIn` (string, required)
- `amountOut` (string, required)
- `minAmountIn` (string): The least input that still buys `amountOut`. Absent when nothing comes out.
- `executable` (boolean, required)
- `priceImpact` (number · double, required): How far the swap falls short of the pool's price before it, fees included, as a fraction.
- `protocolFee` (string, required): Of `tokenIn`, set aside for the pool's providers.
- `ammFee` (string, required): Of `tokenIn`, the curve's own fee, which stays in the reserves.
- `networkFee` (string, required)
- `poolBoxId` (string, required): The pool box quoted against, to send back as `expectedPoolBoxId`.

### 400: The request is malformed, names a token the pool does not hold, or leaves out an acknowledgement it needs.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 404: No LithosDex pool with that NFT, or no live provision with that id.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 422: The pool can be drained, the pool cannot fill this at its depth or above the floor, or the wallet cannot cover it.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

### 503: Node or wallet unavailable. Retry.

`ApiError`

- `error` (integer, required): Error code
- `reason` (string, required): Error message explaining the reason of the error
- `detail` (string, required): Detailed error description

## Example request

```bash
curl -X POST "http://localhost:9000/dex/pools/{poolNft}/swap/check" \
  -H "Content-Type: application/json" \
  -d '{ "tokenIn": "ERG", "amountIn": "1000000000", "executorFee": "string", "maxMinerFee": "string" }'
```

## Example response

```json
{
  "poolNFT": "string",
  "tokenIn": "string",
  "tokenOut": "string",
  "amountIn": "string",
  "amountOut": "string",
  "minAmountIn": "string",
  "executable": true,
  "priceImpact": 0,
  "protocolFee": "string",
  "ammFee": "string",
  "networkFee": "string",
  "poolBoxId": "string"
}
```
