> For the complete documentation index, see [llms.txt](https://docs.terrakube.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terrakube.io/2.34.0/api-reference/methods/run-trigger.md).

# Run Trigger

Links two workspaces so that an apply in the source queues a run in the destination. See [Run Triggers](/2.34.0/run-terraform/workspaces/run-triggers.md).

{% hint style="warning" %}
Requires manage rights on the destination workspace and visibility of the source workspace.
{% endhint %}

### Entity fields:

| Path                                         | Type    | Description                                                                                 |
| -------------------------------------------- | ------- | ------------------------------------------------------------------------------------------- |
| data.type                                    | string  | Should be "runTrigger"                                                                      |
| data.attributes.enabled                      | boolean | Disabled triggers are kept but never fire (default true)                                    |
| data.relationships.sourceWorkspace.data      | object  | Workspace whose apply fires the trigger. Cannot be changed after creation                   |
| data.relationships.destinationWorkspace.data | object  | Workspace that receives the run. Cannot be changed after creation                           |
| data.relationships.template.data             | object  | Template to run in the destination (OPTIONAL, defaults to the workspace's default template) |

### Example:

```json
{
  "data": {
    "type": "runTrigger",
    "attributes": { "enabled": true },
    "relationships": {
      "sourceWorkspace": { "data": { "type": "workspace", "id": "{{sourceWorkspaceId}}" } },
      "destinationWorkspace": { "data": { "type": "workspace", "id": "{{destinationWorkspaceId}}" } }
    }
  }
}
```

A trigger that would create a loop is rejected with the offending path in the error. To list both directions for a workspace, filter with `sourceWorkspace.id==X,destinationWorkspace.id==X` (a comma is OR).

### Supported Operations

{% openapi src="/files/wEuaGXYkxSno71qvCZ5K" path="/runTrigger" method="get" %}
[terrakube-api.json](https://1229094460-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTN6M529qVFnas8hChf2y%2Fuploads%2Fgit-blob-0acd82539462c1a831ed163d0be74acfea79e5d7%2Fterrakube-api.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wEuaGXYkxSno71qvCZ5K" path="/runTrigger" method="post" %}
[terrakube-api.json](https://1229094460-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTN6M529qVFnas8hChf2y%2Fuploads%2Fgit-blob-0acd82539462c1a831ed163d0be74acfea79e5d7%2Fterrakube-api.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wEuaGXYkxSno71qvCZ5K" path="/runTrigger/{runTriggerId}" method="get" %}
[terrakube-api.json](https://1229094460-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTN6M529qVFnas8hChf2y%2Fuploads%2Fgit-blob-0acd82539462c1a831ed163d0be74acfea79e5d7%2Fterrakube-api.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wEuaGXYkxSno71qvCZ5K" path="/runTrigger/{runTriggerId}" method="patch" %}
[terrakube-api.json](https://1229094460-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTN6M529qVFnas8hChf2y%2Fuploads%2Fgit-blob-0acd82539462c1a831ed163d0be74acfea79e5d7%2Fterrakube-api.json?alt=media)
{% endopenapi %}

{% openapi src="/files/wEuaGXYkxSno71qvCZ5K" path="/runTrigger/{runTriggerId}" method="delete" %}
[terrakube-api.json](https://1229094460-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTN6M529qVFnas8hChf2y%2Fuploads%2Fgit-blob-0acd82539462c1a831ed163d0be74acfea79e5d7%2Fterrakube-api.json?alt=media)
{% endopenapi %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.terrakube.io/2.34.0/api-reference/methods/run-trigger.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
