# Metadata

## Overview

To assist in creating custom logic and handling based on execution results, the platform provides a series of metadata related to job executions. These metadata can be used in webhooks to create specific sending conditions. The available metadata are:

<table><thead><tr><th>Name</th><th width="124">Type</th><th>Description</th></tr></thead><tbody><tr><td>JOB_ID</td><td><code>uuid</code></td><td><p></p><p>Unique Job Identifier: Represents an endpoint for API connectors or a table for database connections. This unique identifier is used to distinguish and track specific jobs within the platform.</p></td></tr><tr><td>CONNECTION_ID</td><td><code>uuid</code></td><td>Unique Connection Identifier.</td></tr><tr><td>CONNECTION_NAME</td><td><code>string</code></td><td>Connection Name</td></tr><tr><td>SCHEMA_NAME</td><td><code>string</code></td><td>Name of the schema used for the pipeline tables in the destination Data Warehouse.</td></tr><tr><td>TABLE_NAME</td><td><code>string</code></td><td>Name of the table or endpoint in the destination Data Warehouse.</td></tr><tr><td>EXECUTION_ID</td><td><code>uuid</code></td><td>Identifier of the job execution that triggered the webhook.</td></tr><tr><td>STATUS</td><td><code>string</code></td><td>Final status of the execution (FINISHED, FAILED).</td></tr><tr><td>ROWS</td><td><code>integer</code></td><td>Number of rows found during the execution.</td></tr><tr><td>COLUMNS</td><td><code>integer</code></td><td>Number of selected columns.</td></tr><tr><td>TOTAL_DURATION</td><td><code>integer</code></td><td>Execution duration in seconds.</td></tr><tr><td>TRIGGERED_BY</td><td><code>string</code></td><td><p></p><p>Indicates the origin of the execution, divided into:</p><ul><li>Erathos Schedule: regular schedules based on the selected frequency.</li><li>User's Email: manual executions via the platform.</li><li>API Key Owner's Email: programmatic triggers via the API.</li></ul></td></tr><tr><td>IS_ORCHESTRATION</td><td><code>boolean</code></td><td>Indicator <strong>True</strong> for executions triggered programmatically or <strong>False</strong> for executions triggered by scheduling or manually via the platform.</td></tr><tr><td>FORCE_HISTORY</td><td><code>boolean</code></td><td>Indicator <strong>True</strong> for <code>FULL</code> type executions and <strong>False</strong> for <code>PARTIAL</code> type executions.</td></tr><tr><td>NESTED_TABLE</td><td><code>boolean</code></td><td>Indicator if the table is nested (always False for database connectors).</td></tr><tr><td>FINISHED_AT_DATE</td><td><code>date</code></td><td>Completion date of the execution in YYYY-MM-DD format.</td></tr><tr><td>FINISHED_AT_TIME</td><td><code>time</code></td><td>Time of completion of the execution in UTC time zone and in HH:MM format.</td></tr><tr><td>FINISHED_AT_WEEKDAY</td><td><code>integer</code></td><td>Day of the week corresponding to the completion of the execution (0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday).</td></tr></tbody></table>

## Alternative usage

In addition to orchestrating external tasks, webhooks can also be used as a method for ingesting execution metadata, which can be sent to various destinations or even to a custom API.

```json

{
  "description": "Send metadata to custom API",
  "is_active": true,
  "method": "POST",
  "url": "https://${{variables.api_url}}",
  "header": {
    "Authorization": "${{secrets.token}}" 
  },
  "body": {
    "job_id": "${{erathos.job_id}}",
    "connection_id": "${{erathos.connection_id}}",
    "connection_name": "${{erathos.connection_name}}",
    "schema_name": "${{erathos.schema_name}}",
    "table_name": "${{erathos.table_name}}",
    "execution_id": "${{erathos.execution_id}}",
    "status": "${{erathos.status}}",
    "rows": "${{erathos.rows}}",
    "columns": "${{erathos.columns}}",
    "total_duration": "${{erathos.total_duration}}",
    "triggered_by": "${{erathos.triggered_by}}",
    "is_orchestration": "${{erathos.is_orchestration}}",
    "force_history": "${{erathos.force_history}}",
    "nested_table": "${{erathos.nested_table}}",
    "finished_at_date": "${{erathos.finished_at_date}}",
    "finished_at_time": "${{erathos.finished_at_time}}",
    "finished_at_weekday": "${{erathos.finished_at_weekday}}"
  },
  "rules": [
  ],
  "jobs": [
    "<ERATHOS_JOB1_ID>",
    "<ERATHOS_JOB2_ID>",
    ...
    "<ERATHOS_JOBN_ID>"
  ]
}
```
