Triggers

Create automation rules that run an agent, app, or flow on a schedule or when an external webhook fires.

Triggers are workspace-scoped resources. Cron triggers are evaluated by the platform scheduler on a recurring schedule; scheduled triggers fire once at a configured time; webhook triggers expose a public ingestion URL you can register with external services. Manual triggers have no automatic schedule or webhook ingestion; use POST /triggers/{id}/fire to run them.

→ Entitlements — triggers plan limit
→ Discord integration: OAuth event triggers in the web app
→ GitHub App: run triggers on a GitHub App installation's events, no webhook to set up


Create triggers in the web app

Use Triggers → New to build a trigger without calling the API directly:

  1. Type — schedule (cron) or webhook
  2. Action — run an agent, app, or flow (visual pickers)
  3. Schedule — for cron triggers, use the visual schedule builder: pick a frequency (every N minutes, hourly, daily, weekly, monthly, or custom), set time and day fields in an inline sentence (for example run daily at 09:00), and choose a timezone from the dropdown. Custom mode exposes five labeled cron fields (minute, hour, day, month, weekday) with a live expression preview. For webhook triggers, pick a source: for GitHub, the GitHub App connection it runs on; for another provider, paste the signing secret it issues on the trigger's page once the trigger exists
  4. Filters (webhook) — optional match rules with operator picker; provider-specific fields come from GET /trigger-sources filter_fields
  5. Input — default JSON payload or input mapping for webhook events

The trigger list links to a detail page with an activity feed of recent fires. See Execution log for the same data via API.


Scopes

ScopeEndpoints
agents:readList, get triggers; list, get trigger fires
agents:writeCreate, update, delete; generate and reveal a webhook signing secret
agents:executeFire (POST /triggers/{id}/fire)

Create API keys with these scopes at settings → workspace → api keys.

GET /trigger-sources is public (no API key required).


Trigger object

FieldTypeDescription
idstringTrigger ID
namestringDisplay name
typestringcron, webhook, scheduled (one-shot), or manual
actionstringrun_agent, run_app, or run_flow
enabledbooleanWhen false, cron ticks and webhook ingestion are skipped
agent_idstringRequired when action is run_agent
app_idstringRequired when action is run_app
flow_idstringRequired when action is run_flow
configobjectType-specific settings (see below)
inputobjectDefault JSON payload when fire requests omit a body
input_mappingobjectMap webhook payload fields into run input — see Input mapping
filtersarrayMatch rules applied before dispatch — see Event filtering
sourceobjectWebhook provider metadata (from source_id)
credential_idstringThe connection a webhook trigger is bound to — see Triggers bound to a GitHub App connection
scheduled_atstringRFC3339 one-shot fire time — present when type is scheduled
last_fired_atstringISO timestamp of last successful fire
fire_countnumberTotal successful fires
webhook_urlstringPresent on create for webhook triggers not bound to a connection — your public ingestion URL
has_webhook_secretbooleanThe trigger holds its own signing secret, used by the inference-v1 scheme (see Webhook signing). Every webhook trigger gets one when it is created or updated.

config by type

Cron (type: "cron"):

FieldTypeRequiredDescription
expressionstringYesCron expression (e.g. 0 9 * * *)
timezonestringNoIANA timezone for the expression

Webhook (type: "webhook"): no config. A webhook trigger verifies deliveries with its own signing secret: generated for the generic source or no source_id, or the one a provider issued, set with Set webhook secret. A trigger bound to a GitHub App connection (credential_id) has none. config.secret_ref is refused (400).

Scheduled triggers (type: "scheduled")

Set the top-level scheduled_at field (RFC3339) to the one-shot fire time. The platform checks due scheduled triggers every 60 seconds. After the scheduled time passes, the platform fires the trigger once and sets enabled to false — whether dispatch succeeds or fails. Re-enable the trigger (with a new scheduled_at) to fire again.


List triggers

GET /triggers or POST /triggers/list

Cursor-paginated list of your workspace's triggers. Requires agents:read.

bash
1curl -X POST https://api.inference.sh/triggers/list \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{"limit": 50}'

Get trigger

GET /triggers/{id}

Returns a single trigger. Requires agents:read.


Create trigger

POST /triggers

Requires agents:write.

Request

