# Claim a provision's fees on any pool

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

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

Settles one of this wallet's provisions on the pool against the pool's vault, paying what the vault owes it. Needs the provision's `ownerNFT` in this wallet and a vault flushed since the provision last claimed. The provision gets a new box id, returned as `successorBoxId`. Open on every pool, whatever its genesis. The body is optional; every field bounds the claim.

## Parameters

| Name | In | Type | Required | Description |

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

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

| `boxId` | path | string | yes | The provision box to settle |

## Request body

`LDClaimRequest`, application/json.

- `expectedVaultBoxId` (string): The vault box this was quoted against
- `expectedProvisionBoxId` (string): The provision box this was quoted against
- `minAmountX` (string): Least you will accept on the ERG side. Decimal string.
- `minAmountY` (string): The same on the token side. Decimal string.

## Responses

### 200: The claim

`LDClaimResult`

- `outcome` (string, required, one of accepted, rejected, uncertain): Node submission outcome; uncertain retains the known transaction ID and input ownership.
- `claimedX` (string, required): nanoERG paid out of the vault. Decimal string.
- `claimedY` (string, required): Raw token units paid out of the vault. Decimal string.
- `successorBoxId` (string, required): New provision box id. Use it for the next request.
- `txId` (string, required)

### 400: The provision has nothing to settle until the pool is flushed, or the vault cannot pay what it is owed.

`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, or no live provision of the pool 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

### 409: The vault or the provision moved since the quote, or another LithosDex mutation is running. Re-read 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 claim pays less than a minimum, or this wallet does not hold the provision's ownerNFT.

`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}/provisions/{boxId}/claim" \
  -H "api_key: $LITHOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "expectedVaultBoxId": "88c297f99da7172f6aa20efbead69aa40e2b7734a1873d66ca1db6b19d214db6", "expectedProvisionBoxId": "ce00d6e0f4fd3390c0519bb0d24824e1e6b06978163f4845a7cf2c1c7d8f1b65", "minAmountX": "253000000", "minAmountY": "7690000" }'
```

## Example response

```json
{
  "outcome": "accepted",
  "claimedX": "253000000",
  "claimedY": "7690000",
  "successorBoxId": "5035b2e112b4f5b873dd3444c01df1e7e697807fd84fe96790eacb128e46428d",
  "txId": "40b7d045a858d537cdbf072e46ffbb86c0c9f6b0e93c369c1ffcba76797636d7"
}
```
