# Flush pending fees to the vault

`POST /dex/flush` · Lithos client API · Lithos Dex · requires the `api_key` header

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

Move the pool's pending fees into the vault, making them claimable. Anyone may call it and it pays the caller nothing. Returns 400 when nothing is pending. The body is optional.

## Request body

`LDFlushRequest`, application/json.

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

## Responses

### 200: Result of the flush transaction

`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 pending to flush.

`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 vault moved. Re-read and try again.

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

### 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/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"
}
```