FieldTypeRequiredDescription
namestringYesDisplay name
typestringYescron, webhook, scheduled, or manual
actionstringYesrun_agent, run_app, or run_flow
agent_idstringWhen action is run_agentAgent to run
app_idstringWhen action is run_appApp to run
flow_idstringWhen action is run_flowFlow to run
configobjectFor cronMust include expression (and optional timezone)
scheduled_atstringWhen type is scheduledRFC3339 one-shot fire time
source_idstringNoWebhook provider from trigger sources
credential_idstringNoBind a webhook trigger of the github source to a GitHub App connection — see below
enabledbooleanNoDefaults to true
inputobjectNoDefault payload
input_mappingobjectNoPayload field mapping — see Input mapping
filtersarrayNoMatch rules before dispatch — see Event filtering

Cron example — run an app every day at 9:00:

bash
1curl -X POST https://api.inference.sh/triggers \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{5    "name": "daily-report",6    "type": "cron",7    "action": "run_app",8    "app_id": "app_abc123",9    "config": { "expression": "0 9 * * *", "timezone": "America/New_York" },10    "input": { "report_type": "daily" }11  }'

Webhook example — run an agent when an external service POSTs:

bash
1curl -X POST https://api.inference.sh/triggers \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{5    "name": "slack-events",6    "type": "webhook",7    "action": "run_agent",8    "agent_id": "agent_abc123",9    "source_id": "<source_id from GET /trigger-sources>"10  }'

Then add the trigger's webhook_url in Slack and set the signing secret Slack shows (Set webhook secret). Until then every delivery is refused.

Scheduled example — run an agent once at a specific time:

bash
1curl -X POST https://api.inference.sh/triggers \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{5    "name": "launch-reminder",6    "type": "scheduled",7    "action": "run_agent",8    "agent_id": "agent_abc123",9    "scheduled_at": "2026-08-15T09:00:00Z",10    "input": { "message": "Launch day reminder" }11  }'

Response

Returns the created trigger. Webhook triggers include webhook_url — the public URL to register with your provider:

code
1https://api.inference.sh/triggers/{id}/hook

A webhook trigger is created with its own signing secret (has_webhook_secret: true). Read it with Get webhook secret to sign deliveries for the generic source or a trigger with no source_id.


Update trigger

POST /triggers/{id}

Partial update: only fields you include in the JSON body are changed; everything else stays as stored (including cron config when you toggle enabled). Requires agents:write.

Common patch fields:

FieldTypeDescription
namestringDisplay name
enabledbooleanPause (false) or resume (true) cron, webhook, and scheduled triggers
configobjectCron expression and timezone
inputobjectDefault fire payload
input_mappingobjectWebhook payload mapping
filtersarrayWebhook match rules
credential_idstringBind to, or move to, another GitHub App connection; "" unbinds
scheduled_atstringRFC3339 one-shot time for type: scheduled

Pause a webhook trigger (stops cron ticks and returns 410 on webhook ingestion until re-enabled):

bash
1curl -X POST https://api.inference.sh/triggers/trigger_abc123 \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{"enabled": false}'

Returns the updated trigger object (TriggerDTO). An empty body returns 400 invalid_request.


Delete trigger

DELETE /triggers/{id}

Permanently deletes a trigger. Requires agents:write.


Fire trigger (manual)

POST /triggers/{id}/fire

Manually invoke a trigger. Requires agents:execute and write access to the trigger.

Use this to test a trigger or run it on demand. All trigger types support manual fire, including manual triggers that only run on demand.

Request body

Optional JSON object. When omitted or empty, the trigger's configured input is used (if set).

bash
1curl -X POST https://api.inference.sh/triggers/trigger_abc123/fire \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{"event": "manual_test"}'

Access and dispatch permissions

Your API key needs agents:execute to call fire, and you need write access to the trigger (the same access as editing it). A trigger you cannot read returns 404; one you can read but not change returns 403.

A manual fire runs as you: the linked agent, app, or flow must be one you can run yourself.

Webhook ingestion (POST /triggers/{id}/hook) runs with the trigger owner's permissions and does not require an API key. It accepts deliveries only for webhook triggers.

Response

Success (200):

json
1{ "fired": true }

Errors: failures use the standard error envelope: 403 / 404 as above, and 500 when dispatch fails (missing agent/app/flow, input mapping error, and so on). A 500 carries only a generic message; the execution log records what went wrong.

Every fire attempt (cron tick, webhook ingestion, or manual fire) is recorded in the execution log. Failed dispatches and filter rejections appear there even when the ingestion endpoint returns 200.


