Skip to content

Session creation and metadata

Create a separate session for each verification attempt. The client system backend sends the selected Workflow API KEY, receives a single-use session_id, and passes it to Remote, Widget, or WebView.

Make the request from the backend

Do not pass the API KEY to the browser or mobile application. The client should receive only a session_id or a ready-to-use verification URL.

Create a session

POST https://kyc.biometric.vision/api/flows/sessions/create/
Content-Type: application/json
Field Type Required Description
api_key string Yes Workflow API KEY from the dashboard
metadata object No Data for technologies and additional session features

Minimal request:

curl --request POST \
  --url 'https://kyc.biometric.vision/api/flows/sessions/create/' \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "<FLOW_API_KEY>"
  }'

A successful response returns HTTP 201 Created and contains:

Field Type Description
session_id string Single-use identifier of the created session
technologies string[] Ordered list of Workflow technology codes
digital_signature object Returned if the Workflow includes the DSS technology
digital_signature.check_id string (UUID) Digital Signature check identifier
{
  "session_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "technologies": ["LC", "DR2", "F2F"]
}

Do not reuse a session_id for multiple independent attempts or users.

Session metadata

The metadata object lets you pass data already known to the client system, prefill technology fields, provide a reference photo, or associate the session with an existing person. Metadata is supplied when creating the session and does not add technologies to the Workflow.

You can omit metadata if the Workflow settings do not require it. The exception is report sending: when enabled, you must supply extra.iin.

Section Purpose
face2face Supply a reference photo for face comparison
edocument Prefill the IIN and phone number, control editing, and skip data entry
ds_identifier Prefill the signer's details
gbdul Prefill the organization's BIN
kz_info Supply an IIN for KZ Info and technologies that use the shared session IIN lookup
erd Supply an IIN for ERD
otp Supply a phone number for sending OTP codes
extra Supply an IIN for reports
person Find a person by alias and collect person data

Supply the sections needed for your scenario. Do not use metadata or extra as arbitrary storage for custom fields: the session creation request has a fixed metadata schema.

Face2Face

If the client system already has a user photo, pass it in Base64 for comparison:

Field Type Required Description
metadata.face2face object No Face2Face metadata
metadata.face2face.photo1 string No Base64-encoded reference photo
{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "face2face": {
      "photo1": "<BASE64_IMAGE>"
    }
  }
}

The supplied photo is used in a Workflow where Face2Face runs together with Liveness, E-Document, or Document Recognition.

Supply a plain Base64 string without the data:image/...;base64, prefix. An image URL or a storage file key cannot be used in the session creation request.

If the Workflow includes DSI or DSS, you cannot supply face2face.photo1: session creation will fail with HTTP 400. If person.alias is also supplied, the photo in face2face.photo1 takes precedence over the person's photo.

E-Document

E-Document metadata can prefill the IIN and phone number, prevent the user from changing them, and skip the data entry screen when all conditions are met.

Field Type Required Default Description
metadata.edocument object No E-Document metadata
metadata.edocument.iin object No IIN field settings
metadata.edocument.iin.value string No User's IIN
metadata.edocument.iin.changeable boolean No true Whether the user can change the IIN
metadata.edocument.phone object No Phone field settings
metadata.edocument.phone.value string No User's phone number in 77********* format
metadata.edocument.phone.changeable boolean No true Whether the user can change the phone number
metadata.edocument.skip_input boolean No false Skip the data entry screen

To skip the data entry screen, provide both the IIN and phone number, set changeable: false for both fields, and set skip_input: true:

{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "edocument": {
      "iin": {
        "value": "<SUBJECT_IIN>",
        "changeable": false
      },
      "phone": {
        "value": "<SUBJECT_PHONE>",
        "changeable": false
      },
      "skip_input": true
    }
  }
}

The user proceeds directly to entering the OTP code from 1414. If you supply skip_input: true without meeting all the conditions above, the backend rejects session creation with HTTP 400.

To display the data entry screen with prefilled values, supply skip_input: false. For each supplied iin or phone object, provide a non-empty value; changeable: false prevents the user from editing that field, while true allows it.

The defaults in the table describe the form behavior documented in the integration guides. When these parameters are omitted, the backend does not insert changeable or edocument.skip_input into the stored metadata. Supply them explicitly in the request to control the scenario.

Digital Signature Identifier

The ds_identifier metadata prefills the signer's details:

