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

ParameterTypeRequiredDescription
workflow_idstringYesThe 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 CodeHTTP CodePossible Cause
BAD_REQUEST400Required parameters not provided.
ENTITY_NOT_FOUND400The workflow_id provided does not exit.
MISSING_REQUIREMENTS400The Workflow has missing requirements. Possible missing requirements are described below.
SYSTEM_RULE_VIOLATION400System 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 TypeSub-codeDescription
WorkflowWORKFLOW_ENDEDThe 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.

ParameterTypeDescription
errorsarray of objectsArray of missing requirement error objects, documented below

Missing requirement errors parameters

ParameterTypeDescription
codestringError code for the requirement missed, one of REQUIRED_DOCUMENT_MISSING_REQUIREMENTS
entity_typestringEntity where the data is missing.
entity_idstringId on the entity_type with missing data.
messagestringDetails and instructions on how to fill out the missing data.
related_endpointsarray of stringsA method available in the API that can be used to complete the missing information.
fieldsarray of stringsSpecific 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

FieldEntity TypeDescription
evaluation_scoreWorkflowThis 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_salesBusinessSalesInfoA 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_salesBusinessSalesInfoSame instructions as the apply.
established_dateBusinessThe date when the business was establish. Can be updated with the business.update method
industry_category_codeBusinessThe list of industry_category_codes for this business. Can be updated with the business.update method.
citizenshipPersonThe 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"
          ]
        }
      ]
    }
  ]
}