Skip to main content

Create a session

Initiate a new verification session for a specific flow​

Create a new session to initiate a Trust Platform flow. It returns the session with sessionStatus: "CREATED". The flow starts immediately and the status moves to RUNNING.

The request body depends on the flow: include in input exactly the data blocks that the flow's steps require. See Create sessions with dynamic payloads to find out which data blocks a flow needs.

Endpoint​

POST /api/v1/flows/{flowId}/{environment}/sessions

Path parameters

ParameterTypeRequiredDescription
flowIdstringYesThe unique identifier of the flow used to execute the session
environmentstringYesEnvironment identifier (e.g. live, staging)

Request​

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesapplication/json or multipart/form-data
User-AgentstringYesIdentifies your integration. Requests without this header are rejected with 403 Forbidden by the WAF.

Request parameters

FieldTypeRequiredDescription
inputobjectOptionalDynamic payload containing the data blocks required by the flow's configured steps. Keys are the input aliases declared by the flow's Start step, which are the data block names in camelCase (e.g., basicIdentity, documentImages) unless the flow names them otherwise. See Start input aliases. Defaults to {}.
metadataobjectYesCustomer-scoped session data. Only subjectId and locale are accepted. See Metadata.
redirectUrlstringOptionalURL to redirect the user after session completion. Must be allowlisted in the IDnow dashboard. When provided, the request must be authenticated with a valid OAuth client_id — requests authenticated with a plain bearer token will be rejected with 401.
statestringOptionalOpaque value echoed back in the redirect URL (e.g., for CSRF protection). Max 2048 characters.
redirectURL requirements

The value of the redirectUrl-field, when included in the request, needs to be

Otherwise the creation of the session will be unsuccessful and return an error.

{
"input": {
"basicIdentity": {
"familyName": "Schmidt",
"givenName": "Max",
"birthDate": "1985-08-22"
}
},
"metadata": {
"subjectId": "customer-internal-subject-id-123",
"locale": "en"
},
"redirectUrl": "https://example.com/verification",
"state": "csrf-token-or-state-value"
}

Response​

Response parameters

ParameterTypeDescription
flowIdstringFlow identifier
environmentstringEnvironment where the session was created
flowVersionnumberVersion of the flow being executed
playerUrlstringURL to start the session on the Player
sessionTokenstringThe session token can be used to initialise the native SDK. It's the same token embedded as the token query parameter in playerUrl and is included as an individual parameter for convenience.
sessionContextobjectSession context
sessionContext.sessionIdstringUnique session identifier
sessionContext.sessionStatusstringInitial status: CREATED
sessionContext.createdAtstringISO 8601 timestamp of session creation (optional, may be absent).
metadataobjectCustomer metadata echoed back from the request
metadata.subjectIdstringYour internal reference ID for the subject being verified
metadata.localestringLocale for the Player UI (optional). One of en, de, fr, pl, it, es. If the flow version has supported languages configured, only those languages are accepted — passing an unsupported locale returns a 400 Bad Request.
{
"flowId": "40cbb7b3-7468-4b5d-8bb5-ff8e82510c70",
"flowVersion": 2,
"environment": "live",
"sessionContext": {
"sessionId": "0197c55f-5af6-7e3d-af9b-f2359b104be8",
"sessionStatus": "CREATED",
"createdAt": "2024-11-04T10:30:00.000Z"
},
"metadata": {
"subjectId": "customer-internal-subject-id-123",
"locale": "en"
},
"playerUrl": "https://player.eu.platform.idnow.io/player?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"sessionToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Example​

curl --request POST https://localhost:3000/api/v1/flows/{flowId}/live/sessions \
-X POST \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: my-backend-service/1.0" \
-d '{
"input": {
"basicIdentity": {
"familyName": "Schmidt",
"givenName": "Max",
"birthDate": "1985-08-22"
}
},
"metadata": {
"subjectId": "customer-internal-subject-id-123"
}
}'

Start input aliases​

The keys of input are the aliases declared by the flow's Start step. For most flows the alias is the data block name (basicIdentity), so the payload looks like the examples above. A flow that takes two data blocks of the same type names them, for example applicant and guarantor, and you send one object per alias:

