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

# Workflow Instances

> Terminate a running governance workflow instance with the OpenMetadata REST API

# Terminate a Workflow Instance

Stop a governance workflow instance and record it as `FAILURE`. Only administrators can call this endpoint.

**id** `string` *required*

UUID of the workflow instance to terminate.

**reason** `string`

Why you are terminating the instance. Up to 1,000 characters. OpenMetadata adds it to the audit text of the termination, for example `Terminated by <user>: <reason>`.

The request has no body.

```bash POST /v1/governance/workflowInstances/{id}/terminate theme={null}
curl -X POST "{base_url}/api/v1/governance/workflowInstances/{id}/terminate?reason=Stuck%20batch" \
  -H "Authorization: Bearer {access_token}"
```

## Returns

* **`200`**: The terminated workflow instance, recorded as `FAILURE`.
* **`202`**: A job of the instance's periodic batch trigger is running on this server. OpenMetadata records a stop request and returns the instance that is still running. The batch sink stops before its next sub-batch and the trigger stops before its next batch. Then the instance is recorded as `FAILURE`.

Terminating an instance deletes every running process of that instance, including a process that a server locked and then stopped in the middle of a job. A lock that another running server holds can't be told apart from that case, so that process is deleted too. For a workflow without a batch trigger, that job can keep applying side effects, such as entity updates, after the `200`.

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | The caller is not an administrator |
| `404` | `ENTITY_NOT_FOUND` | No workflow instance exists for the given ID |
| `409` | `WORKFLOW_INSTANCE_CONFLICT` | The instance already ended, or a job of its process is running and the process doesn't read a stop request. Retry after the job finishes. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.