workflow.requiredDocument.calculate
Calculate and generate Required Document entities for a Workflow based on business rules and conditions.
POST http://api.kompliant.com/workflow.requiredDocument.calculate (OpenAPI specification)
Usage Info
This method evaluates the business application data within a workflow and automatically generates the appropriate Required Document records based on configured business rules, conditional logic and data for the business. The calculation can consider factors such as evaluation scores, sales volumes, business age, ownership citizenship, and merchant category codes to determine which documents are necessary for workflow completion.
Use this method when a workflow is started or when business data changes significantly, to ensure the document requirements accurately reflect the current state of the application. This is typically called once per workflow after the initial business information has been collected.
Request
Authentication: KSig1-HMAC-SHA256
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| workflow_id | string | Yes | The identifier for the Workflow for which to calculate and generate Required Document records. |
Example
{
"workflow_id": "w_LKQpQvG7r6BWXBzrvFvI5"
}
Response
Data
An empty data object is returned when the completion is successful.
Example
{
"meta": {
"status": "SUCCESS",
"trace_id": "trc_6zNzQZHSf26V83BO3uW6dS",
"version": "2025-03-24"
},
"data": {}
}
Errors
| Error Code | HTTP Code | Possible Cause |
|---|---|---|
| BAD_REQUEST | 400 | Required parameters not provided. |
| ENTITY_NOT_FOUND | 400 | The workflow_id provided does not exit. |
| MISSING_REQUIREMENTS | 400 | The Workflow has missing requirements. Possible missing requirements are described below. |
| SYSTEM_RULE_VIOLATION | 400 | System rule violations are described below. |
System Rule Violations
When a SYSTEM_RULE_VIOLATION error occurs, the response will include additional entity_type and sub_code fields to provide more specific information:
| Entity Type | Sub-code | Description |
|---|---|---|
| Workflow | WORKFLOW_ENDED | The Workflow is in an ENDED state and cannot completed. |
Missing Requirements
Missing requirements are present when the account has conditional documents that require specific data to be present on the subject record. This data can come from the Workflow, Business, BusinessSalesInfo and Person entities.
| Parameter | Type | Description |
|---|---|---|
| errors | array of objects | Array of missing requirement error objects, documented below |
Missing requirement errors parameters
| Parameter | Type | Description |
|---|---|---|
| code | string | Error code for the requirement missed, one of REQUIRED_DOCUMENT_MISSING_REQUIREMENTS |
| entity_type | string | Entity where the data is missing. |
| entity_id | string | Id on the entity_type with missing data. |
| message | string | Details and instructions on how to fill out the missing data. |
| related_endpoints | array of strings | A method available in the API that can be used to complete the missing information. |
| fields | array of strings | Specific fields available on the method request parameters to fill out the missing information. |
The specific missing fields are documented below. If any of them are part of the conditional documents configuration for the account, it's presence will be required, and it's absence will prevent the
| Field | Entity Type | Description |
|---|---|---|
| evaluation_score | Workflow | This data is updated when the workflow.pricing.calculate method is used. If this is part of the conditional documents configuration for the account, it's presence will be required. |
| average_monthly_credit_sales | BusinessSalesInfo | A SALES_AMOUNT_TYPE added using the business.salesInfo.create . If the BusinessSalesInfo has already been added, it'll be neccesary to first deleteit with the business.salesInfo.delete method, before using the create methid again. |
| average_yearly_credit_sales | BusinessSalesInfo | Same instructions as the apply. |
| established_date | Business | The date when the business was establish. Can be updated with the business.update method |
| industry_category_code | Business | The list of industry_category_codes for this business. Can be updated with the business.update method. |
| citizenship | Person | The citizenship of the specific Person is not available. Can be updated with the person.update method. |
Example with missing requirements
{
"meta": {
"status": "ERROR",
"trace_id": "trc_6OI5blm21ZoSlq0PC3RqJV",
"version": "2025-03-24"
},
"errors": [
{
"code": "MISSING_REQUIREMENTS",
"details": [
{
"code": "CALCULATED_PRICING_REQUIRED",
"entity_type": "Workflow",
"entity_id": "w_LKQpQvG7r6BWXBzrvFvI5",
"message": "Pricing for workflow `w_LKQpQvG7r6BWXBzrvFvI5` has not been calculated.",
"related_endpoints": [
"workflow.pricing.calculate"
]
},
{
"code": "FIELDS_REQUIRED",
"entity_type": "BusinessSalesInfo",
"entity_id": "bsi_6y5nzjBWrI6UMRmaZQlSee",
"message": "BusinessSalesInfo `bsi_6y5nzjBWrI6UMRmaZQlSee` is missing AVERAGE_MONTHLY_CREDIT_SALES field. Please delete the current sales info and create a new one with the required fields.",
"related_endpoints": [
"business.salesInfo.delete",
"business.salesInfo.create"
],
"fields": [
"sales_amount"
]
},
{
"code": "FIELDS_REQUIRED",
"entity_type": "BusinessSalesInfo",
"entity_id": "bsi_6y5nzjBWrI6UMRmaZQlSee",
"message": "BusinessSalesInfo `bsi_6y5nzjBWrI6UMRmaZQlSee` is missing AVERAGE_YEARLY_CREDIT_SALES field. Please delete the current sales info and create a new one with the required fields.",
"related_endpoints": [
"business.salesInfo.delete",
"business.salesInfo.create"
],
"fields": [
"sales_amount"
]
},
{
"code": "FIELDS_REQUIRED",
"entity_type": "Business",
"entity_id": "b_BYKlN2jzIkbB1qMi8CP2g",
"message": "Business `b_BYKlN2jzIkbB1qMi8CP2g` is missing fields.",
"related_endpoints": [
"business.update"
],
"fields": [
"established_date"
]
},
{
"code": "FIELDS_REQUIRED",
"entity_type": "Business",
"entity_id": "b_BYKlN2jzIkbB1qMi8CP2g",
"message": "Business `b_BYKlN2jzIkbB1qMi8CP2g` is missing fields.",
"related_endpoints": [
"business.update"
],
"fields": [
"industry_category_code"
]
},
{
"code": "FIELDS_REQUIRED",
"entity_type": "Person",
"entity_id": "p_2nrWSM7NmA2uhLMclrXZmY",
"message": "Person `p_2nrWSM7NmA2uhLMclrXZmY` is missing fields.",
"related_endpoints": [
"person.update"
],
"fields": [
"citizenship"
]
}
]
}
]
}
Updated 7 months ago