{
"input": {
"applicant": { "givenName": "Erika", "familyName": "Mustermann", "birthDate": "1964-08-12" },
"guarantor": { "givenName": "Max", "familyName": "Mustermann", "birthDate": "1962-03-01" }
},
"metadata": { "subjectId": "customer-internal-subject-id-123" }
}

With multipart/form-data, use the alias in the bracket path, for example input[ibanDocument][frontSide]=@iban.jpg.

  • Every input the Start step marks as required must be present. Otherwise the request fails with 400 and Missing required input data blocks: <alias>, ….
  • An invalid field is reported under its alias, for example input.applicant.birthDate.
  • Keys the flow does not declare are ignored, and so is userReference.
  • The flow spec lists one request property per alias, with the fields and limits that apply to it.

Uploading document images​

Flows that include API-only document verification steps (such as Verifying IBAN - API only (v1) or Verifying proof of address - API only (v1)) require document images to be submitted as binary files. Use multipart/form-data and send each image as a separate form field using bracket notation.

curl --request POST https://localhost:3000/api/v1/flows/{flowId}/live/sessions \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "User-Agent: my-backend-service/1.0" \
--form "input[documentImages][documentType]=IBAN" \
--form "input[documentImages][frontSide]=@document-front.jpg" \
--form "metadata[subjectId]=your-internal-subject-id"

The back side is optional — include it only if the document type requires it:

curl --request POST https://localhost:3000/api/v1/flows/{flowId}/live/sessions \
--header "Authorization: Bearer YOUR_API_KEY" \
--header "User-Agent: my-backend-service/1.0" \
--form "input[documentImages][documentType]=ID" \
--form "input[documentImages][frontSide]=@document-front.jpg" \
--form "input[documentImages][backSide]=@document-back.jpg" \
--form "metadata[subjectId]=your-internal-subject-id"

Accepted formats: JPEG and PNG.

File size limits:

LimitValueError on breach
Per file25 MB (default; see note)HTTP 422, code FILE_TOO_LARGE
Files per request30HTTP 400
Total request body50 MBHTTP 403. Some environments return 413 instead, so handle both codes as "request too large".
Per-file limit

The default per-file limit is 25 MB. The actual limit for a given flow may differ — read the maxLength field on each binary input in the flow spec to enforce the correct limit client-side before uploading.

note

When uploading images via multipart/form-data, omit the Content-Type: application/json header — the content type is set automatically by your HTTP client when using --form.

Metadata​

metadata is a required object containing customer-scoped session data. Only the two fields below are accepted — any additional key will be rejected with 400 Bad Request.

FieldTypeRequiredDescription
subjectIdstringYesYour internal reference ID for the user being verified
localestringNoLocale for the Player UI. Supported values: en, de, fr, pl, it, es. Defaults to en. If the flow version has supported languages configured, only those languages are accepted — passing an unsupported locale returns a 400 Bad Request.
PII warning

Do not store personally identifiable information (PII) in metadata. No encryption is applied to this field — values may appear in logs and audit trails.

  • A UserReference data block is automatically generated from the subjectId value and made available to all steps in the flow. You do not need to provide it in the input object.
  • metadata is echoed back in all session responses (create session and get session).

Create sessions with dynamic payloads​

When creating a session via the API, the request payload is entirely determined by the configured flow.

Each configured flow consists of one or more steps. Some but not all of these steps require input data blocks, which in turn define the structure of the session creation request payload.

Example

Assume a flow that consists of a single Trust Service step: Signing (v1)

This step requires always following input data blocks:

  • BasicIdentity
  • DocumentsToSign

Optionally DocumentData may be required if the signatureLevel in the flow configuration is set to QES as shown in the example below.

