Workflow Runs

The /workflows/runs endpoints allows you to manage your Workflows Runs.

List Workflow Runs

Endpoint: /workflows/runs

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>
Content-Typeapplication/json

Input Parameters

ParameterData TypeDescription
document_idstring(Optional) The ID of the document to filter by.
event_namestring(Optional) The name of the event to filter by.
rule_idstring(Optional) The ID of the rule to filter by.

Example Request

{
  "document_id": "<DOCUMENT_ID>",
  "event_name": "create",
  "rule_id": "<RULE_ID>"
}

Example Response

{
  "runs": [
    {
      "status": "COMPLETED",
      "started_at": 1678886400,
      "closed_at": 1678886460,
      "execution_duration": 60,
      "run_id": "<RUN_ID>",
      "workflow_id": "<WORKFLOW_ID>",
      "type": "StandardContentIngestion"
    }
  ]
}

Code Examples

List Workflow Runs

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/workflows/runs' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "document_id": "<DOCUMENT_ID>",
  "event_name": "create",
  "rule_id": "<RULE_ID>"
}'

Get Run Details

Endpoint: /workflows/runs/<WORKFLOW_ID>/<RUN_ID>

Method: GET

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>

Path Parameters

ParameterDescription
<WORKFLOW_ID>The ID of the Workflow.
<RUN_ID>The ID of the Run.

Example Request

There is no JSON body with this request.

Example Response

{
  "status": "COMPLETED",
  "started_at": 1678886400,
  "closed_at": 1678886460,
  "execution_duration": 60,
  "run_id": "<RUN_ID>",
  "workflow_id": "<WORKFLOW_ID>",
  "type": "StandardContentIngestion",
  "history": [
    {
      "event_id": 1,
      "event_time": 1678886400,
      "event_type": "WorkflowExecutionStarted",
      "task_id": "1",
      "attempt": 0,
      "activity": {
        "name": "StandardContentIngestion",
        "id": "1",
        "input": {
          "documentId": "<DOCUMENT_ID>"
        }
      }
    },
    {
      "event_id": 2,
      "event_time": 1678886460,
      "event_type": "WorkflowExecutionCompleted",
      "task_id": "2",
      "attempt": 0,
      "result": {
        "documentId": "<DOCUMENT_ID>"
      }
    }
  ]
}

Code Examples

Get Run Details

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/workflows/runs/<WORKFLOW_ID>/<RUN_ID>' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>'

Terminate Workflow Run

Endpoint: /workflows/runs/<WORKFLOW_ID>/<RUN_ID>/terminate

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>
Content-Typeapplication/json

Path Parameters

ParameterDescription
<WORKFLOW_ID>The ID of the Workflow.
<RUN_ID>The ID of the Run.

Input Parameters

ParameterData TypeDescription
reasonstring(Optional) The reason for terminating the Workflow Run.

Example Request

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/workflows/runs/<WORKFLOW_ID>/<RUN_ID>/terminate' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reason": "User requested termination"
}'

Example Response

{
  "message": "Workflow <RUN_ID> terminated"
}

Code Examples

Terminate Workflow Run

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/workflows/runs/<WORKFLOW_ID>/<RUN_ID>/terminate' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reason": "User requested termination"
}'

Cancel Workflow Run

Endpoint: /workflows/runs/<WORKFLOW_ID>/<RUN_ID>/cancel

Method: POST

Headers

HeaderValue
AuthorizationBearer <YOUR_JWT_TOKEN>
Content-Typeapplication/json

Path Parameters

ParameterDescription
<WORKFLOW_ID>The ID of the Workflow.
<RUN_ID>The ID of the Run.

Input Parameters

ParameterData TypeDescription
reasonstring(Optional) The reason for cancelling the Workflow Run.

Example Request

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/workflows/runs/<WORKFLOW_ID>/<RUN_ID>/cancel' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reason": "User requested cancellation"
}'

Example Response

{
  "message": "Workflow <RUN_ID> cancelled"
}

Code Examples

Cancel Workflow Run

curl --location 'https://studio-server-production.api.becomposable.com/api/v1/workflows/runs/<WORKFLOW_ID>/<RUN_ID>/cancel' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "reason": "User requested cancellation"
}'

Was this page helpful?