ReferenceAPI ReferenceTriggers

Triggers

Triggers define automated conditions for running a pipeline. When a trigger’s condition is met (file upload, cron schedule, upstream pipeline success, webhook call, file pattern match, or cron with dependencies), RAT automatically creates and dispatches a run.

Triggers are nested under a pipeline resource and require the PipelineTriggerStore to be configured.


Endpoints

MethodEndpointDescription
GET/api/v1/pipelines/{ns}/{layer}/{name}/triggersList triggers for a pipeline
POST/api/v1/pipelines/{ns}/{layer}/{name}/triggersCreate a trigger
GET/api/v1/pipelines/{ns}/{layer}/{name}/triggers/{id}Get trigger details
PUT/api/v1/pipelines/{ns}/{layer}/{name}/triggers/{id}Update a trigger
DELETE/api/v1/pipelines/{ns}/{layer}/{name}/triggers/{id}Delete a trigger

Trigger Types

RAT supports 6 trigger types, each with its own configuration schema:

landing_zone_upload

Fires when a file is uploaded to the specified landing zone.

{
  "type": "landing_zone_upload",
  "config": {
    "namespace": "default",
    "zone_name": "raw-uploads"
  }
}
Config FieldTypeRequiredDescription
namespacestringYesNamespace of the landing zone
zone_namestringYesName of the landing zone to watch

cron

Fires on a cron schedule using 5-field cron expressions.

{
  "type": "cron",
  "config": {
    "cron_expr": "0 * * * *"
  }
}
Config FieldTypeRequiredDescription
cron_exprstringYes5-field cron expression (minute, hour, day, month, weekday)

Cron expression examples:

ExpressionSchedule
* * * * *Every minute
0 * * * *Every hour
0 0 * * *Daily at midnight
0 6 * * 1-5Weekdays at 6 AM
*/15 * * * *Every 15 minutes
0 0 1 * *First day of every month

pipeline_success

Fires when a specified upstream pipeline completes successfully. This creates a dependency chain between pipelines.

{
  "type": "pipeline_success",
  "config": {
    "namespace": "default",
    "layer": "bronze",
    "pipeline": "raw_orders"
  }
}
Config FieldTypeRequiredDescription
namespacestringYesNamespace of the upstream pipeline
layerstringYesLayer of the upstream pipeline
pipelinestringYesName of the upstream pipeline

webhook

Fires when a webhook request is received with the correct token. The token is auto-generated at creation time and returned once in the response.

{
  "type": "webhook",
  "config": {}
}

No configuration is required — the token is auto-generated. See the creation response for the webhook_token field.

⚠️

The plaintext webhook token is returned only once in the creation response. It is never stored or shown again. Save it immediately. If lost, delete the trigger and create a new one.

file_pattern

Fires when an uploaded file matches the specified glob pattern. Similar to landing_zone_upload, but with filename filtering.

{
  "type": "file_pattern",
  "config": {
    "namespace": "default",
    "zone_name": "raw-uploads",
    "pattern": "*.csv"
  }
}
Config FieldTypeRequiredDescription
namespacestringYesNamespace of the landing zone
zone_namestringYesName of the landing zone to watch
patternstringYesGlob pattern to match filenames (e.g., *.csv, orders_*.json)

cron_dependency

Fires on a cron schedule, but only if all specified dependency pipelines have succeeded since the last trigger evaluation. Combines time-based scheduling with dependency awareness.

{
  "type": "cron_dependency",
  "config": {
    "cron_expr": "0 * * * *",
    "dependencies": [
      "default.bronze.raw_orders",
      "default.bronze.raw_customers"
    ]
  }
}
Config FieldTypeRequiredDescription
cron_exprstringYes5-field cron expression
dependenciesarrayYesList of namespace.layer.pipeline identifiers that must have succeeded

List Triggers

GET /api/v1/pipelines/{ns}/{layer}/{name}/triggers

Returns all triggers for a pipeline.

Path Parameters

ParameterTypeDescription
nsstringNamespace
layerstringData layer
namestringPipeline name

Request

curl http://localhost:8080/api/v1/pipelines/default/silver/orders/triggers

Response — 200 OK

{
  "triggers": [
    {
      "id": "trigger-uuid",
      "pipeline_id": "pipeline-uuid",
      "type": "landing_zone_upload",
      "config": {
        "namespace": "default",
        "zone_name": "raw-uploads"
      },
      "enabled": true,
      "cooldown_seconds": 60,
      "last_triggered_at": "2026-02-13T10:05:00Z",
      "last_run_id": "run-uuid",
      "created_at": "2026-02-12T10:00:00Z",
      "updated_at": "2026-02-12T10:00:00Z"
    }
  ],
  "total": 1
}

Response Fields

FieldTypeDescription
triggersarrayList of trigger objects
triggers[].idstringTrigger UUID
triggers[].pipeline_idstringParent pipeline UUID
triggers[].typestringTrigger type (see Trigger Types above)
triggers[].configobjectType-specific configuration
triggers[].enabledbooleanWhether the trigger is active
triggers[].cooldown_secondsintegerMinimum seconds between trigger firings
triggers[].last_triggered_atstring|nullISO 8601 timestamp of last firing
triggers[].last_run_idstring|nullRun ID created by the last firing
triggers[].created_atstringISO 8601 creation timestamp
triggers[].updated_atstringISO 8601 last update timestamp
totalintegerTotal number of triggers

