# Simulate a draft

`POST /sigmafi/zc/simulate` · Lithos client API · SigmaFi ZC Standard

Source: https://lithosprotocol.org/docs/api/simulate-zc

Run the zcs1 batch over the market with a draft order, offer or ask added, or price a wallet lend across the best sources. Rate-limited per caller; 429 when over.

## Parameters

| Name | In | Type | Required | Description |

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

| `ifRevision` | query | integer · int64 | no | Answer 304 when the snapshot revision still equals this.  |

## Request body

`ZcSimulateRequest`, application/json.

- `draft` (object, required): A create-order, create-offer or create-ask body with `type` set to `order`, `offer` or `ask`; or `{ type: walletLend, market, amount, to, coverage }`. 

## Responses

### 200: The simulation

`ZcObject`

- `at` (ZcAt): The snapshot a read or quote was taken from.
  - `height` (integer)
  - `blockId` (string)
  - `indexedHeight` (integer)
  - `revision` (integer · int64): Changes whenever anything a read returns changes, the mempool included.
  - `cut` (boolean): True when the book is at its size cap and left boxes out.
  - `mempool` (boolean): Whether unconfirmed boxes are laid over the confirmed book.

### 304: Nothing changed since `ifRevision`.

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

### 429: Too many concurrent quotes, simulations, or heavy reads (`/curves`, `/orderbook`, `/fills`): at most 4 quotes/simulations and at most 4 heavy reads run or wait at once across all callers, and simulations are additionally limited to 5 in flight per caller, then 1 a second. Retry shortly.

`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/simulate" \
  -H "Content-Type: application/json" \
  -d '{ "draft": {} }'
```

## Example response

```json
{
  "at": {
    "height": 0,
    "blockId": "string",
    "indexedHeight": 0,
    "revision": 0,
    "cut": true,
    "mempool": true
  }
}
```
