Menu

Accrual schedules

Periodiseringar: re-plan the months of a schedule that are not yet posted, with a new period end and/or the day each month books on. Posted months stay as they are; the remainder is split equally.

Endpoints


POST /api/v1/companies/:companyId/accrual-schedules/:id/replan

accrual-schedules.replan · scope bookkeeping:write

Re-plan the months of a periodisering that are not yet posted: a new period end and/or the day each month books on.

Ändra periodisering. Posted months and their verifikat stay exactly as they are; what remains (total minus posted) is split equally over the calendar months of the new period that have no posted month, the same split a new schedule gets. release_day sets the day each month books on (1-31, clamped to the month end, so 31 is the last day; null is the first of the month). Months whose day has already come are booked at once. A deferral only (förutbetald kostnad 17xx, förutbetald intäkt 29xx): an upplupen kostnad is refused. Dry-runnable: the dry run answers the months before and after and writes nothing.

Use when: The service period of a periodiserad invoice line changed (a contract ends early or runs longer), or the months should book on the day the period starts, e.g. the 14th for a rent running 14th to 13th.

Don't use for: Changing months already posted (correct those verifikat, or credit the invoice), booking the whole remainder now (Lös upp nu), or an upplupen kostnad on 29xx.

Pitfalls

  • period_end must be on or after the last posted month and leave at least one unposted month: 400 ACCRUAL_REPLAN_INVALID with details.reason otherwise.
  • A schedule a credit is still settling (cancelled months) or that is not active cannot be re-planned.
  • A month the posting run books between the dry run and the commit makes the commit answer 409 ACCRUAL_REPLAN_CONFLICT: re-read and retry.

Risk: low · Idempotent: yes · Reversible: yes · Dry-run supported: yes · Stage for approval: yes (?stage=true)

Query parameters

NameTypeRequiredDescription
dry_runstringnotrue (any case) previews the write without committing it, like the X-Dry-Run: true header. Any other value commits.
stagestringnotrue stages the write for approval instead of committing it: 202 with the pending operation to approve via POST /pending-operations/{id}/approve. Absent or false commits; other values are 400. A reason in the body (why you propose it, at most 500 characters) is shown to the approver as agent_reason and kept with the decision.

Request body

NameTypeRequiredDescription
period_endstringnoNew last day of the period, YYYY-MM-DD. Unchanged when omitted.
release_daynumber | nullnoDay of the month each month books on (1-31, 31 = last day), null for the first. Unchanged when omitted.

Response fields

NameType
accrual_schedule_idstring
period_startstring
period_end_beforestring
period_end_afterstring
release_day_beforenumber | null
release_day_afternumber | null
remaining_amountnumber
beforeobject[]
afterobject[]
posted_nownumber (optional)

Example request

{
  "period_end": "2027-06-30",
  "release_day": 14
}

Example response

{
  "data": {
    "accrual_schedule_id": "7f3c…",
    "period_start": "2026-07-01",
    "period_end_before": "2026-12-31",
    "period_end_after": "2027-06-30",
    "release_day_before": null,
    "release_day_after": 14,
    "remaining_amount": 4000,
    "before": [
      {
        "period_month": "2026-11-01",
        "amount": 2000,
        "booking_date": "2026-11-01"
      }
    ],
    "after": [
      {
        "period_month": "2026-11-01",
        "amount": 500,
        "booking_date": "2026-11-14"
      }
    ],
    "posted_now": 0
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}