Webhook triggers include an additional webhook_url field in the response, pointing to POST /api/v1/webhooks. The plaintext token is never included in list or get responses.

Error Responses

StatusCodeDescription
404NOT_FOUNDPipeline not found

Create Trigger

POST /api/v1/pipelines/{ns}/{layer}/{name}/triggers

Creates a new trigger for a pipeline.

Path Parameters

ParameterTypeDescription
nsstringNamespace
layerstringData layer
namestringPipeline name

Request Body

FieldTypeRequiredDescription
typestringYesTrigger type: landing_zone_upload, cron, pipeline_success, webhook, file_pattern, cron_dependency
configobjectYesType-specific configuration (see Trigger Types above)
enabledbooleanNoWhether the trigger is active (default: true)
cooldown_secondsintegerNoMinimum seconds between firings (default: 0)

Request — Landing Zone Upload

curl -X POST http://localhost:8080/api/v1/pipelines/default/silver/orders/triggers \
  -H "Content-Type: application/json" \
  -d '{
    "type": "landing_zone_upload",
    "config": {
      "namespace": "default",
      "zone_name": "raw-uploads"
    },
    "enabled": true,
    "cooldown_seconds": 60
  }'

Response — 201 Created

{
  "id": "trigger-uuid",
  "pipeline_id": "pipeline-uuid",
  "type": "landing_zone_upload",
  "config": {
    "namespace": "default",
    "zone_name": "raw-uploads"
  },
  "enabled": true,
  "cooldown_seconds": 60,
  "created_at": "2026-02-13T10:00:00Z",
  "updated_at": "2026-02-13T10:00:00Z"
}

Webhook Creation Response

When creating a webhook trigger, the response includes the plaintext token:

{
  "id": "trigger-uuid",
  "pipeline_id": "pipeline-uuid",
  "type": "webhook",
  "config": {
    "token_hash": "sha256hex..."
  },
  "webhook_url": "http://localhost:8080/api/v1/webhooks",
  "webhook_token": "64-char-hex-plaintext-shown-once",
  "enabled": true,
  "cooldown_seconds": 0,
  "created_at": "2026-02-13T10:00:00Z",
  "updated_at": "2026-02-13T10:00:00Z"
}

Error Responses

StatusCodeDescription
400INVALID_ARGUMENTMissing or invalid type, invalid config, invalid cron expression, invalid glob pattern
404NOT_FOUNDPipeline not found, or referenced landing zone / upstream pipeline not found

Get Trigger

GET /api/v1/pipelines/{ns}/{layer}/{name}/triggers/{id}

Returns details for a single trigger.

Path Parameters

ParameterTypeDescription
nsstringNamespace
layerstringData layer
namestringPipeline name
idstringTrigger UUID

Request

curl http://localhost:8080/api/v1/pipelines/default/silver/orders/triggers/trigger-uuid

Response — 200 OK

Returns the full trigger object.

Error Responses

StatusCodeDescription
404NOT_FOUNDPipeline or trigger not found

Update Trigger

PUT /api/v1/pipelines/{ns}/{layer}/{name}/triggers/{id}

Updates a trigger’s configuration, enabled state, or cooldown. This is a partial update.

Path Parameters

ParameterTypeDescription
nsstringNamespace
layerstringData layer
namestringPipeline name
idstringTrigger UUID

Request Body

FieldTypeRequiredDescription
configobjectNoUpdated type-specific configuration
enabledbooleanNoEnable or disable the trigger
cooldown_secondsintegerNoUpdated cooldown period

Request

curl -X PUT http://localhost:8080/api/v1/pipelines/default/silver/orders/triggers/trigger-uuid \
  -H "Content-Type: application/json" \
  -d '{
    "config": { "namespace": "default", "zone_name": "new-zone" },
    "enabled": false,
    "cooldown_seconds": 120
  }'

Response — 200 OK

Returns the full trigger object with updated fields.

Error Responses

StatusCodeDescription
400INVALID_ARGUMENTInvalid config or cooldown value
404NOT_FOUNDPipeline or trigger not found

Delete Trigger

DELETE /api/v1/pipelines/{ns}/{layer}/{name}/triggers/{id}

Deletes a trigger.

Path Parameters

ParameterTypeDescription
nsstringNamespace
layerstringData layer
namestringPipeline name
idstringTrigger UUID

Request

curl -X DELETE http://localhost:8080/api/v1/pipelines/default/silver/orders/triggers/trigger-uuid

Response — 204 No Content

No response body.

Error Responses

StatusCodeDescription
404NOT_FOUNDPipeline or trigger not found

Cooldown Behavior

The cooldown_seconds field prevents a trigger from firing too frequently. When a trigger fires, subsequent events within the cooldown window are ignored.

For example, with cooldown_seconds: 60:

  1. File uploaded at 10:00:00 — trigger fires, run created
  2. File uploaded at 10:00:30 — ignored (within cooldown)
  3. File uploaded at 10:01:01 — trigger fires, run created

The cooldown is per-trigger, not per-pipeline. If a pipeline has multiple triggers, each maintains its own cooldown timer independently.