Start typing to search.

API Reference

Update a trigger

View Markdown

Partial update. one off datetime rules are validated against the trigger's effective type (the stored type when type is omitted). Changing a one off trigger's cron expression re…

PUT /api/triggers/{id}

Partial update. one_off datetime rules are validated against the trigger's effective type (the stored type when type is omitted). Changing a one_off trigger's cron_expression resets last_triggered_at so the new datetime fires even after a server restart.

Operation ID: updateTrigger

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

Path parameters

  • idinteger, required Resource ID

Request body

The request body is required.

application/json

  • Type: object
  • Properties:
    • task_key (string)
    • type (string)
      • Allowed values: cron, one_off
    • cron_expression (string)
    • arguments (object)
      • Additional properties: allowed
    • enabled (boolean)

Success responses

200

Trigger updated

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
      • last_triggered_at (string | null)
        • Format: date-time
        • Nullable: yes
      • created_at (string)
        • Format: date-time
      • updated_at (string)
        • Format: date-time

Error responses

404

Resource not found

Content type: application/json

  • Reference: Error
    • Type: object
    • Properties:
      • error (string)
        • Example: NOT_FOUND
      • message (string)
        • Example: Resource not found

Example:

{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}

Examples

cURL

curl --request PUT \
  --url 'https://your-envoy.example.com/api/triggers/YOUR_ID' \
  --header 'Authorization: Bearer $API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "task_key": "string",
  "type": "cron",
  "cron_expression": "string",
  "arguments": {},
  "enabled": true
}'

JavaScript (fetch)

const response = await fetch('https://your-envoy.example.com/api/triggers/YOUR_ID', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "task_key": "string",
    "type": "cron",
    "cron_expression": "string",
    "arguments": {},
    "enabled": true
  }),
});
 
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);