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

accrual-schedules.create · scope bookkeeping:write

Create a periodisering by hand for an amount on 17xx/29xx that no invoice line in Accounted carries, with monthly catch-up.

Ny periodisering. Spreads amount_sek over calendar months with the same installments and catch-up as an invoice plan. For a deferral (förutbetald kostnad on 17xx, förutbetald intäkt on 29xx) amount_sek is what remains to dissolve: it may not exceed the balance left on balance_account (from its latest ingående balans on, after every month already dissolved, by Accounted, by hand or by an imported voucher from an earlier system) less the months not yet posted of other active plans on the account, nor what the origin verifikat or ingående balans put there. Start at the first month not yet dissolved. An upplupen kostnad (29xx) or intäkt (17xx) has no such limit. Months already begun post at approval; the rest post through the nightly accrual run. Dry-runnable: the dry run answers the months and available_sek and writes nothing.

Use when: A migration brought a running periodisering whose remaining months must keep dissolving, or a bank booking or the ingående balans put an annual insurance, licence or rent on 17xx/29xx without an invoice line in Accounted.

Don't use for: An invoice line in Accounted (periodisera on that line), changing an existing plan (replan it), or undoing one (cancel it).

Pitfalls

  • For a migrated plan give the REMAINING amount and the first month not yet dissolved: the earlier system's dissolutions are already in the books, and booking a month twice is refused with 400 ACCRUAL_BALANCE_EXCEEDED (details.available_sek says what is left).
  • Without origin_journal_entry_id a deferral comes from the ingående balans: 400 ACCRUAL_OPENING_BALANCE_MISSING when the account has none. A reversed origin is refused (ACCRUAL_ORIGIN_REVERSED).
  • Give either months (1-120) or period_end. The amount is split in öre over every calendar month and sums exactly to amount_sek. target_account must be a resultatkonto, 3xxx-8xxx.
  • Reversing the origin verifikat later cancels the plan and stornoes the months it posted.

Risk: medium · 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
direction"expense" | "revenue"yesexpense: a cost (förutbetald kostnad on 17xx, upplupen kostnad on 29xx); revenue: förutbetald intäkt on 29xx, upplupen intäkt on 17xx.
amount_seknumberyesWhat remains to spread, in SEK: for a migrated or half-dissolved item, the balance left on the account, not the original amount.
balance_accountstringyesThe interim account the amount sits on, 17xx or 29xx.
target_accountstringyesThe resultatkonto each month dissolves to, 3xxx-8xxx.
period_startstringyesThe first month not yet dissolved, YYYY-MM-DD (any day of the month).
monthsnumbernoNumber of months, 1-120. Give this or period_end.
period_endstringnoThe last month, YYYY-MM-DD. Give this or months.
descriptionstringyes
dimensionsobjectno
origin_journal_entry_idstringnoThe posted verifikat that put the amount on balance_account. Omit when it came with the ingående balans.

Response fields

NameType
accrual_schedule_idstring
source_kind"manual"
direction"expense" | "revenue"
balance_accountstring
target_accountstring
total_amountnumber
period_startstring
period_endstring
monthsnumber
origin_journal_entry_idstring | null
posting_floor_datestring

Example request

{
  "direction": "expense",
  "amount_sek": 6000,
  "balance_account": "1790",
  "target_account": "6570",
  "period_start": "2026-07-01",
  "months": 6,
  "description": "Årsavgift bankpaket, resterande månader",
  "origin_journal_entry_id": "5b1e…"
}

Example response

{
  "data": {
    "accrual_schedule_id": "7f3c…",
    "source_kind": "manual",
    "direction": "expense",
    "balance_account": "1790",
    "target_account": "6570",
    "total_amount": 6000,
    "period_start": "2026-07-01",
    "period_end": "2026-12-31",
    "months": 6,
    "origin_journal_entry_id": "5b1e…",
    "posting_floor_date": "2026-01-10"
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}

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

accrual-schedules.cancel · scope bookkeeping:write

Undo a periodisering set up by hand: cancel its months not yet posted and storno the months it posted.

Ångra periodisering. The months not yet posted are cancelled and every month the plan posted is stornoed (dated today when today lies in that month's fiscal year, else on the month's own date), so the whole amount is back on the balance account. Only a manual plan: an invoice's plan is cancelled by crediting the invoice. Dry-runnable: the dry run lists the months it would cancel and reverse.

Use when: A manual periodisering was set up wrong (amount, accounts, months), or the item it spreads no longer exists.

Don't use for: Booking the rest now (Lös upp nu), moving the end or the booking day (replan it), or an invoice's plan (credit the invoice).

Pitfalls

  • A month whose storno fails (a locked or closed year) keeps the plan active with failed_reversals > 0 and a last_error on the month: unlock and cancel again.
  • Reversing the origin verifikat runs the same undo on its own.

Risk: medium · Idempotent: yes · Reversible: no · 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.

Response fields

NameType
accrual_schedule_idstring
status"cancelled" | "active"
cancelled_monthsnumber
reversed_entriesnumber
failed_reversalsnumber

Example request

{}

Example response

{
  "data": {
    "accrual_schedule_id": "7f3c…",
    "status": "cancelled",
    "cancelled_months": 4,
    "reversed_entries": 2,
    "failed_reversals": 0
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}

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"
  }
}