Onboarding: API Integration
This guild describes how to use Intrepid Fox onboarding document verification functionality via the API.
Overview
Document verification performed via the API includes the following steps:
- Create case (and conversation).
- Process one or more documents:
- Run document verification.
- Submit comments on the issues found (will be present in the report).
- Mark conversation as finished - this will generate a report.
- Download report (and, if needed, documents).
- If needed, create follow-up conversation and repeat from step 2.
Authentication
All API calls described in this guide use HTTP Basic Authentication, so all requests shall include an Authorization header with appropriate service credentials.
Integration Scheme
1. Create Case and Conversation
Onboarding of each new client is tracked within an entity called "case".
Each case contains one or more "conversations". Each conversation is the process where we collect some information about the client (e.g. validate a set of documents) and generate a report in the end. There may be more than one conversation within the case - for example, if a manager decides that additional information about the client shall be requested and/or checked after the initial phase was fully completed.
To start the onboarding flow, you shall create the case and the conversation and keep their IDs for future reference.
Send POST api/v1/cases with:
application/jsonpayload specifying:onboardingcase kind- company data (name, reg number, etc.)
documents_verificationmodule
Example payload:
{
"communication_id": "...",
"case": {
"case_kind": "onboarding",
"company_country_code": "NL",
"company_full_name": "...",
"company_reg_number": "...",
"user_full_name": "...",
"company_industry_classification": [
{
"classification": "UKSIC2007",
"code": "30990"
}
],
"modules": [
{"module": "documents_verification"}
]
},
"invitation_email_recipients": [
"[email protected]"
],
"case_manager": {
"name": "Alice Smith",
"email": "[email protected]"
}
}The result will contain IDs of the case and the conversation:
{
"result": "case_created",
"case_id": "...",
"conversation_id": "..."
}See https://docs.intrepidfox.tech/reference/create_case_api_v1_cases_post
2. Run Document Verification
The document verification includes the following steps:
- Upload document file and save returned document ID.
- Run verification task for the uploaded document.
- Wait until verification result is ready (poll the endpoint).
2.1. Upload Document
Send POST /api/v1/conversations/{conversation_id}/documents with:
conversation_idparameter - obtained when creating case/conversationmultipart/form-datapayload with:filepart with the document file
The result will contain ID of the uploaded document:
{
"document_id": "..."
}2.2. Run Verification
Send POST /api/v1/conversations/{conversation_id}/verifications with:
conversation_idparameter - obtained when creating case/conversationapplication/jsonpayload specifying:document_id- ID of the uploaded document- details of the verification task
Example payload:
{
"document_id": "...",
"verification_task": {
"document_type": "certificate_of_incorporation",
"company_full_name": "..."
}
}The result will contain ID of the started verification task:
{
"verification_id": "..."
}2.3. Get Verification Result
Run GET /api/v1/conversations/{conversation_id}/verifications/{verification_id} with:
conversation_idparameter - obtained when creating case/conversationverification_idparameter - ID of the verification task
The result will contain information about the status of the task and the task result (when completed).
{
"status": "not_ready"
}You shall poll this endpoint until you get ready status. Response will contain document check results:
{
"status": "ready",
"result": {
"check_results": [
{
"issue_id": "...",
"severity": "warning",
"text": "The name of the company in the document (...) does not match ..."
}
]
}
}3. Submit Comments
Send POST /api/v1/conversations/{conversation_id}/comments with:
conversation_idparameter - obtained when creating case/conversationapplication/jsonpayload with comments on one or more issues (referenced by IDs)
Example payload:
[
{
"issue_id": "...",
"comment_text": "this is the parent company name"
},
{
"issue_id": "...",
"comment_text": "we will upload new documents ASAP"
}
]4. Finish Conversation
Send POST /api/v1/conversations/{conversation_id}/status with:
conversation_idparameter - obtained when creating case/conversationapplication/jsonpayload with string"completed"(the only allowed transition at the moment)
5. Access Report
After the conversation is finished, we prepare conversation results (including the report). To access these results, run GET /api/v1/conversations/{conversation_id}/result passing conversation_id of the finished conversation.
In some cases the report generation may take some time and until the report is ready, the following will be returned:
{
"status": "not_ready"
}When the report is ready, the following will be returned:
{
"status": "ready",
"result": {
"web_report_link": "...",
"client_documents": [
{
"document_id": "...",
"document_type": "...",
"document_name": "...",
"rejected": false,
"file_name": "Invoice_Supplier.pdf",
"download_link": "..."
},
...
]
}
}Updated 3 months ago
