# Flush any pool

`POST /dex/pools/{poolNft}/flush` · Lithos client API · Lithos Dex · requires the `api_key` header

Source: https://lithosprotocol.org/docs/api/flush-ld-pool

Moves the pool's pending fees into its vault, so providers can claim them. Permissionless, and it pays you nothing; the network fee comes from this wallet. Open on every pool. The body is optional.

## Parameters

| Name | In | Type | Required | Description |

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

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

## Request body

`LDFlushRequest`, application/json.

- `expectedPoolBoxId` (string)
- `expectedVaultBoxId` (string)

## Responses

### 200: The flush

`LDFlushResult`

- `outcome` (string, required, one of accepted, rejected, uncertain): Node submission outcome; uncertain retains the known transaction ID and input ownership.
- `flushedX` (string, required): nanoERG moved into the vault. Decimal string.
- `flushedY` (string, required): Raw token units moved into the vault. Decimal string.
- `txId` (string, required)

### 400: Nothing is pending, so the pool refuses a flush.

`ApiError`

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

### 403: Missing or wrong api_key

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

`ApiError`

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

### 409: The pool or the vault moved since the check, or another LithosDex mutation is running. Re-check and resend.

`LDStateChangedResponse`

- `error` (integer, required)
- `reason` (string, required)
- `detail` (string, required): What moved, and what it moved to
- `poolBoxId` (string): Current pool box id
- `vaultBoxId` (string): Current vault box id
- `provisionBoxId` (string): Current provision box id

### 422: The wallet cannot cover the network fee.

`ApiError`

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

### 503: The pool index is still building, or the node or wallet did not answer. Retry.

`ApiError`

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

### default: Error

`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}/flush" \
  -H "api_key: $LITHOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "expectedPoolBoxId": "a1f4c2e8b7d93052416fbc8e07d21935a8c4f60b2e91d7385c06a4b1f2e83d97", "expectedVaultBoxId": "88c297f99da7172f6aa20efbead69aa40e2b7734a1873d66ca1db6b19d214db6" }'
```

## Example response

```json
{
  "outcome": "accepted",
  "flushedX": "3180000000",
  "flushedY": "96400000",
  "txId": "40b7d045a858d537cdbf072e46ffbb86c0c9f6b0e93c369c1ffcba76797636d7"
}
```
