Requirements
- API key pair
- Session creation via API enabled (done by iDenfy staff)
- Finances for the KYB flow you use
KYB API Pre-Fill Flow
Steps 4–6 are optional — run the ones you have data for.
Authentication
KYB form endpoints accept two credentials, but not every endpoint accepts both.tokenString— sent asAuthorization: Bearer <tokenString>. Acts as the client filling in their own form.- API key pair — HTTP basic auth with your API key and secret. Acts as you, the partner.
Calling a
tokenString-only endpoint with the API key pair returns 401.
Step 1: Create a Token
Create a session as described in Create KYB Session.- If you omit
flow, iDenfy uses your account’s default KYB flow. - iDenfy refuses token creation if your account lacks finances for the flow.
- Set
lifetimelong enough for the client to finish. The maximum is 2,592,000 seconds (30 days); the default is one hour.
tokenString and companyId from the response — every following step uses them. The response also echoes the session settings (expiration, isValid, clientId, externalRef, flow, tags and others); see kybTokensCreate in the API Reference.
Step 2: Read the Flow
CallGET /kyb/info/ with the tokenString. The flow object describes what the form expects:
If
flow is null, every field and section is present in the form.
Read custom field keys and choice keys from this response at run time rather than hard-coding them. They are defined in your dashboard workflow, so a copied value goes stale the moment someone edits the workflow or you switch flows.
Step 3: Create the Form
POST /kyb/forms/ creates the form and is where pre-filling starts. Authorize it with the tokenString.
beneficiaries and documents arrays, so steps 4 and 5 can be folded into this call.
Rules for this request:
- Once per token. A second call returns “KYB form is already created.” Change the data afterwards with an update.
- The flow’s required fields apply. Each missing required field comes back as its own “This field is required.” error. You cannot leave a required field for the client — see Partial Pre-Fill.
- Fields outside the flow are silently dropped, not rejected. A field missing from the saved form usually means the flow does not include it.
Company Fields
companyName and country are always required. The rest are optional unless your flow marks them required.
Custom Fields
Custom fields from your workflow go incompany.additionalInfo, keyed by the field’s key from step 2. Each entry is an object with a single value:
Step 4: Add Beneficiaries
Add each person or company withPOST /kyb/forms/{companyId}/beneficiaries/, one request per beneficiary, or send them all in the beneficiaries array of step 3.
info for a person — infoType: "INDIVIDUAL". name and surname are required. Optional:
info for a company — infoType: "COMPANY". companyName and country are required; the remaining fields match the company fields.
A beneficiary’s type cannot be changed after creation. Delete it and add a new one instead.
Step 5: Upload Documents
Upload company documents withPOST /kyb/forms/{companyId}/documents/, or include them in the documents array of step 3. Each document needs a type and a base64-encoded file.
flow.documents from step 2. Upload limits are listed in Collect Information.
Step 6: Answer the Questionnaire
If the flow has a questionnaire, iDenfy attaches it to the form when you create the token:- With a flow — the flow’s questionnaire.
- Without a flow — the questionnaire named in the token’s
questionnairefield, or your account’s default. - None — when the token sets
questionnaireRequired: falseor uses a flow router.
Get the Questionnaire
GET /kyb/forms/{companyId}/questionnaires/ returns each questionnaire’s id, key, title and sections. Each section has a key and questions; each question has a key, type, required, choices and an optional condition. An empty list means no questionnaire is attached.
Save the Answers
PUT /kyb/forms/{companyId}/questionnaires/{id}/answers/, using the questionnaire id from the previous call:
Validation:
- Questions are optional unless marked
required. - Required questions inside a section or question whose
conditionis not met are skipped. - If any required question is missing, the whole request is rejected — partial answers can fail.
Check What Is Saved
GET /kyb/forms/{companyId}/questionnaires/{id}/answers/— the raw answers, or 204 if none are saved yet.GET /kyb/forms/{companyId}/questionnaires/answers/detail/— a readable version with titles and choice labels.
The form cannot be submitted without saved answers — submission fails with “To submit please answer a questionnaire.”KYC questionnaires cannot be pre-filled: their answers can only be saved from the client’s own verification session.
Step 7: Hand the Form to the Client
Do not submit the form. Send the client to the Web UI with the sametokenString:
tokenString in place of its {{token_string}} placeholder. The client sees every pre-filled value — including questionnaire answers and uploaded files — completes the rest and submits. You receive a webhook once it is submitted.
To complete the whole form through the API instead, see Collect Information.
Updating a Form
Once the form exists, change company data withPUT or PATCH /kyb/forms/{companyId}/. Beneficiaries, documents and questionnaire answers each keep their own endpoints.
PUTreplaces the wholecompanyblock — include every required field.PATCHchanges only the fields you send. Everything else stays as it is.
Validation Depends on the Credential
tokenString— the flow’s rules apply, exactly as on create: required fields must be present and fields outside the flow are dropped. After a Request Update, only the requested fields can change; everything else is read-only.- API key pair — the flow’s required and allowed rules are not applied to standard company fields. Only the basic checks remain:
companyNameandcountrycannot be empty, plus format and length limits. Custom fields inadditionalInfoare still checked against the flow.
tokenString — by the client, or by you using the token — are not logged as partner edits.
Updating Questionnaire Answers
- A
PUTreplaces all saved answers. Any question you leave out is cleared, so send the full set every time —GETthe current answers, change what you need, andPUTeverything back. - Files: to keep an existing file, send back the file link from the
GETresponse. Any file not included in thePUTis deleted. - To clear all answers,
DELETEthe same answers path. The form then cannot be submitted until answers are saved again. - Statuses: with the
tokenString, only while the form isPENDING. With the API key pair, at any status exceptPROCESSING— including after submission (NEED_TO_REVIEW,NEED_TO_PROCESS,COMPLETED).
Beneficiaries and Documents
Use the update and delete operations on their own endpoints. See Collect Information for the full list.Limitations
Pre-Filled Values Stay Editable
The client can change any value you pre-fill, including questionnaire answers. There is no API option to lock a field during the first submission. If certain data must not change:- Fill every field through the API, setting the flow fields you cannot supply to optional.
- Submit the form with
POST /kyb/forms/{companyId}/submit/(tokenStringonly). - In the dashboard, use Request Update and select only the sections the client may edit. Everything not selected is read-only for the client.
Request Update is a dashboard action. You cannot trigger it through the API, so step 3 is manual for every company.
Partial Pre-Fill
Form creation applies the flow’s required fields, so when you hold only some of the data you have two options:- Make those fields optional in the flow — you can then pre-fill any subset, at the risk that the client skips fields you need.
- Keep them required and do not pre-fill — the client enters all the information themselves, and nothing is missed.