# Fill an offer

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

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

Take the other side of an offer: this wallet adds its margin plus 7.5 LIT and the position's ERG, and a position holding both sides is created. Refused when the fill would not be accepted in the next block. 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 fill transaction

`DFFillResult`

- `txId` (string, required)
- `outcome` (string, required, one of accepted, rejected, uncertain)
- `positionBoxId` (string, required)

### 400: `boxId` is not a box id.

`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 unspent offer 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. Re-read `GET /forwards/offers`.

`ApiError`

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

### 422: The offer is this wallet's own, short of the maker's side, expired, outside its window's lead for the next block, over the short-window limit, or the wallet cannot cover the fill.

`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}/fill" \
  -H "api_key: $LITHOS_API_KEY"
```

## Example response

```json
{
  "txId": "string",
  "outcome": "accepted",
  "positionBoxId": "string"
}
```
