> This page is for version v2.
> For other versions, use one of these documentation indexes:
> - v1 (default): https://developers.outpave.com/v1/llms.txt
> - v2: https://developers.outpave.com/v2/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.outpave.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.outpave.com/_mcp/server.

# Collect verification documents

When an issuer asks for documents, `GET /accountHolders/{accountHolderId}/verification` lists them in `requirements`. The verification documents component shows each requirement in a frame on your page, takes the files and submits them. The files go from the user's browser to the API and never pass through your servers.

#### Register your origin

In the app, open **Settings**, then **Embedded components**, and add the origin of each page that shows the component.

* An origin is a scheme and host, plus a port only when it is not the default, such as `https://app.example.com`. No path or trailing slash.
* Production accepts only `https`. Outside production, `http://localhost` and `http://127.0.0.1` are also accepted, on any port.
* Register up to 10 origins. Removing one stops the component on that site.

#### Create a session

From your backend, create a session for the account holder and the origin of the page that will show it. The key needs `embeddedSessions:write` and `accountHolders:verify`. A platform key sends `Account-Holder` with the account holder ID; a company key does not.

```bash
curl -X POST "https://$API_HOST/api/v2/embeddedSessions" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Account-Holder: $ACCOUNT_HOLDER_ID" \
  -H "Idempotency-Key: 3d9f1b6a-7c2e-4a8d-b5f0-9e1c4a7b2d63" \
  -H "Content-Type: application/json" \
  -d '{"target": {"component": "VERIFICATION_DOCUMENTS"}, "origin": "https://app.example.com"}'
```

```json
{
  "id": "0b6f3c1e-5d2a-4c8e-9a71-3f4d2e1b6c90",
  "object": "embeddedSession",
  "accountHolderId": "7c2e9a40-1b3d-4f5e-8a6b-9c0d1e2f3a4b",
  "livemode": false,
  "target": { "component": "VERIFICATION_DOCUMENTS" },
  "origin": "https://app.example.com",
  "status": "PENDING",
  "expiresAt": "2026-10-12T14:40:00.000Z",
  "createdAt": "2026-10-12T14:30:00.000Z",
  "updatedAt": "2026-10-12T14:30:00.000Z",
  "clientToken": "0b6f3c1e-5d2a-4c8e-9a71-3f4d2e1b6c90.example-not-a-real-client-token-value-0000"
}
```

Send only `clientToken` to your page. Treat it as a secret:

* It can be redeemed once, within 10 minutes. The component then runs for at most 30 minutes.
* Create a new session each time you show the component. A session that ended cannot be resumed.
* Do not store it, log it or put it in a URL.
* Revoking the key that created the session, or changing its permissions, stops the token from being redeemed.

The session covers every document requirement of the account holder. To narrow it, add `target.requirementId` for one requirement, or `target.userId` for the requirements of one person, such as a beneficial owner.

#### Load the loader

Load the loader with the `@outpave/outpave-js` npm package or a script tag. Replace `APP_HOST` with the domain of the web app assigned to your integration. Both load it over HTTPS from this address rather than a copy, so your page receives fixes.

**`npm`**

```ts title="npm"
// npm install @outpave/outpave-js
import { loadEmbedded } from "@outpave/outpave-js";

const embedded = await loadEmbedded({
  loaderUrl: "https://APP_HOST/embedded/v1/loader.js",
});
```

**`Script tag`**

```html title="Script tag"
<script src="https://APP_HOST/embedded/v1/loader.js"></script>
<script>
  const embedded = window.OutpaveEmbedded.v1;
</script>
```

The package adds TypeScript types. `loadEmbedded` resolves `null` where there is no `window`, such as during server rendering, so call it in the browser.

#### Mount the component

Mount the component in an element on your page, such as `<div id="verification-documents"></div>`. With `getClientToken`, the component can offer **Start again** after its session ends, and calls `getClientToken` for a new session.

```js
const instance = embedded.mount({
  container: "#verification-documents",
  getClientToken: async () => {
    // Your backend endpoint, which creates a session and returns its clientToken.
    const response = await fetch("/verification/sessions", { method: "POST" });
    const { clientToken } = await response.json();
    return clientToken;
  },
  onComplete: ({ embeddedSessionId }) => {
    // Every requirement in the session is submitted. Read the verification from your backend.
  },
  onExpire: ({ embeddedSessionId }) => {
    // The session ended. The component offers Start again.
  },
  onError: ({ code }) => {
    // See Errors below.
  },
});
```

The frame fills the width of `container` and sets its own height to fit its content. Call `instance.unmount()` to remove it.

## What the user does

The component lists each requirement as **Business documents** or under the person's name, with the document types it accepts.

* Files are PDF, JPEG or PNG, up to 10 MB each.
* A requirement takes up to its `maximumDocuments` files. A rejected document does not count.
* The user selects **Submit for review** on each requirement once its files are uploaded. The requirement's `status` becomes `SUBMITTED`.

