Webhook Triggers
Every agent gets a unique webhook URL that external services can POST to. Connect Zapier, Make, GitHub Actions, cron jobs, or any HTTP client to trigger your agents without writing integration code.
One URL per agent, zero integration code
Each active agent has a trigger URL: POST /agents/trigger/<agentId>. Send a JSON body with your input and get back the agent's response. Authentication uses the same API key you already have.
Trigger URL Format
The trigger URL for any agent follows this pattern:
POST https://us-central1-agentlify-prod.cloudfunctions.net/agentTrigger/agents/trigger/{agentId}You can find this URL in the Settings tab of your agent editor, under the Webhook Trigger panel.
Authentication
Authenticate with your Agentlify API key in the Authorization header:
Authorization: Bearer mp_YOUR_API_KEYRequest Body
The trigger accepts two input formats. Use whichever is simpler for your integration.
Simple input (recommended)
{
"input": "Summarize today's top Hacker News stories"
}Full messages format
{
"messages": [
{ "role": "system", "content": "You are a helpful news summarizer." },
{ "role": "user", "content": "Summarize today's top stories" }
]
}Response
Triggers always return a simple, flat JSON response:
{
"id": "exec_a1b2c3d4-...",
"output": "Here are today's top stories...",
"status": "completed",
"usage": {
"tokens": 1523,
"cost": 0.0034,
"latency_ms": 2340,
"steps": 2
}
}Optional Headers
| Header | Description |
|---|---|
X-Trigger-Source | Label the source (e.g. "zapier", "github-actions", "cron"). Appears in trigger logs. |
Content-Type | Must be application/json |
Examples
cURL
curl -X POST "https://us-central1-agentlify-prod.cloudfunctions.net/agentTrigger/agents/trigger/my-agent" \
-H "Authorization: Bearer mp_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Trigger-Source: cron" \
-d '{"input": "Generate daily report"}'GitHub Actions
name: Daily Agent Run
on:
schedule:
- cron: '0 9 * * *' # 9am UTC daily
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger agent
run: |
curl -X POST "$TRIGGER_URL" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-H "X-Trigger-Source: github-actions" \
-d '{"input": "Generate daily report"}'
env:
TRIGGER_URL: ${{ secrets.AGENT_TRIGGER_URL }}
API_KEY: ${{ secrets.AGENTLIFY_API_KEY }}Node.js / fetch
const response = await fetch(
'https://us-central1-agentlify-prod.cloudfunctions.net/agentTrigger/agents/trigger/my-agent',
{
method: 'POST',
headers: {
'Authorization': 'Bearer mp_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ input: 'Summarize the latest data' }),
}
);
const result = await response.json();
console.log(result.output);Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | unauthorized | Missing or invalid API key |
| 402 | insufficient_credits | Account has insufficient credits |
| 404 | not_found | Agent ID not found |
| 400 | agent_disabled | Agent is not active |