# Run a test execution

> Schedule a cloud test execution of the published version with an optional trigger payload. Poll the execution for the result.

Source: https://docs.generalinput.com/api/workflows/test



<Endpoint method="POST" path="/v1/workflows/:id/test" />

<Access scope="workflows:manage" />

Runs the **live** bundle, so publish first. Test runs execute even when the workflow is disabled. The call returns as soon as the run is scheduled; read the outcome from [get an execution](/api/workflows/get-execution).

## Body [#body]

| Field            | Type   | Notes                                                  |
| ---------------- | ------ | ------------------------------------------------------ |
| `triggerPayload` | object | Optional. Becomes the run's `input`. Defaults to `{}`. |

## Response [#response]

```json
{ "executionId": "exec_01HX…" }
```

When the workflow is not ready, nothing is scheduled and the blockers are returned instead:

```json
{
  "executionId": null,
  "blockers": [{ "message": "Credential slot 'slack' is not wired." }]
}
```

Fix them with [update config](/api/workflows/update-config) and call again.

## Polling [#polling]

```sh
curl -s "https://cloud.generalinput.com/v1/workflows/wf_01HX/executions/exec_01HX" \
  -H "Authorization: Bearer $GI_API_KEY" | jq '{status, error}'
```

Poll every few seconds until `status` leaves `scheduled` and `running`. Code runs usually finish in seconds; agent runs take minutes.
