> For the complete documentation index, see [llms.txt](https://docs.erathos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.erathos.com/api/introduction/trigger-jobs-outside-erathos.md).

# Trigger jobs outside Erathos

<div data-full-width="false"><figure><img src="/files/9bCWAfvJFpkc8b5XLJrH" alt=""><figcaption></figcaption></figure></div>

To register a webhook, you need to provide the following information:

* **description**: A text description to help identify the functionality of the webhook.
* **jobs**: A list of Job IDs (UUIDs) that should trigger the webhook. These IDs can be found through the Jobs endpoint in the workspace.
* **method**: The type of HTTP request (GET, POST, PATCH, PUT).
* **url**: The destination URL where the webhook will be sent.
* **header**: Additional fields to include in the request, such as Content-Type and Authorization.
* **body**: The request body, which can include static or dynamic data, using execution metadata.
* **rules**: A list of conditions that must be met for the webhook to be triggered. All rules must be satisfied for the webhook to be sent.
  * **variable\_name**: The name of the metadata variable available (check the **Erathos Metadata** section).
  * **operation**: One of the accepted operations depending on the variable type (check the **Rules** section).
  * **value**: A string or list of strings corresponding to the desired values.

The **url**, **header**, and **body** fields support the use of dynamic values in the format `${{variables.my_variable}}`, `${{secrets.my_secrets}}`, `${{erathos.rows}}`. These references will be replaced with real values before sending the webhook, using variables and secrets previously registered by the user, as well as metadata values from the execution that triggered the webhook.

### Example

Below is an example of a webhook that triggers the execution of a DAG in Airflow after the successful completion of a Job, with execution between 00:00 and 08:00 on weekdays, and only if at least one record has been transferred:

```json
{   
    "description": "airflow_trigger_example",
    "is_active": true,
    "jobs": [
        "uuid_1", 
        "uuid_2", 
        ..., 
        "uuid_n"
    ],
    "method": "POST",
    "url": "https://{{variables.TOOL_URL}}/api/v1/dags/{{erathos.JOB_ID}}/dagRuns",
    "header": {
        "Content-Type": "application/json",
        "Authorization": "Basic ${{secrets.USER_KEY}}"
    },
    "body": {
        "conf": {
            "name": "${{erathos.TABLE_NAME}}",
            "status": "${{erathos.STATUS}}"
        }
    },
    "rules": [
        {
            "erathos_variable": "STATUS",
            "operation": "EQUAL",
            "value": "FINISHED"
        },
        {
            "erathos_variable": "ROWS",
            "operation": "GREATER_THAN",
            "value": "0"
        },
        {
            "erathos_variable": "FINISHED_AT_TIME",
            "operation": "GREATER_THAN",
            "value": "00:00"
        },
        {
            "erathos_variable": "FINISHED_AT_TIME",
            "operation": "LESS_THAN",
            "value": "08:00"
        },
        {
            "erathos_variable": "FINISHED_AT_WEEKDAY",
            "operation": "NOT_IN",
            "value": ["0", "6"]
        }
    ]
}
```

{% hint style="info" %}
More examples are available in the [Templates section](/api/quickstart.md).
{% endhint %}

After building your webhook, send a request to the [**Create Webhook** endpoint](/api/api-reference/orchestration.md#developers-workspaces-workspace_id-orchestration-webhooks-1) to register it.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.erathos.com/api/introduction/trigger-jobs-outside-erathos.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
