> ## Documentation Index
> Fetch the complete documentation index at: https://docs.floprouter.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Settlement

> Timing, session states, and how to follow a payment channel to its final state on chain.

Each request opens one payment channel. Its life on devnet:

| Step | Typical time |
| - | - |
| Miner chosen, channel opened | a few seconds |
| Verified reply | about 15 to 50 s after the request, sometimes longer |
| Settlement final on chain | 2 to 4 minutes after the reply, in the background |

## When the call returns

A non-streaming call returns as soon as the reply is verified, with `flop.status: "settling"`. The settlement continues in the background.

To wait for the settlement instead, send `"flop": {"wait_for_settlement": true}`. The call then returns once the settlement is final, with `miner_paid` set, but no later to the response deadline below.

### The response deadline

Some proxies drop responses that stay idle for long. So a non-streaming call answers within a fixed deadline (85 s on this server). If no verified reply has arrived by then, it returns `202` instead of failing:

```json theme={null}
{
  "id": "gen-...",
  "object": "chat.completion.pending",
  "status": "pending",
  "message": "no verified reply within 85 s; the session continues. Poll GET /v1/sessions/gen-... until reply is set, or use stream: true.",
  "poll": "/v1/sessions/gen-...",
  "flop": {"session_id": "gen-...", "status": "running"}
}
```

The session keeps running. Poll `GET /v1/sessions/{id}` with the same key until `reply` is set. Streaming avoids this case entirely.

## Following a session

```bash theme={null}
curl https://api.floprouter.com/v1/sessions/<session_id>
```

| `status` | Meaning |
| - | - |
| `running` | The request is in progress. |
| `settling` | The reply was delivered. The settlement is not final yet. |
| `settled` | The miner was paid on chain. `miner_paid` and `on_chain.outcome_tx` are set. |
| `refunded` | The escrow went back to the payer. |
| `recovering` | The miner went silent after the channel opened. The router is closing the channel on chain. |
| `failed` | No attempt produced output. |
| `fraud`, `voided` | Final outcomes decided on chain. |

`on_chain` holds the open block, the outcome, the outcome block and the transaction. With the key that made the request, the record also carries `reply`: the verified reply, once there is one. Look the channel up on the explorer: `https://explorer.devnet.flop.network/channels/<channel_id>`.

## When a miner goes silent

The router watches every channel it opened. If a channel stays open past its deadlines, the router sends the matching recovery call on chain (`expire_force_open`, `timeout`, `force_settle` or `finalize`). These calls are open to anyone on FLOP; the router pays their transaction fees. The session's `attempts[].recovery` lists what was sent.

## One channel per request

A multi-turn conversation is one request per turn, each with its own channel. Send the whole history in `messages` each time, as with any chat API.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.