API Reference
Create a trigger
Create a trigger
POST /api/triggers
Create a trigger
Operation ID: createTrigger
Authentication
Option 1
- BearerAuth (
http bearer) API key token. Create via POST /api/api-keys. Format:envoy_<hex>
Option 2
- CookieAuth (
apiKey) Session cookie set after login + TOTP verification
Request body
The request body is required.
application/json
- Type:
object - Properties:
job_id(integer,required)task_key(string) — Specific task key within the job to triggertype(string)- Allowed values:
cron,one_off - Default:
cron
- Allowed values:
cron_expression(string) — Cron expression (e.g. '0 */6 * * *') for type=cron; ISO-8601 datetime (UTC) in the future for type=one_off.arguments(object)- Additional properties: allowed
enabled(boolean)- Default:
true
- Default:
Success responses
201
Trigger created
Content type: application/json
- Reference:
Trigger- Type:
object - Properties:
id(integer)job_id(integer)task_key(string | null)- Nullable: yes
type(string) — cron repeats on a cron expression; one_off fires once at the datetime in cron_expression then auto-disables.- Description: cron repeats on a cron expression; one_off fires once at the datetime in cron_expression then auto-disables.
- Allowed values:
cron,one_off
cron_expression(string | null) — 5-field cron expression for type=cron; ISO-8601 datetime (UTC) for type=one_off.- Description: 5-field cron expression for type=cron; ISO-8601 datetime (UTC) for type=one_off.
- Nullable: yes
arguments(string | null) — JSON-encoded arguments- Description: JSON-encoded arguments
- Nullable: yes
enabled(integer)- Allowed values:
0,1
- Allowed values:
last_triggered_at(string | null)- Format:
date-time - Nullable: yes
- Format:
created_at(string)- Format:
date-time
- Format:
updated_at(string)- Format:
date-time
- Format:
- Type:
Examples
cURL
curl --request POST \
--url 'https://your-envoy.example.com/api/triggers' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"job_id": 0
}'JavaScript (fetch)
const response = await fetch('https://your-envoy.example.com/api/triggers', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"job_id": 0
}),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);