Skip to main content

Execution & Retries

What happens each time a job fires: the execution record it leaves behind, how failures are retried, and when a job is paused for you.

Execution History

Every firing is recorded as an execution. Query the history to debug failures or monitor delivery.

curl -X POST https://api.travila.ai/api/v1/scheduler/list-executions \
-H "X-API-Key: sk_your_key_here" \
-H "X-On-Behalf-Of: user_123" \
-H "Content-Type: application/json" \
-d '{
"schedule_id": "sched_a1b2c3d4e5f60718",
"page_size": 20,
"status_filter": "EXECUTION_STATUS_FAILED"
}'

Execution records include:

FieldDescription
statusEXECUTION_STATUS_SUCCESS, EXECUTION_STATUS_FAILED, EXECUTION_STATUS_MALFORMED, EXECUTION_STATUS_DISCARDED (retries exhausted), or EXECUTION_STATUS_CANCELLED (operator cancellation)
http_statusHTTP status code returned by the target
attemptAttempt number (1-based) within this firing
duration_msEnd-to-end duration of the delivery attempt
errorError message on FAILED or MALFORMED outcomes
scheduled_timeWhen the execution was supposed to fire
started_at / completed_atActual start and completion times
response_bodyTruncated HTTP response body captured on failed dispatches (4 KiB cap). Empty for successful dispatches.
response_headersAllowlisted response headers from the failed dispatch: content-type, content-length, retry-after, x-request-id, date.
response_truncatedtrue when response_body was clipped at the 4 KiB cap.
response_size_bytesOriginal response size in bytes (from Content-Length when present, else total bytes read before truncation).

Retry Policy

Each firing retries independently with exponential backoff until it succeeds or exhausts max_attempts.

FieldDefaultDescription
max_attempts10Total delivery attempts including the initial one
initial_backoff_ms5000Backoff before the first retry (5 seconds)
max_backoff_ms1800000Maximum backoff cap (30 minutes)

To override the defaults, include a retry_policy in your create-job request:

curl -X POST https://api.travila.ai/api/v1/scheduler/create-job \
-H "X-API-Key: sk_your_key_here" \
-H "X-On-Behalf-Of: user_123" \
-H "Content-Type: application/json" \
-d '{
"name": "Critical alert",
"schedule_type": "SCHEDULE_TYPE_CRON",
"cron_expression": "*/5 * * * *",
"target": {
"url": "https://your-api.example.com/jobs/alert",
"kind": "alert"
},
"retry_policy": {
"max_attempts": 3,
"initial_backoff_ms": 1000,
"max_backoff_ms": 10000
}
}'

Auto-Pause

A job is automatically paused when it accumulates N consecutive failures. This prevents a broken target from accumulating unbounded retry debt.

  • Default threshold: 10 consecutive failures (applied when auto_pause_threshold is omitted or set to 0)
  • Valid override range: 3–100
  • When auto-paused, the job state becomes SCHEDULE_STATE_PAUSED and paused_reason records the cause

Resume the job with resume-job once the target is healthy.