{
"openapi": "3.0.0",
"info": {
"title": "instant_signiture_issance_with_qes",
"description": "",
"version": "7",
"x-flow-id": "de74a1b6-ca7d-4222-ae03-a4292b7da07c",
"x-flow-version": 7,
"x-environment": "staging"
},
"servers": [
{
"url": "https://api.eu.platform.idnow.io"
}
],
"paths": {
"/api/v1/flows/de74a1b6-ca7d-4222-ae03-a4292b7da07c/staging/sessions": {
"post": {
"summary": "Create a session",
"operationId": "createSession",
"description": "Creates a new session for this flow. The request body includes only the data blocks required by this specific flow.",
"security": [
{
"bearer": []
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"input[basicIdentity][givenName]": {
"type": "string",
"maxLength": 150
},
"input[basicIdentity][familyName]": {
"type": "string",
"maxLength": 150
},
"input[basicIdentity][name]": {
"type": "string",
"maxLength": 150
},
"input[basicIdentity][birthDate]": {
"type": "string"
},
"input[basicIdentity][birthPlace]": {
"type": "string",
"maxLength": 150
},
"input[documentsToSign][documents]": {
"type": "array",
"items": {
"type": "object",
"properties": {
"templateId": { "type": "string" },
"source": {
"type": "string",
"format": "binary",
"maxLength": 26214400
}
},
"required": ["templateId", "source"]
}
},
"metadata[subjectId]": {
"type": "string"
},
"metadata[locale]": {
"type": "string",
"enum": ["en", "de", "fr", "pl", "it", "es"]
},
"redirectUrl": {
"type": "string"
},
"state": {
"type": "string"
}
},
"required": [
"input[basicIdentity][givenName]",
"input[basicIdentity][familyName]",
"input[documentsToSign][documents]",
"metadata[subjectId]"
]
}
}
}
},
"responses": {
"201": {
"description": "Session successfully created",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"flowId": {
"type": "string"
},
"environment": {
"type": "string"
},
"flowVersion": {
"type": "number"
},
"playerUrl": {
"type": "string"
},
"sessionToken": {
"type": "string"
},
"sessionContext": {
"type": "object",
"properties": {
"sessionId": {
"type": "string"
},
"sessionStatus": {
"type": "string"
},
"createdAt": {
"type": "string"
}
}
},
"metadata": {
"type": "object",
"properties": {
"subjectId": {
"type": "string"
},
"locale": {
"type": "string",
"enum": ["en", "de", "fr", "pl", "it", "es"]
}
},
"required": ["subjectId"]
}
}
}
}
}
}
}
}
}
}
}

Programmatically get a flow-specific OpenAPI schema​

Trust Platform can automatically generate a flow-specific OpenAPI specification for the session creation endpoint. This specification clearly defines which data blocks are required for a given flow by providing a tailored request body schema for the create-session API.

It helps you understand dynamic, flow-specific payloads, generate typed API clients, and reduce errors when creating sessions.

Download OpenAPI specification from dashboard​

Go to Flows → Your Flow → Versions, then click "Download" above the flow funnel to download the OpenAPI file. You can import the file into tools like Postman to test session creation requests directly.

note

Available only for flows published to staging or live.

Or get OpenAPI specification via API​

You can also retrieve the OpenAPI schema for a specific flow by using the flow ID with the Get flow OpenAPI spec endpoint.

Flow-specific limits​

Some data blocks carry a limit that is specific to the flow. The flow-specific OpenAPI schema exposes the effective value as the maxLength of the affected input — read it to validate the payload client-side before sending the request.

For example, a flow containing a Sending SMS (v1) step requires input.messageTemplate.template. The template must fit one SMS segment: a GSM-7 message is measured in septets and may use up to 160 by default; a message containing any character outside GSM-7 (an accented letter such as ç, an emoji or a CJK character) is measured in UCS-2 code units and limited to 70 by default — the platform operator may raise that to 134, two segments. The check is applied after every {session.url} placeholder is replaced by the short Player link. The maxLength in your flow's OpenAPI schema is the upper bound for a GSM-7 message; a message that switches to UCS-2 is limited to 70 units by default regardless of it. A flow with several messaging steps applies all of their rules to every messageTemplate input — the strictest budget and the union of the restrictions — because the check runs once for the whole flow, not per input. A rejection returns 412 Precondition Failed with code FIELD_LENGTH_EXCEEDED, FIELD_CONTAINS_UNSUPPORTED_CHARACTERS or FIELD_CONTAINS_EXTERNAL_URL — see Template validation for the complete list and Error codes for the codes. Independently of the flow's steps, a template longer than 100,000 UTF-16 code units is rejected at session creation with a 400 Bad Request validation error.