Field Type Required Default Description
metadata.ds_identifier object No Signer identification metadata
metadata.ds_identifier.iin object or string No IIN field settings or an IIN as a string
metadata.ds_identifier.iin.value string No Signer's IIN
metadata.ds_identifier.iin.changeable boolean No true Whether the user can change the IIN
metadata.ds_identifier.phone object or string No Phone field settings or a phone number as a string
metadata.ds_identifier.phone.value string No Signer's phone number in 77********* format
metadata.ds_identifier.phone.changeable boolean No true Whether the user can change the phone number
metadata.ds_identifier.skip_input boolean No true Skip the data entry screen; the backend default when a ds_identifier object is supplied

To control editing, use objects with value and changeable, as in the example below. The string format is also supported, but it does not let you set changeable for the field. If changeable is omitted, the backend does not add it to the metadata; the true default in the table describes the form behavior.

The IIN must contain 12 digits. Supply the phone number as digits only, without +, spaces, or separators. To keep the data entry screen, explicitly set skip_input: false:

{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "ds_identifier": {
      "iin": {
        "value": "<SUBJECT_IIN>",
        "changeable": true
      },
      "phone": {
        "value": "<SUBJECT_PHONE>",
        "changeable": true
      },
      "skip_input": false
    }
  }
}

Uploading documents for signing and retrieving a CMS signature are separate Digital Signature operations and are not part of session creation.

GBDUL

The gbdul metadata lets you specify the organization's BIN in advance to retrieve data from the State Database of Legal Entities, including in a digital signature scenario for a legal entity.

Field Type Required Default Description
metadata.gbdul object No GBDUL metadata
metadata.gbdul.bin object No BIN field settings
metadata.gbdul.bin.value string For prefilling Organization's BIN
metadata.gbdul.bin.changeable boolean No true for the form Whether the user can change the BIN
metadata.gbdul.skip_input boolean No false Skip the BIN entry screen

To prefill the BIN and prevent the user from changing it, supply:

{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "gbdul": {
      "bin": {
        "value": "<ORGANIZATION_BIN>",
        "changeable": false
      },
      "skip_input": false
    }
  }
}

If changeable is omitted or set to true, the user can enter or change the BIN. The backend does not insert an omitted changeable into the metadata. skip_input controls whether data entry is skipped; the actual GBDUL request runs during the technology step, not during session creation.

KZ Info

The kz_info.iin field supplies the user's known IIN. In the KZ Info scenario with an alternative data retrieval method, it is used when the technology request itself does not specify an IIN.

Field Type Required Description
metadata.kz_info object No KZ Info metadata
metadata.kz_info.iin string No User's IIN
{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "kz_info": {
      "iin": "<SUBJECT_IIN>"
    }
  }
}

This IIN also takes precedence in the shared session IIN lookup used, depending on the scenario, by GBDFL, Address, RPN, and PPS. It is not automatically inserted into every field of every technology: for example, it does not replace edocument.iin.value or extra.iin, which is required for report sending.

ERD

The erd.iin field lets you supply an IIN for the ERD scenario. Metadata is returned to the verification interface when the session starts; the ERD verification request separately accepts the IIN in the personal_number field. Supplying metadata alone does not start verification.

Field Type Required Description
metadata.erd object No ERD metadata
metadata.erd.iin string No User's IIN
{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "erd": {
      "iin": "<SUBJECT_IIN>"
    }
  }
}

The report generator can also use erd.iin as an IIN source if extra.iin and kz_info.iin are not supplied.

OTP

The otp.phone_number field specifies a phone number for the separate OTP technology. It does not configure E-Document OTP codes from 1414 or replace edocument.phone or ds_identifier.phone.

Field Type Required Description
metadata.otp object No OTP metadata
metadata.otp.phone_number string No Phone number in international format with +, for example +77771234567
{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "otp": {
      "phone_number": "<SUBJECT_PHONE_WITH_PLUS>"
    }
  }
}

The code is sent when the OTP technology is called. The phone number in the send request takes precedence; if it is omitted, the backend uses metadata.otp.phone_number. If neither source contains a phone number, no code is sent and the OTP result receives the FAILED status with the reason phone_number_missing.

Additional metadata

The extra.iin field supplies the user's IIN for generating PDF reports, including signed Liveness and Face2Face reports.

If the Send signed report setting is enabled in the Workflow configuration, a non-empty metadata.extra.iin is required when creating the session. An IIN in another metadata section does not satisfy this check.

When generating a report, extra.iin is used first. If it is absent, the generator can also obtain the IIN from other metadata or technology results. Whether extra.iin specifically is required at creation therefore depends on the Send signed report setting.

Field Type Required Description
metadata.extra object When Send signed report: true Additional session metadata
metadata.extra.iin string When Send signed report: true User's IIN
{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "extra": {
      "iin": "<SUBJECT_IIN>"
    }
  }
}

