AltScore
Borrower Central (BC)

Workflows API

This API allows managing workflows in the system. It provides endpoints to create, read, update, and delete workflows, as well as to execute them.

The Workflow Object

The Workflow object represents a workflow in the system.

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "executionMode": "sync",
  "alias": "loan-approval",
  "version": "1.0",
  "label": "Loan Approval",
  "type": "evaluation",
  "description": "Workflow for loan approval",
  "context": "loans",
  "inputSchema": "...",
  "jsonSchema": "...",
  "uiSchema": "...",
  "flowDefinition": {},
  "batchFlowDefinition": {},
  "initialData": "...",
  "schedule": {
    "cron": "0 9 * * *",
    "utcDeltaHours": -3
  },
  "scheduleBatch": {
    "cron": "0 0 * * *",
    "utcDeltaHours": -3,
    "executionSettings": {
      "maxExecutionsPerSecond": 1,
      "maxConcurrentDispatches": 1,
      "maxItemExecutionRuns": 2
    }
  },
  "createdAt": "2023-01-01T00:00:00Z",
  "updatedAt": "2023-01-02T00:00:00Z",
  "useHighMemory": false
}

Attributes

AttributeDescriptionType
idUnique identifier of the workflowString
executionModeExecution mode (sync or async)String
aliasAlias of the workflowString
versionVersion of the workflowString
labelLabel or name of the workflowString
typeType of workflow (evaluation, contact, action)String
descriptionDescription of the workflowString
contextContext of the workflowString
inputSchemaInput schema of the workflowString
jsonSchemaJSON schema of the workflowString
uiSchemaUI schema of the workflowString
flowDefinitionWorkflow definitionObject
batchFlowDefinitionWorkflow definition for batch executionsObject
initialDataInitial data of the workflowString
scheduleWorkflow scheduleObject
scheduleBatchWorkflow schedule for batch executionObject
createdAtCreation date and timeString (ISO 8601)
updatedAtLast update date and timeString (ISO 8601)
useHighMemoryIndicates if the workflow requires running in a high resource environmentBoolean

Available Operations

Create a New Workflow

Creates a new workflow in the system.

POST /v1/workflows

Input Parameters

ParameterDescriptionTypeRequired
labelLabel or name of the workflowStringNo
aliasAlias of the workflowStringYes
typeType of workflowStringNo
versionVersion of the workflowStringYes
executionModeExecution modeStringNo
descriptionDescription of the workflowStringNo
inputSchemaInput schema of the workflowStringNo
jsonSchemaJSON schema of the workflowStringNo
uiSchemaUI schema of the workflowStringNo
initialDataInitial data of the workflowStringNo
flowDefinitionWorkflow definitionObjectNo
batchFlowDefinitionWorkflow definition for batch executionsObjectNo
contextContext of the workflowStringNo
useHighMemoryIndicates if the workflow requires running in a high memory environmentBooleanNo

Request Example

{
  "label": "Loan Approval",
  "alias": "loan-approval",
  "type": "evaluation",
  "version": "1.0",
  "description": "Workflow for loan approval",
  "flowDefinition": {},
  "batchFlowDefinition": {},
  "context": "loans"
}

Successful Response

{
  "id": "123e4567-e89b-12d3-a456-426614174000"
}

Update a Workflow

Updates an existing workflow.

PATCH /v1/workflows/:workflow_id

Path Parameters

ParameterDescription
workflow_idID of the workflow to update

Input Parameters

Same as for creation, all optional.

Request Example

{
  "label": "Loan Approval (Updated)",
  "description": "Updated workflow for loan approval"
}

Successful Response

Returns the updated Workflow object.

Delete a Workflow

Deletes a workflow from the system.

DELETE /v1/workflows/:workflow_id

Path Parameters

ParameterDescription
workflow_idID of the workflow to delete

Successful Response

Status code 204 (No Content) if the deletion was successful.

Get a Workflow

Retrieves information of a specific workflow.

GET /v1/workflows/:workflow_id

Path Parameters

ParameterDescription
workflow_idID of the workflow to retrieve

Successful Response

Returns the complete Workflow object.

List Workflows

Retrieves a paginated list of workflows with filtering and sorting options.

GET /v1/workflows

Query Parameters

ParameterDescriptionType
aliasFilter by aliasString
versionFilter by versionString
typeFilter by typeString
searchText to searchString
pagePage numberInteger
per-pageItems per pageInteger
sort-byField to sort byString
sort-directionSorting direction (asc or desc)String
contextFilter by contextString

Successful Response

Returns a paginated list of Workflow objects.

Execute a Workflow

Executes a specific workflow.

POST /v1/workflows/:workflow_id/execute

Path Parameters

ParameterDescription
workflow_idID of the workflow to execute

Input Parameters

A JSON object with the input data for the workflow.

Headers

HeaderDescription
x-batch-idBatch ID for batch executions
x-tagsTags for the execution, comma-separated
x-execution-modeExecution mode (sync or async)

Request Example

{
  "loanAmount": 50000,
  "creditScore": 750
}

Successful Response

Returns an ExecutionOutput object.

Execute a Workflow in Batch

Executes a specific workflow for all items in a batch.

POST /v1/workflows/:workflow_id/execute-batch

Path Parameters

ParameterDescription
workflow_idID of the workflow to execute in batch

Input Parameters

ParameterDescription
labelShort label for the batch
descriptionDetails about the batch
workflowInputJSON with fields items, rawPackageIds, and customInput
attachmentFileNamesOne or up to 5 file names that were uploaded with a pre-signed URL
maxExecutionsPerSecondMaximum number of executions per second allowed
maxConcurrentDispatchesMaximum number of concurrent executions allowed
maxItemExecutionRunsMaximum number of executions (including auto-retries) allowed per batch item before declaring the item as failed

The workflowInput JSON must have the structure described below:

FieldDescriptionType
itemsA list of dictionaries with input data for the execution of each batch item. This field is designed for quick tests of up to 10 itemsArray
rawPackageIdsA list of previously created package IDs containing attachments with information of the batch items that will be read, validated, and processed during batch execution. Up to 5 packages can be sentArray
customInputCustom formatted inputObject

Headers

HeaderDescription
x-tagsTags for the execution, comma-separated

Request Example

{
  "label": "Batch Loan Approval",
  "description": "Workflow for batch loan approval",
  "workflowInput": {
    "items": [
      { "person_id": "9999999999" },
      { "person_id": "1234567890" }
    ],
    "customInput": {},
    "rawPackageIds": []
  },
  "attachmentFileNames": [
    "file-name-returned-with-pre-signed-url.xlsx",
    "another-file-name-returned-with-pre-signed-url.xlsx"
  ],
  "maxExecutionsPerSecond": 1,
  "maxConcurrentDispatches": 1,
  "maxItemExecutionRuns": 2
}

Successful Response

{
    "executionBatchId": "009bddb2-1856-4afc-ae61-c243b7eb7e83",
    "workflowId": "072386f4-42c1-4685-ad5f-35a724486b24",
    "workflowAlias": "kyc",
    "workflowVersion": "v0",
    "executedAt": "2024-12-12T17:54:02.677597"
}

Error Handling

The API can return the following error codes:

CodeDescription
400Bad Request
401Unauthorized
403Forbidden
404Not Found
500Internal Server Error

Errors will include a descriptive message in the response body.