> ## Documentation Index
> Fetch the complete documentation index at: https://developers.hubspot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow run and run reporting APIs (BETA)

> Learn how to create, update, cancel, and retrieve data on your workflows' runs.

> [accordion] Required Scopes

> [!WARNING]
>
> This functionality is currently in beta. By participating in this beta, you agree to HubSpot's [Developer Terms](https://legal.hubspot.com/developer-terms) and [Developer Beta Terms](https://legal.hubspot.com/developerbetaterms). Note that the functionality is still under active development and is subject to change based on testing and feedback.

After setting up your [workflows](https://developers.hubspot.com/docs/api-reference/2027-03-beta/automation/workflows/guide.md), use the following APIs to create, cancel, and retrieve data on your workflows' runs. The sections below provide a walkthrough of how to use these endpoints.

## Scope requirements

The following additional app permissions are required to use the workflows API, based on the endpoints you're using:

* `workflows.read`: grants access to view details about workflows and workflow definitions. This scope is required for all endpoints.
* `workflows.write`: grants access to create and modify workflows. This is required for all modification endpoints.
* `workflows.trigger`: grants access to manually run a workflow.

In addition, to access sensitive data properties in a workflow, run records in a workflow that references sensitive data, or retrieve run and reporting data for workflows with sensitive data properties, you'll need to authorize sensitive data scopes as detailed below:

* `crm.objects.contacts.sensitive.read`: view enrollment and performance data for existing contact-based workflows.
* `crm.objects.companies.sensitive.read`: view enrollment and performance data for existing company-based workflows.
* `crm.objects.deals.sensitive.read`: view enrollment and performance data for existing deal-based workflows.
* `crm.objects.custom.sensitive.read`: view enrollment and performance data for workflows based on custom objects in an account.

## Create a new workflow run

To create a new workflow run, you'll need to send the following requests:

* First, retrieve run inputs using a `GET` request to `/automation/workflows-runs/2027-03-beta/run-inputs/{flowId}`.
* After retrieving necessary inputs, send a `POST` request to `/automation/workflows-runs/2027-03-beta/run`.

### Retrieve run inputs

To retrieve workflow run inputs, make a `GET` request to `/automation/workflows-runs/2027-03-beta/run-inputs/{flowId}`. Replace `{flowId}` with the ID of the workflow.

The response lists each required input in the `requiredInputs` array. Each input includes the `actionIds` of the workflow actions that use it.

* `requiredInputs`: the inputs required to start a run.
* `tokenString`: the name of the input. Use this value as the `tokenString` when you start a run.
* `fieldTypeDefinition`: the data type of the input. This includes `name`, `type`, `label`, `description`, and `propertyFieldType`.
* `actionIds`: the IDs of any workflow actions that use this input.
* `triggerObjectTypeId`: the object type ID for the workflow's trigger.

```json expandable title="Example retrieve run inputs response" theme={null}
{
  "requiredInputs": [
    {
      "tokenString": "someInputName",
      "fieldTypeDefinition": {
        "name" : "someName",
        "type" : "number",
        "label": "input name",
        "description": "the input description",
        "propertyFieldType": "number"
      },
      "actionIds": [ "1", "2" ]
    }
  ],
  "triggerObjectTypeId": "0-1" 
}
```

### Start a manual workflow run

To start a new manual workflow run, make a `POST` request to `/automation/workflows-runs/2027-03-beta/run`.

In the body of your request, include the workflow's ID and a value for each required input. You can also include the CRM record that the run applies to. The workflow must be published (turned on) to run. If the request is successful, a `201` status code and the ID of the new run will be returned.

| Parameter | Type | Description |
| - | - | - |
| `flowId` Required | String | The ID of the workflow to run. Must be a numeric string. |
| `runInputs` Required | Array | The input values for the workflow. Include a value for each required input when [retrieving your workflow's run inputs](#retrieve-run-inputs). This includes the following: <ul><li>`tokenString`: The name of the input.  </li><li>`fieldValue`: The value of the input. <ul><li>`type`: the data type of the value. One of `NULL`, `STRING`, `BOOLEAN`, `INTEGER`, `LONG`, `FLOAT`, `DOUBLE`, `LIST`, or `MAP`. </li><li>`value`: the value for the field.</li></ul> </li></ul> |
| `triggerRecordInput` | Object | The CRM record that the run applies to. This is optional. When using this field: <ul><li>`objectTypeId`: The object type ID of the record.</li><li>`objectId`: The ID of the record.</li></ul> |

In the following example, the request will run the workflow with the `flowId` of `001001`. The new run will have a `runId` of `12121`.

> [tab] Example request
>
> ```json theme={null}
> {
>   "flowId": "001001",
>   "runInputs": [
>     {
>       "tokenString": "someInputName",
>       "fieldValue": {
>          "value": "some value"
>       }
>     }
>   ],
>   "triggerRecordInput": {
>     "objectTypeId": "0-1",
>     "objectId": "2323"
>   }
> }
> ```

> [tab] Example response
>
> ```json theme={null}
> {
>   "runId": "12121"
> }
> ```

## Retrieve a workflow run's status

To check on the status of your workflow run, make a `GET` request to `/automation/workflows-runs/2027-03-beta/run/{runId}`. Replace `{runId}` with the ID returned by the start request.

The `enrollmentState` will reflect the status of the run:

* `RUNNING`: the run is in progress.
* `CANCELED`: the run was canceled. Learn how to [cancel a workflow run](#cancel-a-workflow-run).
* `COMPLETED`: the run finished.
* `FAILED`: the run failed.

```json title="Example workflow run status response" theme={null}
{
  "enrollmentState": "RUNNING"
}
```

## Cancel a workflow run

To cancel a run, make a `POST` request to `/automation/workflows-runs/2027-03-beta/run/unenroll`. Identify the run by its workflow ID and CRM record. If the cancellation is successful, the response will return a `204` status code and no body.

| Parameter | Type | Description |
| - | - | - |
| `flowId` Required | String | The ID of the workflow that the run belongs to. |
| `objectTypeId` Required | String | The object type ID of the CRM record. |
| `objectId` Required | String | The ID of the CRM record. |

```json theme={null}
{
  "flowId": "001001",
  "objectTypeId": "0-1",
  "objectId": "2323"
}
```

## Retrieve runs for a specific workflow

To check a workflow's runs over a specified period of time, make a `POST` request to `/automation/workflows-reporting/2027-03-beta/performance/query`. Include the workflow ID, a start date, an end date, and a frequency.

| Parameter | Type | Description |
| - | - | - |
| `flowId` Required | String | The ID of the workflow. Must be a numeric string. You can query deleted workflows. |
| `startDate` Required | Date | The first day of the range, in `YYYY-MM-DD` format. Must be on or before `endDate`. |
| `endDate` Required | Date | The last day of the range, in `YYYY-MM-DD` format. |
| `frequency` Required | String | How to group the results. One of `DAILY`, `WEEKLY_STARTING_SUNDAY`, `WEEKLY_STARTING_MONDAY`, `MONTHLY`, `QUARTERLY`, `YEARLY`, or `TOTAL`. |

The response data will include the following:

* `startDate`: the start of the requested range.
* `endDate`: the end of the requested range.
* `frequency`: the frequency that the results are grouped by.
* `counters`: the performance data for each period that has data.
* `date`: the start date of the period.
* `runsTotal`: the total number of runs in the period.
* `currentlyRunningTotal`: the number of runs that are still in progress.
* `completedTotal`: the number of completed runs.
* `canceledEarlyTotal`: the number of runs that were canceled before they finished.
* `failedTotal`: the number of failed runs.
* `uniqueCrmObjectRunsTotal`: the number of unique CRM records that had a run in the period.

In the following example, the request will retrieve the run data for the workflow with a `flowId` of `001001`, from January 1st, 2026, to February 1st, 2026.

> [tab] Example request
>
> ```json theme={null}
> {
>   "flowId": "001001",
>   "startDate": "2026-01-01",
>   "endDate": "2026-02-01",
>   "frequency": "DAILY"
> }
>
> ```

> [tab] Example response
>
> ```json theme={null}
> {
>   "startDate": "2026-01-01",
>   "endDate": "2026-02-01",
>   "frequency": "DAILY",
>   "counters": [
>     {
>        "date": "2026-01-01",
>        "runsTotal": 5,
>        "currentlyRunningTotal": 5,
>        "completedTotal": 0,
>        "canceledEarlyTotal": 0,
>        "failedTotal": 0,
>        "uniqueCrmObjectRunsTotal": 5
>     }
>   ]
> }
>
> ```

## Retrieve all current workflow runs for a CRM record

To find all workflows that a CRM record is currently running in, make a `GET` request to `/automation/workflows-reporting/2027-03-beta/current-runs/{objectType}/{objectId}`. Replace `{objectType}` with an [object type](https://developers.hubspot.com/docs/api-reference/latest/crm/using-object-apis.md#object-type-id-values) and `{objectId}` with the ID of the record. If the record has no current runs, the response has a `200` status code and an empty `results` array.

The response will include:

* `results`: current runs for the CRM record.
* `flowId`: the ID of the workflow.
* `runId`: the ID of the run.

```json title="Example retrieve workflow runs response" theme={null}
{
  "results": [
    {
      "flowId": "001011",
      "runId": "12121"
    }
  ]
}
```
