# Create a lend offer

`POST /sigmafi/zc/offers` · Lithos client API · SigmaFi ZC Standard · requires the `api_key` header

Source: https://lithosprotocol.org/docs/api/create-zc-offer

Post a `LendOffer` that batchers fill from orders and asks it accepts.

## Request body

`ZcOfferRequest`, application/json.

- `market` (string, required, one of ERG, SigUSD)
- `capital` (string, required)
- `minYieldBps` (integer · int64, required)
- `curve` (ZcPoint[]): Blocks strictly increasing.
  - `blocks` (integer · int64, required): Blocks left to maturity.
  - `bps` (integer · int64, required): Simple yield per 262,800 blocks, in bps.
- `minBlocks` (integer · int64)
- `maxBlocks` (integer · int64)
- `floorBps` (integer · int64, required): Least cover a bond it buys must have.
- `oracleAge` (integer · int64): Default 30.
- `expiry` (integer · int64)
- `reserveNanoErg` (string): The fee reserve each new bond gets. Default 50000000.
- `minPrice` (string): Default 1.
- `erg` (object): An ERG offer's batcher fee per fill. It must leave more than 0.001 ERG of the capital, and an expiry refund pays it too.
  - `batcherFeeNanoErg` (string)
- `token` (object): A SigUSD offer's refund fee, ERG funding, least fill and reward budget.
  - `refundFeeNanoErg` (string)
  - `ergFundingNanoErg` (string)
  - `minFillBps` (integer · int64)
  - `rewardBudgetNanoErg` (string)
- `shareBounds` (object): null buys no shares.
  - `floorBps` (integer · int64)
  - `maxExpiry` (integer · int64)
- `delivery` (object): `{ kind: unit }`, or `{ kind: selective or dutch, openingBps, floorBps, length, expiry, mintFeeNanoErg, pullFeeNanoErg, shareCount }`, checked and defaulted as a fractionalize body is.
- `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/offers" \
  -H "api_key: $LITHOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "market": "ERG", "capital": "string", "minYieldBps": 0, "curve": [ { "blocks": 0, "bps": 0 } ], "minBlocks": 0, "maxBlocks": 0, "floorBps": 0, "oracleAge": 0, "expiry": 0, "reserveNanoErg": "string", "minPrice": "string", "erg": { "batcherFeeNanoErg": "string" }, "token": { "refundFeeNanoErg": "string", "ergFundingNanoErg": "string", "minFillBps": 0, "rewardBudgetNanoErg": "string" }, "shareBounds": { "floorBps": 0, "maxExpiry": 0 }, "delivery": {}, "limits": { "maxPay": "string", "minReceive": "string" } }'
```

## Example response

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