# Cancel an offer

`POST /forwards/offers/{boxId}/cancel` · Lithos client API · Difficulty Forwards · requires the `api_key` header

Source: https://lithosprotocol.org/docs/api/cancel-df-offer

Return one of this wallet's offers, its LIT and ERG, to its maker address. A fill sent before the cancel can still confirm first, and the cancel is then dropped. No body.

## Parameters

| Name | In | Type | Required | Description |

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

| `boxId` | path | string | yes | Offer box id, as listed by `GET /forwards/offers` or `GET /forwards/positions`. |

## Responses

### 200: Result of the cancel transaction

`DFCancelResult`

- `txId` (string, required)
- `outcome` (string, required, one of accepted, rejected, uncertain)
- `returnedLit` (string, required)
- `returnedNanoErgs` (string, required)
- `networkFee` (string, required)

### 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 unspent offer made by this wallet has 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: An unconfirmed transaction already spends the offer.

`ApiError`

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

### 422: Neither the offer nor the wallet can 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, wallet or transaction engine unavailable, or the request ran out of time. The message says whether anything was sent. When it says the outcome is unknown, check this wallet's offers and positions before retrying.

`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/forwards/offers/{boxId}/cancel" \
  -H "api_key: $LITHOS_API_KEY"
```

## Example response

```json
{
  "txId": "string",
  "outcome": "accepted",
  "returnedLit": "string",
  "returnedNanoErgs": "string",
  "networkFee": "string"
}
```
