Skip to navigation

Create an embedded session

Creates a session for one component of the account holder and returns its one-time clientToken. Pass the clientToken from your server to your page, which hands it to the component; never put it in a URL. The component must be framed by a page at origin, which must be one of the origins registered for your platform.

The clientToken can be redeemed once, within 10 minutes. Redeeming it starts the component, which then runs for at most 30 minutes. A session that ended cannot be resumed; create a new one. Revoking the API key that created the session, or changing its permissions, stops the session from being redeemed.

A completed component does not mean that a review passed. Read the account holder for the outcome.

A VERIFICATION_DOCUMENTS session covers every document requirement of the account holder. Name target.requirementId to limit it to one requirement, or target.userId to limit it to the requirements of one person of the account holder. Uploading or submitting documents never approves a verification; only the review decides it. Once it has submitted documents, the session records embeddedSession.completed when nothing in its target is left to submit, and embeddedSession.actionRequired when a requirement in its target is required again after that.

Authentication

AuthorizationBearer

Access token from POST /access-token. Valid for at most 30 minutes.

Headers

Idempotency-KeystringRequiredformat: "^(?:[!#-~][!-~]{0,254}|"[!#-\[\]-~]{1,255}")$"1-257 characters

Your unique key for this operation: 1 to 255 visible ASCII characters, ideally a new UUID v4 for each operation. A value in double quotes is accepted and the quotes are removed. Retrying with the same key and the same request returns the first response with Idempotent-Replayed: true; the same key with a different request is refused with IDEMPOTENCY_KEY_REUSED. A key can be used again 30 days after its operation completes.

Account-HolderstringOptionalformat: "^[A-Za-z0-9_-]+$"1-128 characters

The account holder a platform API key acts on. Platform keys must send it on account holder operations. A company API key acts on its own account holder; it may omit the header or send its own account holder ID.

X-Request-IdstringOptionalformat: "^[A-Za-z0-9._:-]+$"1-128 characters

Your own correlation ID for this request. It is recorded with the request. The X-Request-Id response header is always generated by the server.

Request

This endpoint expects an object.
targetobjectRequired
The component and the task it performs.
originstringRequired1-2048 characters

The exact origin of the page that frames the component, for example https://app.example.com: scheme and host, a port only when it is not the default, and no path or trailing slash. It must be registered for your platform.

Response headers

X-Request-Idstringformat: "uuid"
Unique ID of this request. Quote it when you contact support.
RateLimitstringOptional

Remaining budget for each rate limit policy, for example "burst"; r=57; t=6 (requests remaining and seconds until the window resets).

RateLimit-PolicystringOptional

The rate limit policies applied to this request, for example "burst"; q=60; w=10 (requests allowed per window of seconds).

Locationstring

Path of the resource, relative to the API host, for example /api/v2/embeddedSessions/0b6f3c1e-5d2a-4c8e-9a71-3f4d2e1b6c90.

Idempotent-ReplayedenumOptional

Sent as true when this response repeats the first response to the same Idempotency-Key. A replay keeps the first response’s status and body, including the requestId of a problem; X-Request-Id is new.

Allowed values:

Response

The session and its one-time clientToken.

idstringRead-onlyformat: "uuid"
Session ID.
object"embeddedSession"Read-only

Always embeddedSession.

accountHolderIdstringRead-only
The account holder the component acts for.
livemodebooleanRead-only

true on a live platform in production, false on a Sandbox platform and outside production.

targetobject
The component and the task it performs.
originstringRead-only
The origin of the page allowed to frame the component.
statusenumRead-only

PENDING: the clientToken has not been redeemed.

Allowed values:
expiresAtdatetimeRead-only

When the clientToken stops being redeemable.

createdAtdatetimeRead-only
When the session was created.
updatedAtdatetimeRead-only
When the session last changed.
clientTokenstringOptionalRead-only

The one-time credential the component redeems. Keep it out of URLs and logs. It is returned by this response and by its replays for 24 hours; after that a replay omits it, so create a new session.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
409
Conflict Error
413
Content Too Large Error
415
Unsupported Media Type Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error