Browse the extensions reference

Rebuild Schedule In Place

post/extensions/roboledger/{graph_id}/operations/rebuild-schedule

Part of RoboLedger: Fiscal Close.

Re-run the schedule generator in place on an existing schedule. Atomic alternative to delete-then-recreate (which orphans pending obligations): preserves the structure id + element associations + taxonomy, voids the old pending obligation chain, deletes the old facts and SumEquals rules, and regenerates fresh forward facts + a fresh obligation chain from the schedule's stored definition (entry_template / schedule_metadata / monthly_amount / period bounds). The historical-vs-in-scope split is re-derived from the CURRENT fiscal calendar closed_through. Use this to pick up a fixed generator (e.g. the roll-forward direction fix) without orphaning obligations. It is also how an edit is saved while nothing has posted: pass the definition fields to change (period_start, period_end, monthly_amount, entry_template, schedule_metadata), read back from the schedule's envelope (artifact.mechanics), and the schedule regenerates from them; omitted fields keep their stored values. Refused once an entry has posted (the envelope's posted_periods and edit_warning say so in advance): terminate the schedule and create a successor instead. Run preview-schedule with the new definition first to see the roll-forward.

Idempotency: supply an Idempotency-Key header to make safe retries; replays within 24 hours return the same envelope. Reusing the key with a different body returns HTTP 409 Conflict.

Authentication

Authenticate in any one of these ways — not all of them:

  • API key in the X-API-Key header.
  • Bearer token in the Authorization header.

Path parameters

NameTypeDescription
graph_idrequiredstringGraph Id

Constraints: matches ^(kg[a-f0-9]{16,}(?:_[a-zA-Z0-9]{1,20})?|sec(?:_[a-zA-Z0-9]{1,20})?|library)$

Header parameters

NameTypeDescription
Idempotency-KeyoptionalstringIdempotency-Key

Request body

Required, application/json.

FieldTypeDescription
structure_idrequiredstring

The schedule structure to regenerate in place.

period_startoptionalstring (date)

A new first period start.

period_endoptionalstring (date)

A new last period end.

monthly_amountoptionalinteger

A new straight-line monthly amount, in cents.

entry_templateoptionalEntryTemplateRequest

A new entry template, replacing the stored one whole.

EntryTemplateRequest fields
FieldTypeDescription
debit_element_idrequiredstring

CoA element id to debit (e.g. Depreciation Expense). This is a chart-of-accounts element id — the id returned by get-unmapped-elements / get-graph-schema — NOT a taxonomy qname.

credit_element_idrequiredstring

CoA element id to credit (e.g. Accumulated Depreciation). A chart-of-accounts element id (see get-unmapped-elements), not a taxonomy qname. A straight-line or custom schedule posts this one debit/credit pair; a loan schedule posts its legs.

entry_typeoptionalstring

Entry type for generated entries

One of: standard, adjusting, closing, reversing

Default: closing

memo_templateoptionalstring

Memo template ({structure_name} is replaced)

Default:

auto_reverseoptionalboolean

Auto-generate a reversing entry on the first day of the next period

Default: false

dimension_idsoptionalstring[]

The management dimension members (department, class, location, project) every entry the schedule drafts carries on both lines, one per axis: a department's depreciation lands in that department.

legsoptionalScheduleLegRequest[]

The lines of a loan schedule's entry (method='effective_interest' only), each taking one column of the amortization table; each period's lines must balance. Accrue interest and pay through the bank: debit Interest Expense and credit Accrued Interest, both interest. The schedule settles the payment itself: debit the note principal, debit Interest Expense interest, credit cash or a due-to payment. debit_element_id names the interest debit leg and credit_element_id one credit leg. Empty for every other method, which posts the debit/credit pair.

ScheduleLegRequest fields
FieldTypeDescription
element_idrequiredstring

CoA element id the line posts to.

siderequiredstring

The line's side.

One of: debit, credit

amount_sourcerequiredstring

The amortization-table column the line takes each period: interest (accrued in the period), interest_paid (accrued interest settled by the period's payment), principal (principal repaid), payment (interest_paid + principal).

One of: interest, interest_paid, principal, payment

schedule_metadataoptionalScheduleMetadataRequest

The schedule_metadata fields to change.

ScheduleMetadataRequest fields
FieldTypeDescription
methodoptionalstring

Calculation method. 'straight_line' (default) distributes monthly_amount evenly across periods with the final period absorbing rounding. 'custom' requires periodic_amounts — the generator uses those values verbatim instead of computing. 'effective_interest' requires loan_terms and the template's legs: the generator computes the amortization table (opening balance, interest, payment, principal, closing balance) and drafts the legs from it. Other strings are labels only; fact values still come from monthly_amount or periodic_amounts.

Default: straight_line

loan_termsoptionalLoanTermsRequest

The loan's terms, for method='effective_interest'.

LoanTermsRequest fields
FieldTypeDescription
principalrequiredinteger

Principal drawn, in cents.

Constraints: greater than 0

annual_raterequirednumber

Annual interest rate as a fraction: 0.099 for 9.9%.

Constraints: at least 0; less than 1

start_daterequiredstring (date)

The day the principal was drawn; interest accrues from it. Falls in the schedule's first month.

day_countoptionalstring

How a period's interest counts days: 30/360 (every whole month is 30 days), actual/365 or actual/360 (the days elapsed, over a 365- or 360-day year; actual/360 is the usual bank line of credit).

One of: 30/360, actual/365, actual/360

Default: 30/360

payment_frequencyoptionalstring

How often a payment falls due. A payment is applied at the end of the month it falls in.

One of: monthly, quarterly, annual, at_maturity

Default: monthly

first_payment_dateoptionalstring (date)

The first payment's date. Omit for one frequency after the schedule's first month.

payment_amountoptionalinteger

Each scheduled payment in cents, interest included. Omit for the level payment that retires the principal by maturity_date, or for the accrued interest when interest_only.

Constraints: greater than 0

interest_onlyoptionalboolean

Payments settle interest only; the principal is due at maturity.

Default: false

maturity_dateoptionalstring (date)

When the remaining principal is due: it is repaid in that month, which is the schedule's last. Omit for a line of credit with no maturity, whose balance carries past the schedule.

capitalize_interestoptionalboolean

Interest is added to the note rather than accrued apart (a PIK note): the balance grows by each period's interest, and payments reduce it whole.

Default: false

note_element_idrequiredstring

The liability account the principal is carried in. The schedule states its balance each period, which the schedule reconciliation compares with the ledger.

current_portion_element_idoptionalstring

A current-liability account for the principal due within twelve months. When set, each period's entry also reclasses between it and note_element_id so it holds the next twelve months' principal.

original_amountoptionalinteger

Cost basis in cents

Default: 0

residual_valueoptionalinteger

Salvage value in cents. The schedule expenses original_amount less this; net book value ends at it.

Default: 0

useful_life_monthsoptionalinteger

Useful life in months

Default: 0

asset_element_idoptionalstring

BS asset element for net book value

booked_onoptionalstring (date)

The date the cost went on the books, when that is before the schedule's first period: a policy paid in December that starts amortizing in January, or an asset bought the month before it is placed in service. From this date until the first period the schedule carries its full cost, so the schedule reconciliation does not report that balance as unscheduled. Leave it out when the cost is booked in the first period.

periodic_amountsoptionalinteger[]

Explicit per-period amounts in cents. When set, the generator uses these values instead of monthly_amount — enabling non-straight-line schedules (effective-interest bond discount amortization, day-count interest accrual, variable lease payments, pre-computed effective-yield curves, etc.). Length must match the number of monthly periods between period_start and period_end; sum must equal original_amount less residual_value exactly. The auto-generated SumEquals rule proves that total regardless of the curve shape.

Example request

curl
curl -X POST "https://api.robosystems.ai/extensions/roboledger/{graph_id}/operations/rebuild-schedule" \
  -H "X-API-Key: $ROBOSYSTEMS_API_KEY" \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{
  "structure_id": "string"
}'

Responses

200 Successful Response

FieldTypeDescription
operationrequiredstring

Kebab-case operation name

operationIdrequiredstring

op_-prefixed ULID for audit and SSE correlation

statusrequiredstring

Operation lifecycle state

One of: completed, pending, failed

resultoptionalScheduleCreatedResponse

Command-specific result payload

ScheduleCreatedResponse fields
FieldTypeDescription
structure_idrequiredstring
namerequiredstring
taxonomy_idrequiredstring
total_periodsrequiredinteger
total_factsrequiredinteger
rule_summaryoptionalobject
schedule_created_event_idoptionalstring
pending_event_countoptionalinteger

Default: 0

warningsoptionalstring[]

What the write went ahead with that deserves a look: another active schedule posting to the same accounts over the same months.

atrequiredstring

ISO-8601 UTC timestamp

createdByoptionalstring

User ID that initiated the operation

idempotentReplayoptionalboolean

True when this envelope came from the idempotency cache — the underlying command did not execute again. False on fresh executions.

Default: false

StatusMeaning
400Invalid request
401Authentication required
403Access denied
404Resource not found
409Idempotency-Key conflict — key reused with different body
422Validation error
429Rate limit exceeded
500Internal server error