# Liquidate a bond

`POST /sigmafi/zc/bonds/{assetId}/liquidate` · Lithos client API · SigmaFi ZC Standard · requires the `api_key` header

Source: https://lithosprotocol.org/docs/api/liquidate-zc-bond

Settle any bond into the vault from maturity on, or before it while its cover is under its own oracle ratio at a fresh enough oracle. This wallet keeps the fee reserve less the miner fee.

## Parameters

| Name | In | Type | Required | Description |

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

| `assetId` | path | string | yes | A bond asset id: the id of the order box its fill spent.  |

## Request body

`ZcLimitsOnly`, application/json.

- `limits` (ZcLimits): Bounds on the rebuilt transaction. For fills, buys, repays, recollateralizations and claims, amounts are in the action's market unit (nanoERG for ERG, fee included; raw units for SigUSD; nanoERG for actions with no market). For posts (orders, offers, asks, lots, fractionalize and wraps), `maxPay` is always in nanoERG (box value plus miner fee), since any token capital or collateral is fixed directly by the request body. Outside them the send answers 409. 
  - `maxPay` (string)
  - `minReceive` (string)

## Responses

### 200: The transaction was sent; `outcome` says whether the node accepted it.

`ZcResult`

- `txId` (string): None while the write is held.
- `outcome` (string, one of accepted, rejected, uncertain, held): The node's answer. `held`: the write reads the box a pending oracle refresh creates, and a miner could reach it before that refresh, so nothing was sent yet. The client tries it again every 30 seconds for 10 minutes, rebuilt and checked against `limits` each time, and sends it once the refresh confirms.
- `reason` (string): Why a write is held.
- `retriesUntil` (integer · int64): When a held write stops being tried (ms since the epoch).
- `boxId` (string): The transaction's first output.
- `assetId` (string): The bond asset a fill minted.
- `warnings` (string[])

### 400: A malformed field, or terms the contracts refuse.

`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 such box or token, or not this wallet's.

`ApiError`

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

### 409: A pending transaction already spends a box this needs, or the rebuilt transaction is outside `limits`. Re-quote and resend.

`ApiError`

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

### 422: Valid, but not possible now; the message gives the reason the check lists in `refusals`.

`ApiError`

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

### 503: ZC tracking is off or not seeded, or the node, its index or the wallet did not answer. Nothing was sent.

`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/sigmafi/zc/bonds/{assetId}/liquidate" \
  -H "api_key: $LITHOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "limits": { "maxPay": "string", "minReceive": "string" } }'
```

## Example response

```json
{
  "txId": "string",
  "outcome": "accepted",
  "reason": "string",
  "retriesUntil": 0,
  "boxId": "string",
  "assetId": "string",
  "warnings": [
    "string"
  ]
}
```
