# Create a coinflip table

> Create a coinflip-table order: stake one asset, flip after confirmation, a win pays the same asset (supply your own sessionId only with a valid integrator key)

`POST /v2/coinflips`

Create a coinflip-table order: stake one asset, flip after confirmation, a win pays the same asset (supply your own sessionId only with a valid integrator key).

**Authentication:** None required. Optional: [integrator key](https://docs.wagyu.xyz/authentication.md) in `X-Integrator-Key`.

## Request body

- `asset` · `"xmr"` · `"btc"` · `"sol"` · `"eth"` · `"zec"` · **required** — Coinflip-table pool asset key, never a display symbol.
- `toAddress` · string — Same-chain native address the balance is paid to. Optional at open: name it at cash-out instead.
- `sessionId` · string (pattern `^[0-9a-f-]{16,64}$`) — Optional session credential for an integrator to group its own orders. Requires a valid integrator API key.
- `refundAddress` · string (max 256) — Refund destination. Its chain-specific validity is checked by the engine.

## Response

`200` returns an object with:

- `orderId` · string · **required**
- `sessionId` · string · **required**
- `product` · `"coinflip"` · **required**
- `asset` · `"xmr"` · `"btc"` · `"sol"` · `"eth"` · `"zec"` · **required** — Coinflip-table pool asset key, never a display symbol.
- `maxPayoutUsd` · number
- `status` · `"awaiting_deposit"` · `"awaiting_xmr1"` · `"awaiting_trx1"` · `"awaiting_zec1"` · `"processing"` · `"completed"` · `"failed"` · `"expired"` · `"refunded"` · `"needs_review"` · **required**
- `customerState` · one of the variants below · **required** — Authoritative customer display/action state. Clients must not infer lifecycle from status or resource presence.
  - **kind = "awaiting_deposit"**
  - **kind = "processing"**
  - **kind = "action_required"**
  - **kind = "paused"**
  - **kind = "completed"**
  - **kind = "refunded"**
  - **kind = "expired"**
  - **kind = "failed"**
- `destination` · string
- `depositAddress` · string · **required**
- `depositAddressForms` · array of object
  - `kind` · `"shielded"` · `"transparent"` · **required**
  - `address` · string · **required**
- `expiresAt` · string · **required**
- `minAtomic` · string · **required** — Smallest accepted stake, in atomic units of the asset.
- `feePercent` · number · **required** — Intake fee percent skimmed from the stake before the flip.
- `edgePercent` · number · **required** — House band percent; the win chance per side is (100 − edge) / 2.

Errors use the [standard error envelope](https://docs.wagyu.xyz/actions-and-retries.md#the-error-envelope): branch on `code`, never on the message.

## Example

<!-- curl -->
```bash
curl -X POST 'https://api-beta.wagyu.xyz/v2/coinflips' \
  -H 'content-type: application/json' \
  -d '{
    "asset": "xmr",
    "toAddress": "<your-monero-address>"
  }'
```

<!-- JavaScript -->
```javascript
const res = await fetch('https://api-beta.wagyu.xyz/v2/coinflips', {
  method: 'POST',
  headers: {"content-type":"application/json"},
  body: JSON.stringify({
    "asset": "xmr",
    "toAddress": "<your-monero-address>"
  }),
});
const data = await res.json();
```

<!-- Python -->
```python
import requests

res = requests.post('https://api-beta.wagyu.xyz/v2/coinflips', json={
        "asset": "xmr",
        "toAddress": "<your-monero-address>"
    }, timeout=30)
data = res.json()
```

_No response is captured for this route: calling it creates or changes a real order. The response fields above come from the live contract._

---
Source: https://docs.wagyu.xyz/api-reference/create-coinflip-order · Built from the live Wagyu API on 2026-11-04.
