Workflow Execution

Manage workflow execution runs including creating executions, monitoring execution state, and retrieving execution statistics and resume data

Get Execution Statistics

GET /v1/executions/statistics

Get execution statistics for a specific project, with optional filtering by time period and status.

Query Parameters:

  • projectId (string, required): Project UUID to get statistics for
  • lastDays (string, optional): Comma-separated numbers of last days to get statistics for
  • statuses (string, optional): Comma-separated statuses to filter by (ASSIGNED, CANCELLED, COMPLETED, FAILED, RUNNING, TERMINATED)

Response (200 OK):

{
    "allTime": {
        "count": 245
    },
    "lastDays": {
        "7": {
            "count": 18,
            "change": 3
        },
        "30": {
            "count": 67,
            "change": -12
        }
    },
    "statuses": {
        "COMPLETED": {
            "count": 180
        },
        "RUNNING": {
            "count": 15
        },
        "FAILED": {
            "count": 32
        },
        "CANCELLED": {
            "count": 18
        }
    }
}

Create Workflow Execution

POST /v1/executions

Create a new workflow execution for a specific workflow.

Request Body:

Required fields:

  • workflowId

Optional fields:

  • version
{
    "workflowId": "6c06edfb-1cec-4f41-9c89-96204f1a2cb0",
    "version": 1
}

Response (201 Created):

{
    "id": "9a15edfb-1cec-4f41-9c89-96204f1a2ca1",
    "workflowId": "6c06edfb-1cec-4f41-9c89-96204f1a2cb0",
    "status": "RUNNING",
    "completedAt": null,
    "createdAt": "2024-01-20T10:30:00.000Z",
    "failures": []
}

List Executions

GET /v1/executions

Get a paginated list of workflow executions with optional filtering and sorting.

Query Parameters:

  • withFailures (string, optional): Include failures in the execution (default: false)
  • pageSize (string, optional): Number of items per page (1-1000, default: 10)
  • afterCursor (string, optional): Cursor for next page pagination
  • beforeCursor (string, optional): Cursor for previous page pagination
  • status (string, optional): Comma-separated statuses to filter by (ASSIGNED, CANCELLED, COMPLETED, FAILED, RUNNING, TERMINATED)
  • workflowId (string, optional): Filter by workflow UUID
  • projectId (string, optional): Filter by project UUID
  • createdAt (string, optional): Filter by creation date (ISO 8601)
  • sortDirection (string, optional): Sort direction (asc, desc, default: asc)
  • sortFields (string, optional): Comma-separated fields to sort by (createdAt)

Response (200 OK):

{
    "content": [
        {
            "id": "9a15edfb-1cec-4f41-9c89-96204f1a2ca1",
            "workflowId": "6c06edfb-1cec-4f41-9c89-96204f1a2cb0",
            "status": "COMPLETED",
            "completedAt": "2024-01-20T11:45:00.000Z",
            "createdAt": "2024-01-20T10:30:00.000Z",
            "failures": []
        },
        {
            "id": "7b24fdc8-3ded-5g52-8d90-85305e2b3db2",
            "workflowId": "6c06edfb-1cec-4f41-9c89-96204f1a2cb0",
            "status": "FAILED",
            "completedAt": "2024-01-19T16:20:00.000Z",
            "createdAt": "2024-01-19T16:15:00.000Z",
            "failures": [
                {
                    "id": "f3d5b729-4e61-4a23-b890-c7d8e9f1a2b3",
                    "executionId": "7b24fdc8-3ded-5g52-8d90-85305e2b3db2",
                    "stepExecutionId": "a8c9d4e5-f6g7-h8i9-j0k1-l2m3n4o5p6q7",
                    "cause": {
                        "message": "Connection timeout to external service"
                    },
                    "createdAt": "2024-01-19T16:20:00.000Z",
                    "updatedAt": "2024-01-19T16:20:00.000Z",
                    "deletedAt": null
                }
            ]
        }
    ],
    "afterCursor": "eyJjcmVhdGVkQXQiOiIyMDI0LTAxLTE5VDE2OjE1OjAwLjAwMFoifQ==",
    "beforeCursor": null
}

Get Execution State

GET /v1/executions/{id}/state

Get the current state of a workflow execution for polling purposes.

Path Parameters:

  • id (string, required): Execution UUID

Query Parameters:

  • stepExecutionId (string, required): Step execution UUID
  • taskId (string, required): Task UUID

Response (200 OK):

{
    "stopPolling": false,
    "executionStatus": "RUNNING",
    "stepExecutionStatus": "RUNNING",
    "stepExecutionId": "a8c9d4e5-f6g7-h8i9-j0k1-l2m3n4o5p6q7",
    "stepType": "forms",
    "stepExecutionMetadata": {
        "resourceId": "form-123456",
        "participantId": "user-789012",
        "message": "Waiting for form submission",
        "error": null
    }
}

Get Execution Resume Data

GET /v1/executions/{id}/resume

Get information required to resume a paused or interrupted workflow execution.

Path Parameters:

  • id (string, required): Execution UUID

Response (200 OK):

{
    "location": "https://api-us.fslcap.io/workflows/sessions/resume/9a15edfb-1cec-4f41-9c89-96204f1a2ca1"
}