# Resize a provision

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

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

Change a provision's size without closing it. Bound it with `maxAmountX` / `maxAmountY` when increasing or `minAmountX` / `minAmountY` when decreasing. The provision gets a new box id, returned as `boxId`.

## Parameters

| Name | In | Type | Required | Description |

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

| `boxId` | path | string | yes | UTXO id of the provision box |

## Request body

`LDResizeRequest`, application/json.

- `newShares` (string, required): Size the provision should become. Must be positive — a resize to zero is a redemption. Decimal string. 
- `maxAmountX` (string): Most you will contribute on the ERG side, when increasing. Decimal string.
- `maxAmountY` (string): Most you will contribute on the token side, when increasing. Decimal string.
- `minAmountX` (string): Least you will take back on the ERG side, when decreasing. Decimal string.
- `minAmountY` (string): Least you will take back on the token side, when decreasing. Decimal string.
- `expectedPoolBoxId` (string): The pool box this was quoted against
- `expectedVaultBoxId` (string): Vault box the quote was made against. A resize also flushes.
- `expectedProvisionBoxId` (string): The provision box this was quoted against

## Responses

### 200: Result of the resize transaction

`LDResizeResult`

- `outcome` (string, required, one of accepted, rejected, uncertain): Node submission outcome; uncertain retains the known transaction ID and input ownership.
- `boxId` (string, required): New provision box id. Use it for the next request.
- `newShares` (string, required)
- `amountX` (string, required)
- `amountY` (string, required)
- `txId` (string, required)

### 400: Malformed body, or `newShares` is not a different positive size.

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

### 409: The pool, vault or provision moved. Re-read and quote 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: Falls outside the given bounds, or the pool refuses the resize.

`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/provisions/{boxId}/resize" \
  -H "api_key: $LITHOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "newShares": "20000000000", "maxAmountX": "31875000000", "maxAmountY": "963000000", "minAmountX": "21250000000", "minAmountY": "642000000", "expectedPoolBoxId": "a1f4c2e8b7d93052416fbc8e07d21935a8c4f60b2e91d7385c06a4b1f2e83d97", "expectedVaultBoxId": "88c297f99da7172f6aa20efbead69aa40e2b7734a1873d66ca1db6b19d214db6", "expectedProvisionBoxId": "ce00d6e0f4fd3390c0519bb0d24824e1e6b06978163f4845a7cf2c1c7d8f1b65" }'
```

## Example response

```json
{
  "outcome": "accepted",
  "boxId": "ce00d6e0f4fd3390c0519bb0d24824e1e6b06978163f4845a7cf2c1c7d8f1b65",
  "newShares": "20000000000",
  "amountX": "31875000000",
  "amountY": "963000000",
  "txId": "40b7d045a858d537cdbf072e46ffbb86c0c9f6b0e93c369c1ffcba76797636d7"
}
```
