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 '{
"scheduleId": "sched_a1b2c3d4e5f60718",
"pageSize": 20,
"statusFilter": "EXECUTION_STATUS_FAILED"
}'
Execution records include:
| Field | Description |
|---|---|
status | EXECUTION_STATUS_SUCCESS, EXECUTION_STATUS_FAILED, EXECUTION_STATUS_MALFORMED, EXECUTION_STATUS_DISCARDED (retries exhausted), or EXECUTION_STATUS_CANCELLED (operator cancellation) |
httpStatus | HTTP status code returned by the target |
attempt | Attempt number (1-based) within this firing |
durationMs | End-to-end duration of the delivery attempt |
error | Error message on FAILED or MALFORMED outcomes |
scheduledTime | When the execution was supposed to fire |
startedAt / completedAt | Actual start and completion times |
responseBody | Truncated HTTP response body captured on failed dispatches (4 KiB cap). Empty for successful dispatches. |
responseHeaders | Allowlisted response headers from the failed dispatch: content-type, content-length, retry-after, x-request-id, date. |
responseTruncated | true when responseBody was clipped at the 4 KiB cap. |
responseSizeBytes | Original 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 maxAttempts.
| Field | Default | Description |
|---|---|---|
maxAttempts | 10 | Total delivery attempts including the initial one |
initialBackoffMs | 5000 | Backoff before the first retry (5 seconds) |
maxBackoffMs | 1800000 | Maximum backoff cap (30 minutes) |
To override the defaults, include a retryPolicy 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",
"scheduleType": "SCHEDULE_TYPE_CRON",
"cronExpression": "*/5 * * * *",
"target": {
"url": "https://your-api.example.com/jobs/alert",
"kind": "alert"
},
"retryPolicy": {
"maxAttempts": 3,
"initialBackoffMs": 1000,
"maxBackoffMs": 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
autoPauseThresholdis omitted or set to0) - Valid override range: 3–100
- When auto-paused, the job state becomes
SCHEDULE_STATE_PAUSEDandpausedReasonrecords the cause
Resume the job with resume-job once the target is healthy.