Submitting documents never approves a verification. The issuer's review decides it.

## Options

| Option           | Type                                      | Description                                                                                                                  |
| ---------------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `container`      | `HTMLElement` or `string`                 | Required. The element the frame is added to, or a CSS selector that matches one.                                             |
| `getClientToken` | `() => string` or `() => Promise<string>` | Returns a new session's `clientToken`. Called on mount and each time the component starts again. Pass this or `clientToken`. |
| `clientToken`    | `string`                                  | A session's `clientToken`, for a single mount without **Start again**.                                                       |
| `title`          | `string`                                  | The frame's accessible title. Default: `Secure form`.                                                                        |
| `locale`         | `string`                                  | The language, such as `en-US` or `es-ES`. English and Spanish are available; other values show English.                      |
| `colorScheme`    | `"light"` or `"dark"`                     | The color scheme. The component uses your platform's brand colors.                                                           |
| `onReady`        | `({ embeddedSessionId }) => void`         | Called when the component shows.                                                                                             |
| `onComplete`     | `({ embeddedSessionId }) => void`         | Called once per session when every requirement in it is submitted, including at once when none is left to submit.            |
| `onExpire`       | `({ embeddedSessionId }) => void`         | Called when the session ends, by timing out or through `POST /embeddedSessions/{embeddedSessionId}/expire`.                  |
| `onError`        | `({ code, embeddedSessionId }) => void`   | Called with a `code` from [Errors](#errors). `embeddedSessionId` is absent when no session was read.                         |

`mount` returns an object with two methods:

| Method      | Description                                                                                        |
| ----------- | -------------------------------------------------------------------------------------------------- |
| `restart()` | Removes the frame and mounts a new session from `getClientToken`. Does nothing with `clientToken`. |
| `unmount()` | Removes the frame. No callback fires after it.                                                     |

Callbacks are advisory. Read the outcome from your backend: the session with `GET /embeddedSessions/{embeddedSessionId}`, and the verification with `GET /accountHolders/{accountHolderId}/verification`.

## Session status

| `status`  | Meaning                                           | `expiresAt`                                    |
| --------- | ------------------------------------------------- | ---------------------------------------------- |
| `PENDING` | Created. The `clientToken` has not been redeemed. | When the `clientToken` stops being redeemable. |
| `ACTIVE`  | The component is running.                         | When the component stops.                      |
| `EXPIRED` | Timed out, or expired through the API.            | When the session ended.                        |

`POST /embeddedSessions/{embeddedSessionId}/expire` ends a session at once. A running component stops on its next request. Anything already submitted stays submitted.

## Events

| Event                                | Sent when                                                                              |
| ------------------------------------ | -------------------------------------------------------------------------------------- |
| `embeddedSession.completed`          | After the session submitted documents, nothing in its target is left to submit.        |
| `embeddedSession.actionRequired`     | A requirement in the session's target is required again after it was submitted.        |
| `embeddedSession.expired`            | The session was expired through the API.                                               |
| `accountHolder.verification.updated` | The account holder's verification changed, such as moving into review or being denied. |

See [Webhooks and events](/v2/docs/guides/webhooks) to receive them.

## Errors

| Where     | Error                                                                                   | Cause                                                                                                                         |
| --------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| API       | `403` [`PERMISSION_DENIED`](/v2/docs/guides/errors#permission-denied)                   | The key lacks `accountHolders:verify`, or `embeddedSessions:write` (`embeddedSessions:read` to retrieve a session).           |
| API       | `422` [`VALIDATION_FAILED`](/v2/docs/guides/errors#validation-failed)                   | `origin` is not registered, or `target.requirementId` is not the requirement of `target.userId`.                              |
| API       | `422` [`RELATED_RESOURCE_NOT_FOUND`](/v2/docs/guides/errors#related-resource-not-found) | `target.requirementId` or `target.userId` is not the account holder's.                                                        |
| API       | `404` [`RESOURCE_NOT_FOUND`](/v2/docs/guides/errors#resource-not-found)                 | No session with this ID belongs to the account holder.                                                                        |
| `mount`   | `TypeError`                                                                             | `container` matches no element, or neither `clientToken` nor `getClientToken` is passed.                                      |
| `onError` | `FRAME_UNAVAILABLE`                                                                     | The frame did not load within 20 seconds. The page's origin may not match the session's `origin`, or the session ended first. |
| `onError` | `SESSION_UNAVAILABLE`                                                                   | `getClientToken` failed or returned no token, or the token was already redeemed, expired or refused.                          |
| `onError` | `REQUEST_FAILED`                                                                        | The frame could not reach the API. The component offers **Try again**.                                                        |
| `onError` | `COMPONENT_FAILED`                                                                      | The component stopped working. The component offers **Try again**.                                                            |
| `onError` | `COMPONENT_UNAVAILABLE`                                                                 | The component cannot be shown in this frame.                                                                                  |