> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# redeem

> Exchange a handoff nonce for a chat handle, ending the call first.

[ref-handoffrouter]: /docs/server-sdks/reference/python/agents/handoff-router

[mint-handle]: /docs/server-sdks/reference/python/agents/chat-gateway/mint-handle

Exchange a nonce for a chat handle. Single use: the nonce is consumed even if a later step fails.
Ends the call through `end_call` when the nonce was registered with a call ID and `end_call` is
configured, waits for `capture_leg` to confirm the voice leg's record, and only then issues a handle for a new leg of the same conversation via the gateway's
[`mint_handle()`][mint-handle]. This is what `POST /handoff` calls.

## Parameters

**`nonce`** `str` — required

The nonce the browser presented.

---

## Returns

`str | None` -- The signed handle, or `None` for an unknown, expired, or already-redeemed nonce.
The three cases are deliberately indistinguishable.

## Example

```python
handle = await handoff.redeem(nonce)
if handle is None:
    return {"error": "not found"}, 404
return {"handle": handle}
```

See [`HandoffRouter`][ref-handoffrouter] for the route this backs.