# Exchange an embed session

`POST /v1/embed/sessions/{token}/exchange`

Called by Assinafy's embed page, not by integrations. Public: the token is the credential. Trades a session token for the signer's access code, once; the token is spent even when the call is refused with `409`. An unknown, expired or already used token returns `410` with code `embed_session_invalid`. Returns `409` when the signer or document can no longer sign.

**Authentication:** none (public endpoint).

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `token` | path | string | yes | The 64-character session token from the embed URL. |

## Request Body

Fields (`application/json`):

- `parent_origin` (string) — The origin of the page hosting the iframe, recorded for audit.

Example:

```json
{
    "parent_origin": "https://app.example.com"
}
```

## Responses

### 200 — The signing session

```json
{
    "data": {
        "signer_access_code": "string",
        "signer_id": "6f1c2a9e0b",
        "document_id": "5e0b1c2a9f",
        "verification_method": "Email",
        "embed_origins": [
            "https://app.example.com"
        ]
    },
    "status": 200,
    "message": ""
}
```

### 409 — The signer or document can not sign right now (`already_signed`, `document_not_ready`, `document_unavailable`).

### 410 — Unknown, expired or already used token (`embed_session_invalid`).

### 500 — Unexpected server error.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```