Execution log

The platform records one trigger fire row per attempt — successful runs, dispatch errors, and events dropped by event filtering.

Use this to debug webhook triggers, audit cron runs, and correlate fires with created chats, tasks, or flow runs.

Trigger fire object

FieldTypeDescription
idstringFire record ID
trigger_idstringParent trigger
triggerobjectOptional embedded trigger (included on list/get when preloaded)
statusstringsuccess, error, or filtered
payloadobjectIncoming webhook body or cron payload (when captured)
errorstringDispatch or mapping error message (when status is error)
duration_msnumberEnd-to-end dispatch time in milliseconds
chat_idstringCreated agent chat (when action is run_agent and dispatch succeeded)
task_idstringCreated task (when action is run_app and dispatch succeeded)
flow_run_idstringCreated flow run (when action is run_flow and dispatch succeeded)
created_atstringISO timestamp

Status values:

StatusMeaning
successTrigger dispatched successfully — linked a chat, task, or flow run
errorDispatch failed (missing target, mapping error, permissions, etc.)
filteredPayload did not match the trigger's filters — no run created

List trigger fires

GET /trigger-fires or POST /trigger-fires/list

Cursor-paginated execution log for your workspace's triggers. Requires agents:read.

bash
1curl -X POST https://api.inference.sh/trigger-fires/list \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{5    "limit": 50,6    "filters": [7      { "field": "trigger_id", "operator": "eq", "value": "trigger_abc123" },8      { "field": "status", "operator": "eq", "value": "error" }9    ]10  }'

Common filter fields: trigger_id, status, created_at, updated_at. Unknown filter or sort columns return 400. See Cursor pagination.

Response

FieldTypeDescription
itemsarrayTrigger fire objects
next_cursorstringCursor for the next page
prev_cursorstringCursor for the previous page
has_nextbooleanMore results available
has_previousbooleanPrevious page available

Get trigger fire

GET /trigger-fires/{id}

Returns a single execution log entry. Requires agents:read.


Webhook ingestion

POST /triggers/{id}/hook

No authentication required. External services call this URL to fire a webhook trigger.

ResponseWhen
200 {"ok":true}Accepted — dispatch runs asynchronously
404Trigger not found, or the trigger is not a webhook trigger (cron, scheduled, and manual triggers take no deliveries)
410Trigger is disabled
401 unauthorizedSignature verification failed, or the trigger has no signing secret yet
500 internal_errorThe signing secret could not be read
400Request body exceeds 1 MB or could not be read

Every delivery must carry a valid signature; nothing unsigned is accepted. The secret depends on the trigger's source:

SourceSecretScheme
No source_id, or genericThe trigger's own generated secret (has_webhook_secret)inference-v1, see Webhook signing
Slack, Stripe, Linear, Discord, Grafana, …The secret the provider issued, set with Set webhook secretThe source's strategy from GET /trigger-sources (hmac-sha256, slack-v0, ed25519)
GitHub, bound to a GitHub App connectionNone: the app signs (Triggers bound to a GitHub App connection)hmac-sha256

The request body is passed through as the trigger payload (subject to filters and input_mapping).


Triggers bound to a GitHub App connection

A GitHub App connection is an installation of the inference shell GitHub App. GitHub sends every event of the installation to inference shell, signed with the app's own secret. A webhook trigger with the github source and credential_id set to the connection runs on those events:

  • No webhook to set up: no URL to register on the repository and no signing secret to set. The trigger has no webhook_url of its own.
  • Only that installation: a trigger runs on the events of the installation it is bound to, nothing else. Only an owner of the GitHub organization (or the user, for a personal account) can make the connection. Narrow it further with filters on event, action, repository.full_name or sender.login.
  • The same payload: the event body with event (from X-GitHub-Event) and delivery added, through filters and input_mapping, recorded in the execution log. The run starts as the trigger's owner.
  • Validated: credential_id must be a GitHub App connection of the trigger's own workspace, on a webhook trigger whose source is github. Anything else answers 400.
  • Once per delivery: a delivery GitHub sends again (same X-GitHub-Delivery) within 10 minutes runs nothing a second time.
  • Stops with the connection: when the app is uninstalled or suspended, the connection is disconnected and its triggers stop until it is connected again.
