> For the complete documentation index, see [llms.txt](https://docs.transactionlink.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.transactionlink.io/docs/v1/transactionlink-api/api-reference/workflows.md).

# Workflows

{% hint style="info" %}
To enable the workflow to be triggered via the public API, ensure proper configuration while avoiding any tasks that necessitate interaction with the end user.
{% endhint %}

## Run Workflow

> Differences between versions: version 1 relies on caseId and is scheduled for deprecation, whereas version 2 uses recordId (this field is optional) and is recommended moving forward.

```json
{"openapi":"3.0.3","info":{"title":"TransactionLink API","version":"1.0.0"},"tags":[],"servers":[{"url":"https://api.transactionlink.io","description":"Production environment"}],"paths":{"/workflows/run":{"post":{"tags":["Workflows"],"summary":"Run Workflow","description":"Differences between versions: version 1 relies on caseId and is scheduled for deprecation, whereas version 2 uses recordId (this field is optional) and is recommended moving forward.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkflowExecutionDto"}},"application/json;version=2":{"schema":{"$ref":"#/components/schemas/CreateWorkflowExecutionV2Dto"}}}},"responses":{"200":{"description":"Workflow has been run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowExecutionQueryDto"}}}},"404":{"description":"Workflow Definition Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"CreateWorkflowExecutionDto":{"type":"object","required":["caseId","workflowDefinitionId"],"properties":{"caseId":{"type":"string","format":"uuid","description":"Case identifier for which we want to initiate the workflow"},"workflowDefinitionId":{"type":"string","description":"ID of the workflow definition"},"parametersId":{"type":"string","description":"ID of the parameters used in workflow"}}},"CreateWorkflowExecutionV2Dto":{"type":"object","required":["workflowDefinitionId"],"properties":{"recordId":{"type":"string","format":"uuid","description":"Record identifier for which we want to initiate the workflow"},"workflowDefinitionId":{"type":"string","format":"uuid","description":"ID of the workflow definition"},"parametersId":{"type":"string","format":"uuid","description":"ID of the parameters used in the workflow"}}},"WorkflowExecutionQueryDto":{"type":"object","required":["id","caseId","status"],"properties":{"id":{"type":"string","format":"uuid","description":"ID of the Workflow"},"caseId":{"type":"string","description":"ID of the Case"},"status":{"type":"string","enum":["COMPLETED","FAILED","RUNNING"],"description":"Status of the workflow"}}},"ErrorResponse":{"type":"object","required":["fingerprint","errors"],"properties":{"fingerprint":{"type":"string","description":"error id"},"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"Error code"},"message":{"type":"string","description":"Error message"}}}}}}}}}
```

## Get Workflow Result

> Retrieve the result of a workflow

```json
{"openapi":"3.0.3","info":{"title":"TransactionLink API","version":"1.0.0"},"tags":[],"servers":[{"url":"https://api.transactionlink.io","description":"Production environment"}],"paths":{"/workflows/{workflowId}/result":{"get":{"tags":["Workflows"],"summary":"Get Workflow Result","description":"Retrieve the result of a workflow","parameters":[{"in":"path","name":"workflowId","schema":{"type":"string","format":"uuid"},"required":true,"description":"Workflow identifier"}],"responses":{"200":{"description":"Returns the workflow result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseDto"}}}},"404":{"description":"Workflow not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"CaseDto":{"type":"object","required":["caseId","partyId","partyDetails","createdDate"],"properties":{"createdDate":{"type":"string","description":"Creation time"},"caseId":{"type":"string","description":"Case Id"},"partyId":{"type":"string","description":"Case id"},"partyDetails":{"type":"object","required":["personal","business","documents"],"properties":{"personal":{"type":"object","required":["firstName","lastName","personalNumber","email","phone"],"properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"personalNumber":{"type":"string"},"email":{"type":"string"},"phone":{"type":"object","required":["countryCode","number"],"properties":{"countryCode":{"type":"string"},"number":{"type":"string"}}}}},"business":{"type":"object","required":["companyNumber","companyName","companyAddress"],"properties":{"companyNumber":{"type":"string"},"companyName":{"type":"string"},"companyAddress":{"type":"string"}}},"documents":{"type":"array","items":{"type":"object","properties":{"resourceId":{"type":"string","description":"resource id"},"resourceName":{"type":"string","description":"file name"},"resourcePath":{"type":"string","description":"resource path"}}}}}}}},"ErrorResponse":{"type":"object","required":["fingerprint","errors"],"properties":{"fingerprint":{"type":"string","description":"error id"},"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"Error code"},"message":{"type":"string","description":"Error message"}}}}}}}}}
```

## Check Workflow Status

> Check the status of a workflow

```json
{"openapi":"3.0.3","info":{"title":"TransactionLink API","version":"1.0.0"},"tags":[],"servers":[{"url":"https://api.transactionlink.io","description":"Production environment"}],"paths":{"/workflows/{workflowId}":{"get":{"tags":["Workflows"],"summary":"Check Workflow Status","description":"Check the status of a workflow","parameters":[{"in":"path","name":"workflowId","schema":{"type":"string","format":"uuid"},"required":true,"description":"Workflow identifier"}],"responses":{"200":{"description":"Returns the Workflow Status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkflowExecutionQueryDto"}}}},"404":{"description":"Workflow not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"WorkflowExecutionQueryDto":{"type":"object","required":["id","caseId","status"],"properties":{"id":{"type":"string","format":"uuid","description":"ID of the Workflow"},"caseId":{"type":"string","description":"ID of the Case"},"status":{"type":"string","enum":["COMPLETED","FAILED","RUNNING"],"description":"Status of the workflow"}}},"ErrorResponse":{"type":"object","required":["fingerprint","errors"],"properties":{"fingerprint":{"type":"string","description":"error id"},"errors":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"Error code"},"message":{"type":"string","description":"Error message"}}}}}}}}}
```
