# Create an embedded components session.

> Gives your server a `client_secret` for `WajubConnect.init({ fetchClientSecret })`, the script at `loader_url`, served on your sellers' address. The secret works once, before `expires_at` (5 minutes), from a page on an origin you declared in Settings › Sync › Platform; the session it opens lasts 30 minutes and the loader asks for a new secret when it ends. It shows this one seller only the components you turn on, read-only except the features you turn on: changing the payout account (`account.features.edit_payout_account`) always takes a code sent to the seller.

`POST https://api.wajub.com/accounts/{id}/embedded_sessions`

Gives your server a `client_secret` for `WajubConnect.init({ fetchClientSecret })`, the script at `loader_url`, served on your sellers' address. The secret works once, before `expires_at` (5 minutes), from a page on an origin you declared in Settings › Sync › Platform; the session it opens lasts 30 minutes and the loader asks for a new secret when it ends. It shows this one seller only the components you turn on, read-only except the features you turn on: changing the payout account (`account.features.edit_payout_account`) always takes a code sent to the seller.

The answer always lists the six components, each with `enabled` and its features, whether you turned it on or not.

`Origin` protects the components in a browser: the secret is claimed only from a page on an origin you declared. It is no secret of its own: a server holding a client secret can send any `Origin`. Keep the client secret on your server until your page asks for it, and revoke a seller's sessions when you need them closed (`POST /accounts/{id}/embedded_sessions/revoke`).

`lite` accounts take every component; `relay` accounts `payouts`, `balance` and `notifications`; `direct` accounts are refused (`account_type_not_embeddable`): the merchant has their own dashboard. Called with your own secret key, never with `X-Sync`; a restricted key is refused.

## Path parameters

- `id` (string, required): The subaccount `id`.

## Body (application/json)

- `components` (object, required): The components to turn on: keys among `notifications`, `payments`, `payouts`, `balance`, `account`, `disputes`, at least one with `enabled: true`.
  - `components.notifications` (object): The actions waiting for the seller, for the top of your pages.
    - `components.notifications.enabled` (boolean): Turn the component on. Defaults to `false`.
  - `components.payments` (object): The seller's sales, with fees, commission, status and refunds, and the detail of each one (Lite only).
    - `components.payments.enabled` (boolean): Turn the component on. Defaults to `false`.
    - `components.payments.features` (object): The component's features, all off unless turned on.
      - `components.payments.features.refund_management` (boolean): Reserved: `true` is refused with `feature_not_available` for now.
  - `components.payouts` (object): The payouts Wajub sent, what each one settles, the next payout, what holds payouts back, and the yearly statements.
    - `components.payouts.enabled` (boolean): Turn the component on. Defaults to `false`.
  - `components.balance` (object): Available, pending, kept in reserve, held until delivery; for a Relay seller, their dues.
    - `components.balance.enabled` (boolean): Turn the component on. Defaults to `false`.
  - `components.account` (object): The seller's identity check and payout account (Lite only).
    - `components.account.enabled` (boolean): Turn the component on. Defaults to `false`.
    - `components.account.features` (object): The component's features, all off unless turned on.
      - `components.account.features.edit_payout_account` (boolean): Let the seller change their payout account from the component, after a code sent to the owner of their space: never your word alone.
  - `components.disputes` (object): The disputes on the seller's sales (Lite only), and their answer when the account's `dispute_handling` lets them give it (`seller` or `both`); read-only with `platform`.
    - `components.disputes.enabled` (boolean): Turn the component on. Defaults to `false`.

## Responses

- `201`: Created
- `400`: Bad Request
- `403`: A restricted key
- `404`: Not Found
- `409`: Conflict

## Example response (201)

```json
{
  "code": 201,
  "status": "Created",
  "message": "Embedded session created",
  "embedded_session": {
    "id": "es_0193f3c2a1b47c9e8d2f5a6b7c8d9e0f",
    "client_secret": "es_0193f3c2a1b47c9e8d2f5a6b7c8d9e0f_secret_…",
    "expires_at": "2026-11-20T10:05:00+00:00",
    "account_type": "lite",
    "components": {
      "notifications": {
        "enabled": true,
        "features": {}
      },
      "payments": {
        "enabled": true,
        "features": {
          "refund_management": false
        }
      },
      "payouts": {
        "enabled": true,
        "features": {}
      },
      "balance": {
        "enabled": false,
        "features": {}
      },
      "account": {
        "enabled": false,
        "features": {
          "edit_payout_account": false
        }
      },
      "disputes": {
        "enabled": false,
        "features": {}
      }
    },
    "loader_url": "https://acme.wajub.app/embed/v1.js"
  }
}
```