bash
1curl -X POST https://api.inference.sh/triggers \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{5    "name": "push-to-main",6    "type": "webhook",7    "action": "run_agent",8    "agent_id": "agent_abc123",9    "source_id": "<id of the github source>",10    "credential_id": "<id of the GitHub App connection>",11    "filters": [12      { "field": "event", "operator": "eq", "value": "push" },13      { "field": "ref", "operator": "eq", "value": "refs/heads/main" }14    ],15    "input_mapping": {16      "action": {17        "prompt": { "value": "{{ sender.login }} pushed to {{ repository.full_name }}: {{ head_commit.message }}" }18      }19    }20  }'

A GitHub App's deliveries arrive at POST /triggers/hooks/github/{app id}, for inference shell's app and a workspace's own GitHub App alike. It is not an endpoint to call yourself: it answers 401 to anything not signed by its app, and runs only triggers bound to connections made through that app. A bound trigger's own URL (/triggers/{id}/hook) answers 404.


Webhook signing

A delivery to a trigger with no source_id, or with the generic source, is signed with the trigger's own secret:

HeaderValue
X-Inference-TimestampUnix time in seconds
X-Inference-Signaturev1=<hex HMAC-SHA256(secret, "<timestamp>.<raw body>")>

A delivery whose timestamp is more than 5 minutes from the server's clock is refused, so a captured delivery cannot be replayed.

bash
1BODY='{"event":"deploy"}'2TS=$(date +%s)3SECRET="$(curl -s https://api.inference.sh/triggers/trigger_abc123/webhook-secret \4  -H "Authorization: Bearer inf_your_key" | jq -r .data.value)"5SIG="v1=$(printf '%s.%s' "$TS" "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | awk '{print $2}')"6curl -X POST "https://api.inference.sh/triggers/trigger_abc123/hook" \7  -H "Content-Type: application/json" \8  -H "X-Inference-Timestamp: $TS" \9  -H "X-Inference-Signature: $SIG" \10  -d "$BODY"

Provider sources (Slack, Stripe, …) sign with their own headers and algorithms and the secret the provider issued: set it with Set webhook secret.


Get webhook secret

GET /triggers/{id}/webhook-secret

Returns the trigger's signing secret (whsec_…). Requires agents:write and write access to the trigger. Each reveal is audited (trigger.webhook_secret.revealed).

json
1{ "data": { "value": "whsec_…" } }

A trigger with no signing secret answers 404.


Generate webhook secret

POST /triggers/{id}/webhook-secret

Gives a webhook trigger a signing secret when it has none, and returns the trigger. A trigger that already has one keeps it. Requires agents:write and write access to the trigger. A trigger that is not a webhook trigger answers 400 validation_error.

Only a trigger signed with inference-v1 (no source_id, or generic) gets a generated secret; for a provider source it answers 400: set the provider's with Set webhook secret.


Set webhook secret

PUT /triggers/{id}/webhook-secret

Sets the signing secret a provider issued for the trigger's URL (a Stripe endpoint's whsec_…, a Slack app's signing secret), replacing the one there, and returns the trigger. Requires agents:write and write access to the trigger. Audited (trigger.webhook_secret.set). A trigger bound to a connection answers 400.

bash
1curl -X PUT https://api.inference.sh/triggers/trg_abc123/webhook-secret \2  -H "Authorization: Bearer inf_your_key" \3  -H "Content-Type: application/json" \4  -d '{ "value": "whsec_…" }'

In the web app, the trigger's page asks for it once the trigger exists.


Event filtering

Webhook triggers can include a filters array. Each rule inspects a field in the parsed JSON payload using dot notation (for example event.type, repository.full_name). All rules must match (AND logic). When any rule fails, the webhook returns 200 {"ok":true} but the trigger does not dispatch.

FieldTypeDescription
fieldstringDot-notation path into the payload
operatorstringComparison operator (see below)
valuestringExpected value (exists ignores this)

Operators:

OperatorMatches when
eqField value equals value (string comparison)
neqField value does not equal value
containsField is a string containing value
prefixField is a string starting with value
existsField is present and non-null

Example — only fire on GitHub pushes to main:

json
1{2  "filters": [3    { "field": "ref", "operator": "eq", "value": "refs/heads/main" },4    { "field": "action", "operator": "exists", "value": "" }5  ]6}

When you set source_id, GET /trigger-sources returns a filter_fields array for that provider — suggested fields with labels, descriptions, and example values for the create UI.


Input mapping