Person

The metadata.person.alias field lets you find an existing person or save an alias when collecting data for a new person. Supply a valid, non-expired alias of an existing person or a new unique identifier from the client system. To work with persons, the Workflow must include the PS technology with the corresponding features configured.

Field Type Required Description
metadata.person object No Person metadata
metadata.person.alias string No Existing person's alias or a new unique alias
{
  "api_key": "<FLOW_API_KEY>",
  "metadata": {
    "person": {
      "alias": "<PERSON_ALIAS>"
    }
  }
}

You do not need to pass the alias type separately. The system processes the value as follows:

  • when the session starts, the system searches for a person by a non-expired alias value within the organization that owns the Workflow; expired aliases are excluded from the search;
  • after the session finishes successfully, if person collection is enabled, the system asynchronously creates or updates a person using the collected data, including the supplied alias;
  • if no matching person exists, a new one is created; a new alias from metadata is saved with the custom type. The session creation request itself does not create a person.

Result reuse is enabled by the Skip technology with existing Document result setting and depends on whether the stored results are eligible, including validity period restrictions. Using the person's photo for Face2Face is enabled by the Use person's photo for F2F comparison setting; an expired or deleted photo is not used as the default photo. If face2face.photo1 is supplied, the person's photo is not added for comparison.

See Persons for details on person collection and data reuse.

Metadata validation and errors

When creating a session, the backend validates the request structure and additional conditions for using metadata. Successful session creation does not mean that government services have verified the data or that the technologies have been completed.

Field or condition Requirement at session creation
face2face.photo1 A valid Base64 string without a Data URL prefix; URLs and storage keys are not accepted
face2face.photo1 together with DSI or DSS Incompatible; do not supply a photo for this Workflow
edocument.skip_input: true Both iin.value and phone.value must be non-empty, and both fields must explicitly have changeable: false
edocument.skip_input: false or omitted If an iin or phone object is supplied, its value must be non-empty
ds_identifier.iin If a value is set, it must contain 12 digits; this applies to both the string format and iin.value
ds_identifier.phone If a value is set, it must contain digits only; +, spaces, separators, and an empty string are not allowed
Send signed report: true in the Workflow configuration A non-empty metadata.extra.iin is required, even if an IIN is specified in another section

The edocument.skip_input conditions do not automatically apply to ds_identifier or gbdul: session creation does not perform an equivalent check of the combination of skip_input, value, and changeable for these sections. For kz_info.iin, erd.iin, gbdul.bin.value, extra.iin, and otp.phone_number, session creation also does not separately validate the value format beyond checking the field type. Supply valid data for the corresponding technology.

Violating the additional conditions returns HTTP 400 with the code invalid_flow_session_metadata. For example, if you set edocument.skip_input: true but allow the IIN to be edited:

{
  "message": "Invalid metadata for session",
  "detail": "Value error, Both IIN and phone must have values and be non-changeable when skip_input is True",
  "code": "invalid_flow_session_metadata"
}

If you omit extra.iin while report sending is enabled:

{
  "message": "Invalid metadata for session",
  "detail": "Value error, IIN is required in extra metadata when report should be sent",
  "code": "invalid_flow_session_metadata"
}

Request structure and field type errors may be returned separately with HTTP 422. Handle errors using the HTTP status and code, when present; detail explains the specific cause.

Metadata in webhooks

Webhooks contain the session's stored metadata object. It may differ from the original request: fields with null values are excluded when saving, and some defaults are added according to the schema.

In particular, after the photo is uploaded, face2face.photo1 is replaced with the file's storage key. In a webhook, this field contains the key, not the original Base64 string or a ready-to-use image URL. Do not use it as a download URL.

Complete request

The following cURL example supplies person and E-Document metadata together. The examples in the other sections above are intended for their respective Workflow scenarios; you do not need to combine all sections in a single request. Replace the values in angle brackets with your own data before sending:

curl --request POST \
  --url 'https://kyc.biometric.vision/api/flows/sessions/create/' \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "<FLOW_API_KEY>",
    "metadata": {
      "person": {
        "alias": "<PERSON_ALIAS>"
      },
      "edocument": {
        "iin": {
          "value": "<SUBJECT_IIN>",
          "changeable": false
        },
        "phone": {
          "value": "<SUBJECT_PHONE>",
          "changeable": false
        },
        "skip_input": true
      }
    }
  }'

After receiving the session_id, pass it to the selected verification interface. Track session completion through Webhooks, and retrieve the final data through the results API.