Skip to main content

Scheduled Runs

A schedule runs bill runs automatically — either recurring (daily / weekly / monthly) or one-time at a future date. It is a thin wrapper over a BillingRunJob JobInstance and its timer; you manage a schedule, not the job plumbing.

POST /api/v1/billingRunSchedules and friends.

Cadence model — repeats

repeatsBehaviour
NONEOne-time run — "schedule it before running it". Fires exactly once at startDate. After it fires, the schedule reports status: COMPLETED.
DAILY / WEEKLY / MONTHLYRecurring — the 7-field cron spec drives the timer. status is ACTIVE or PAUSED.

The New Bill Run form's cadence selector maps directly: Run once at…repeats: NONE, Recurringrepeats: MONTHLY (adjust in the schedule form).

Endpoints

EndpointPurpose
POST /api/v1/billingRunSchedulesCreate a schedule (a TimerEntity + a BillingRunJob JobInstance).
GET /api/v1/billingRunSchedulesList all schedules.
GET /api/v1/billingRunSchedules/{code}One schedule.
PUT /api/v1/billingRunSchedules/{code}Update cron / cycles / options.
DELETE /api/v1/billingRunSchedules/{code}Delete the schedule.
POST /api/v1/billingRunSchedules/{code}/pausePause a recurring schedule (no future firings).
POST /api/v1/billingRunSchedules/{code}/resumeResume a paused schedule.
POST /api/v1/billingRunSchedules/{code}/runNowFire the schedule's job immediately, regardless of its timer.

Create payload

{
"name": "Monthly_B2C_Run",
"repeats": "MONTHLY",
"cron": {
"second": "0", "minute": "0", "hour": "2",
"dayOfMonth": "1", "month": "*", "dayOfWeek": "*", "year": "*"
},
"billingCycleCodes": ["Monthly_B2C"],
"processType": "AUTOMATIC",
"rejectAutoAction": "MOVE",
"suspectAutoAction": "MOVE",
"generateAO": true,
"active": true
}

One-time example:

{
"name": "Catchup_2026_06_01",
"repeats": "NONE",
"startDate": "2026-06-01T02:00:00Z",
"billingCycleCodes": ["Monthly_B2C"],
"processType": "FULL_AUTOMATIC"
}
FieldTypeNotes
namestringrequired — becomes the schedule code
repeatsenumNONE / DAILY / WEEKLY / MONTHLY
cronobject7 calendar fields; required for recurring cadences
startDateISO-8601one-time: the exact fire datetime; recurring: range start
endDateISO-8601optional range end for recurring
billingCycleCodesstring[]required, non-empty — the cycles each run will bill
processTypeenumAUTOMATIC / MANUAL / FULL_AUTOMATIC
lastTransactionDate / invoiceDateISO-8601optional; else resolved from each cycle's EL
rejectAutoAction / suspectAutoActionenumMOVE / CANCEL / CANCEL_RT / AUTOMATIC_VALIDATION / MANUAL_ACTION
generateAObooleancreate accounting entries for each invoice
computeDatesAtValidationbooleandefer date computation to the validation step
activebooleandefault true; false = create paused

Aggregation rules come from the billing cycle

A scheduled BillingRunJob inherits its aggregation rules (ignoreOrders, dateAggregation, etc.) from each billing cycle it processes — not from the schedule. To change aggregation behaviour for a scheduled run, edit the billing cycle. (One-off runs via POST /api/v1/billingRuns carry their own aggregation rules — see Bill Runs.)

Lifecycle

created (ACTIVE) ──▶ fires on timer ──▶ creates a BillingRun (NEW) ──▶ job chain advances it

├─ pause ──▶ PAUSED ──▶ resume ──▶ ACTIVE
└─ one-time: after firing ──▶ COMPLETED

BRs produced by a schedule show Created by: Schedule: {code} on the Bill Runs list, linking back to the schedule.

Managing schedules in the UI

/billRuns/schedules lists every schedule with its human-readable cadence, cycles, status, last run, and next fire time. Row actions: Run now, Pause/Resume, Edit, Delete. The create/edit forms use the visual CronBuilder for the cadence.

Errors

CodeCause
400 MISSING_NAMEname is blank.
400 MISSING_BILLING_CYCLESbillingCycleCodes empty.
400 INVALID_REPEATSunknown repeats value.
400 INVALID_PROCESS_TYPE / INVALID_AUTO_ACTIONunknown enum value.
409 SCHEDULE_EXISTSa schedule with that name already exists.
404 SCHEDULE_NOT_FOUNDunknown code on get / update / delete / action.