input_mapping transforms the webhook payload into the JSON input passed to the agent, app, or flow. It uses the same shape as flow run inputs: an object with an action key mapping output field names to static values or payload connections.

ShapeDescription
{ "action": { "<output_key>": { "value": ... } } }Static literal
{ "action": { "<output_key>": { "connection": { "nodeId": "trigger", "key": "<path>" } } } }Extract from payload via dot notation

| { "action": { "<output_key>": { "value": "text with {{ path }}" } } } | Template: each {{ path }} is filled from the payload (strings as is, numbers and booleans as written, objects and arrays as JSON, missing paths as nothing) |

Paths use dot notation and may index arrays: commits.0.message.

When input_mapping is omitted or empty, the raw webhook body is passed through unchanged.

Agent triggers: when the input has a string prompt field, the agent receives that text as its message. Otherwise it receives the input as JSON.

GitHub event: GitHub names the event only in a header, so GitHub-source triggers add it to the payload: event (from X-GitHub-Event: pull_request, push, issues, issue_comment, ...) and delivery (from X-GitHub-Delivery). Filter on event together with action to pick one kind of delivery, for example event = pull_request and action = opened.

Example — prompt an agent when a PR is opened:

json
1{2  "filters": [3    { "field": "event", "operator": "eq", "value": "pull_request" },4    { "field": "action", "operator": "eq", "value": "opened" }5  ],6  "input_mapping": {7    "action": {8      "prompt": { "value": "Review PR #{{ number }} in {{ repository.full_name }}: {{ pull_request.title }}" }9    }10  }11}

Example — map a GitHub PR webhook into agent input:

json
1{2  "input_mapping": {3    "action": {4      "title": {5        "connection": { "nodeId": "trigger", "key": "pull_request.title" }6      },7      "repo": {8        "connection": { "nodeId": "trigger", "key": "repository.full_name" }9      },10      "channel": { "value": "#deployments" }11    }12  }13}

Given a payload with pull_request.title and repository.full_name, the dispatched input becomes:

json
1{2  "title": "fix: resolve race condition",3  "repo": "okaris/inference",4  "channel": "#deployments"5}

Only nodeId: "trigger" is valid for webhook connections — other node IDs return a mapping error at fire time. Missing payload paths resolve to null.


List trigger sources

GET /trigger-sources

Returns the catalog of webhook providers available when creating triggers. No API key required.

bash
1curl https://api.inference.sh/trigger-sources

Built-in providers:

KeyVerificationTypical use
githubhmac-sha256 (X-Hub-Signature-256)Push, PR, and issue events
slackslack-v0Event subscriptions and mentions
stripehmac-sha256 (Stripe-Signature)Payment and subscription events
linearhmac-sha256 (Linear-Signature)Issue and comment webhooks
discorded25519Slash commands and interactions
grafanahmac-sha256 (X-Grafana-Signature)Alert notifications from Grafana webhook contact points
genericinference-v1 (X-Inference-Signature)Any service, signed with the trigger's own secret (Webhook signing)

For grafana, enable HMAC on the Grafana webhook contact point (hmacConfig) and set the header name to X-Grafana-Signature so it matches this source. Grafana signs the raw request body with HMAC-SHA256 (hex, no prefix). Set the same value as hmacConfig.secret and as the trigger's signing secret (Set webhook secret).

Each source includes:

FieldDescription
keyProvider identifier
nameDisplay name
strategySignature verification method
payload_schemaJSON Schema describing expected webhook body fields
filter_fieldsSuggested filter fields with labels and examples for the UI
connection_providerSet when the source's events come from an app (github-app): its triggers are bound to a connection (credential_id) and have no URL or secret of their own

Response example:

json
1{2  "items": [3    {4      "id": "src_abc123",5      "key": "github",6      "name": "GitHub",7      "strategy": "hmac-sha256",8      "connection_provider": "github-app",9      "payload_schema": { "type": "object", "properties": { "ref": { "type": "string" }, "action": { "type": "string" } } },10      "filter_fields": [11        { "field": "ref", "label": "branch ref", "examples": ["refs/heads/main"] },12        { "field": "action", "label": "action", "examples": ["opened", "closed"] }13      ]14    }15  ]16}

Use each source's id as source_id when creating a webhook trigger. For a provider source, set the signing secret the provider issues for the trigger's URL (Set webhook secret). For the generic source, sign with the trigger's own generated secret (Get webhook secret).

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.