Recurring bills
Templates of vendor bills that repeat (rent, a lease, a subscription the company pays), monthly, quarterly or yearly: created as drafts, activated once the terms are approved, and made on demand by a run that never makes a period twice.
| Operation | Summary | Scope | Idempotency-Key |
|---|---|---|---|
GET /v1/recurring-bills |
List recurring bills | read |
|
POST /v1/recurring-bills |
Create a recurring bill | draft |
required |
POST /v1/recurring-bills/run |
Make the recurring bills that are due | draft |
required |
GET /v1/recurring-bills/{template_id} |
Get a recurring bill | read |
|
PATCH /v1/recurring-bills/{template_id} |
Change a recurring bill | draft |
|
POST /v1/recurring-bills/{template_id}/activate |
Activate a recurring bill | draft |
|
POST /v1/recurring-bills/{template_id}/pause |
Pause a recurring bill | draft |
|
GET /v1/recurring-bills/{template_id}/runs |
List the bills a recurring bill made | read |
GET /v1/recurring-bills
List recurring bills
Recurring bill templates, the one that falls due first at the top (the ended ones last).
due_through is the due list: the templates a run through that day would make bills for.
Read-only.
| Required scope | read (admin implies every scope) |
| Operation id | list_recurring_bills_v1_recurring_bills_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| query | entity |
string or null | Only this entity's templates (code or id). | |
| query | status |
"active" | "draft" | "ended" | "paused" | "pending_approval" or null |
Only templates with this status: draft, pending_approval, active, paused or ended. |
|
| query | party |
string or null | Only this vendor's templates (code or id); needs entity. |
|
| query | due_through |
string (date) or null | Only the templates a run through this day would make bills for: active, with a next due date on or before it (ISO 8601). | |
| query | limit |
integer | How many templates to return, the next to fall due first. (min 1; max 1000; default 100) |
Example request
curl "$ERP_URL/v1/recurring-bills" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of RecurringInvoiceOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"approved_at": "2026-10-28T09:12:44Z",
"approved_by": {
"id": "user:bob",
"name": "Bob",
"type": "human"
},
"auto_submit": false,
"created_at": "2026-10-27T16:03:10Z",
"created_by": {
"id": "user:alice",
"name": "Alice",
"type": "human"
},
"currency": "CHF",
"entity": "CH01",
"frequency": "monthly",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"invoices_made": 1,
"kind": "sales_invoice",
"lines": [
{
"description": "Hosting and support",
"quantity": "1",
"rate_type": "standard",
"reverse_charge": false,
"supply_type": "services",
"unit_price": "450.00",
"vat_scope": "in_scope"
}
],
"name": "Hosting and support, monthly",
"net_total": "450.00",
"next_due": "2026-12-01",
"party_code": "C-CH",
"party_id": "7d1e2f3a-4b5c-4d6e-8f70-91a2b3c4d5e6",
"party_name": "Zürich Kunde AG",
"payment_terms_days": 30,
"start_date": "2026-11-01",
"status": "active",
"terms_approved": true,
"terms_digest": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
}
]
POST /v1/recurring-bills
Create a recurring bill
Create a recurring bill as a draft: the vendor, currency, lines, frequency, start and
end dates and payment terms of a bill that repeats, such as the rent or a lease. Nothing is
booked until a person activates it (POST .../{template_id}/activate) and its terms are
approved, and then a run makes the bills (POST /v1/recurring-bills/run). The first bill is
built without being kept, so a missing account, an unknown vendor or a tax decision that
cannot be made is refused now (404, 422) instead of at the first run. Needs an
Idempotency-Key.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | required |
| Operation id | create_recurring_bill_v1_recurring_bills_post |
Request body
application/json (required): RecurringBillInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the entity that receives the bills. (min length 1) |
party |
string | yes | Code (or id) of the vendor the bills are from. (min length 1) |
name |
string | yes | What the template is called in lists, e.g. Office rent, monthly. (min length 1; max length 200) |
frequency |
"monthly" | "quarterly" | "yearly" |
yes | monthly, quarterly (every 3 months) or yearly. The due dates are counted from start_date and keep its day of the month; a month that is too short takes its last day (start on the 31st: 31 Jan, 28 Feb, 31 Mar, 30 Apr). |
start_date |
string (date) | yes | The first due date (ISO 8601): the date of the first bill. It may lie in the past; a run then makes the bills that are due, a year of monthly ones at most per run. |
end_date |
string (date) or null | The last day a bill may fall due, inclusive (ISO 8601), e.g. the end of the lease; null for no end. After the last due date the template ends by itself. | |
currency |
string or null | ISO 4217 currency of the bills; default: the vendor's currency. (pattern ^[A-Z]{3}$) |
|
payment_terms_days |
integer or null | Days from the bill's date to the day it is to be paid (0: on that day, as rent usually is); default: the vendor's own payment terms. (min 0; max 365) | |
auto_submit |
boolean | false (default): each due bill is created as a draft for a person to submit. true: the system submits it through the approval policy as it is made; the approval of the terms says so on its face. (default false) |
|
notes |
string or null | Free text kept on every bill. | |
lines |
array of DocumentLineInput |
yes | The lines of every bill, as on POST /v1/documents for a purchase_bill: the input VAT is determined for each bill on its own date by the same rules as for a bill entered by hand. (min items 1) |
Example request
curl -X POST "$ERP_URL/v1/recurring-bills" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"entity": "CH01",
"frequency": "monthly",
"lines": [
{
"description": "Office rent",
"quantity": "1",
"unit_price": "2400.00"
}
],
"name": "Office rent, monthly",
"party": "V-00004",
"payment_terms_days": 0,
"start_date": "2026-12-01"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | RecurringInvoiceOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"approved_at": "2026-10-28T09:12:44Z",
"approved_by": {
"id": "user:bob",
"name": "Bob",
"type": "human"
},
"auto_submit": false,
"created_at": "2026-10-27T16:03:10Z",
"created_by": {
"id": "user:alice",
"name": "Alice",
"type": "human"
},
"currency": "CHF",
"entity": "CH01",
"frequency": "monthly",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"invoices_made": 1,
"kind": "sales_invoice",
"lines": [
{
"description": "Hosting and support",
"quantity": "1",
"rate_type": "standard",
"reverse_charge": false,
"supply_type": "services",
"unit_price": "450.00",
"vat_scope": "in_scope"
}
],
"name": "Hosting and support, monthly",
"net_total": "450.00",
"next_due": "2026-12-01",
"party_code": "C-CH",
"party_id": "7d1e2f3a-4b5c-4d6e-8f70-91a2b3c4d5e6",
"party_name": "Zürich Kunde AG",
"payment_terms_days": 30,
"start_date": "2026-11-01",
"status": "active",
"terms_approved": true,
"terms_digest": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
}
POST /v1/recurring-bills/run
Make the recurring bills that are due
Make the bills of every active recurring bill that has a due date on or before through
(never after today where the template's company is), in date order, as ordinary vendor bills
dated their due date: a draft for a person to submit, or, with auto_submit, submitted by
the system through the approval policy. Idempotent: one bill per template and due date,
enforced by the database. A period that cannot be made (a closed period, an inactive vendor) is
failed with its error and tried again by the next run. At most twelve due dates per template
in one run: more_due says to run again. Needs an Idempotency-Key.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | required |
| Operation id | run_recurring_bills_v1_recurring_bills_run_post |
Request body
application/json (required): RecurringRunInput
| Field | Type | Required | Description |
|---|---|---|---|
through |
string (date) | yes | Make the invoices that fall due on or before this day (ISO 8601, inclusive). It may not lie more than a day after the server's date (UTC), so your own date is always accepted. |
entity |
string or null | Only the templates of this entity (code or id); default: all. | |
template |
string (uuid) or null | Only this template (it must be active); default: every one. |
Example request
curl -X POST "$ERP_URL/v1/recurring-bills/run" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"entity": "CH01",
"through": "2026-11-30"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | RecurringRunResult |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"failed": 0,
"items": [
{
"document_id": "9b2f6a3e-1c4d-4e8a-8f10-5d7c2a9e4b11",
"due_date": "2026-11-01",
"status": "drafted",
"template_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"template_name": "Hosting and support, monthly"
},
{
"document_id": "0f1e2d3c-4b5a-4968-8776-655443322110",
"due_date": "2026-12-01",
"status": "drafted",
"template_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"template_name": "Hosting and support, monthly"
}
],
"made": 2,
"more_due": false,
"through": "2026-12-01"
}
GET /v1/recurring-bills/{template_id}
Get a recurring bill
One recurring bill: its terms, status, next due date, whether the current terms are the
approved ones (terms_approved), the pending approval request and how many bills it has made
(invoices_made). 404 when it does not exist.
| Required scope | read (admin implies every scope) |
| Operation id | get_recurring_bill_v1_recurring_bills__template_id__get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | template_id |
string (uuid) | yes | Id of the recurring bill (GET /v1/recurring-bills). |
Example request
curl "$ERP_URL/v1/recurring-bills/3fa85f64-5717-4562-b3fc-2c963f66afa6" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | RecurringInvoiceOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"approved_at": "2026-10-28T09:12:44Z",
"approved_by": {
"id": "user:bob",
"name": "Bob",
"type": "human"
},
"auto_submit": false,
"created_at": "2026-10-27T16:03:10Z",
"created_by": {
"id": "user:alice",
"name": "Alice",
"type": "human"
},
"currency": "CHF",
"entity": "CH01",
"frequency": "monthly",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"invoices_made": 1,
"kind": "sales_invoice",
"lines": [
{
"description": "Hosting and support",
"quantity": "1",
"rate_type": "standard",
"reverse_charge": false,
"supply_type": "services",
"unit_price": "450.00",
"vat_scope": "in_scope"
}
],
"name": "Hosting and support, monthly",
"net_total": "450.00",
"next_due": "2026-12-01",
"party_code": "C-CH",
"party_id": "7d1e2f3a-4b5c-4d6e-8f70-91a2b3c4d5e6",
"party_name": "Zürich Kunde AG",
"payment_terms_days": 30,
"start_date": "2026-11-01",
"status": "active",
"terms_approved": true,
"terms_digest": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
}
PATCH /v1/recurring-bills/{template_id}
Change a recurring bill
Change a recurring bill. Omitted fields keep their value; lines replaces every line. Only
name changes without consequence: any change to the terms pauses an active template until
the new terms are approved. frequency and start_date cannot change once a bill was made
(409). 409 for an ended template; 404, 422 as when creating.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | update_recurring_bill_v1_recurring_bills__template_id__patch |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | template_id |
string (uuid) | yes | Id of the recurring bill (GET /v1/recurring-bills). |
Request body
application/json (required): RecurringBillUpdate
| Field | Type | Required | Description |
|---|---|---|---|
party |
string or null | Code (or id) of the vendor. | |
name |
string or null | What the template is called. (min length 1; max length 200) | |
frequency |
"monthly" | "quarterly" | "yearly" or null |
monthly, quarterly or yearly; before the first invoice. |
|
start_date |
string (date) or null | The first due date (ISO 8601); before the first invoice. | |
end_date |
string (date) or null | The last due date, inclusive; null removes the end. |
|
currency |
string or null | ISO 4217 currency of the bills. (pattern ^[A-Z]{3}$) |
|
payment_terms_days |
integer or null | Days to pay; null takes the vendor's own terms. (min 0; max 365) |
|
auto_submit |
boolean or null | Whether the system submits each bill as it is made. | |
notes |
string or null | Free text on every bill. | |
lines |
array of DocumentLineInput or null |
The new lines; they replace all existing lines (at least one). (min items 1) |
Example request
curl -X PATCH "$ERP_URL/v1/recurring-bills/3fa85f64-5717-4562-b3fc-2c963f66afa6" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{
"end_date": "2028-11-30",
"payment_terms_days": 0
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | RecurringInvoiceOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"approved_at": "2026-10-28T09:12:44Z",
"approved_by": {
"id": "user:bob",
"name": "Bob",
"type": "human"
},
"auto_submit": false,
"created_at": "2026-10-27T16:03:10Z",
"created_by": {
"id": "user:alice",
"name": "Alice",
"type": "human"
},
"currency": "CHF",
"entity": "CH01",
"frequency": "monthly",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"invoices_made": 1,
"kind": "sales_invoice",
"lines": [
{
"description": "Hosting and support",
"quantity": "1",
"rate_type": "standard",
"reverse_charge": false,
"supply_type": "services",
"unit_price": "450.00",
"vat_scope": "in_scope"
}
],
"name": "Hosting and support, monthly",
"net_total": "450.00",
"next_due": "2026-12-01",
"party_code": "C-CH",
"party_id": "7d1e2f3a-4b5c-4d6e-8f70-91a2b3c4d5e6",
"party_name": "Zürich Kunde AG",
"payment_terms_days": 30,
"start_date": "2026-11-01",
"status": "active",
"terms_approved": true,
"terms_digest": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
}
POST /v1/recurring-bills/{template_id}/activate
Activate a recurring bill
Ask for the terms of a draft or paused recurring bill to be approved, so that runs make its
bills. A human decision: the policy action activate_recurring_invoice denies agents
(403). By default the AI reviewer or a second person approves
(POST /v1/approvals/{approval_id}/approve), bound to the digest of the terms. A paused
template whose terms are the ones already approved runs again at once. 409 when the vendor is
not active, the template is not a draft or paused, or no due date is left.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | activate_recurring_bill_v1_recurring_bills__template_id__activate_post |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | template_id |
string (uuid) | yes | Id of the recurring bill (GET /v1/recurring-bills). |
Example request
curl -X POST "$ERP_URL/v1/recurring-bills/3fa85f64-5717-4562-b3fc-2c963f66afa6/activate" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | RecurringActivation |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"approval_id": "c2d4e6f8-0a1b-4c3d-9e5f-7a8b9c0d1e2f",
"policy": "require_approval",
"template": {
"approval_id": "c2d4e6f8-0a1b-4c3d-9e5f-7a8b9c0d1e2f",
"auto_submit": false,
"created_at": "2026-10-27T16:03:10Z",
"created_by": {
"id": "user:alice",
"name": "Alice",
"type": "human"
},
"currency": "CHF",
"entity": "CH01",
"frequency": "monthly",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"invoices_made": 1,
"kind": "sales_invoice",
"lines": [
{
"description": "Hosting and support",
"quantity": "1",
"rate_type": "standard",
"reverse_charge": false,
"supply_type": "services",
"unit_price": "450.00",
"vat_scope": "in_scope"
}
],
"name": "Hosting and support, monthly",
"net_total": "450.00",
"next_due": "2026-12-01",
"party_code": "C-CH",
"party_id": "7d1e2f3a-4b5c-4d6e-8f70-91a2b3c4d5e6",
"party_name": "Zürich Kunde AG",
"payment_terms_days": 30,
"start_date": "2026-11-01",
"status": "pending_approval",
"terms_approved": false
}
}
POST /v1/recurring-bills/{template_id}/pause
Pause a recurring bill
Stop an active recurring bill from making bills, with a reason kept in the audit trail. It makes none until it is activated again (at once if its terms are unchanged). 409 unless the template is active.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | pause_recurring_bill_v1_recurring_bills__template_id__pause_post |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | template_id |
string (uuid) | yes | Id of the recurring bill (GET /v1/recurring-bills). |
Request body
application/json (required): RecurringPause
| Field | Type | Required | Description |
|---|---|---|---|
reason |
string | yes | Why; kept with the template and in the audit. (min length 1; max length 500) |
Example request
curl -X POST "$ERP_URL/v1/recurring-bills/3fa85f64-5717-4562-b3fc-2c963f66afa6/pause" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Price list under renegotiation: hold invoices"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | RecurringInvoiceOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"approved_at": "2026-10-28T09:12:44Z",
"approved_by": {
"id": "user:bob",
"name": "Bob",
"type": "human"
},
"auto_submit": false,
"created_at": "2026-10-27T16:03:10Z",
"created_by": {
"id": "user:alice",
"name": "Alice",
"type": "human"
},
"currency": "CHF",
"entity": "CH01",
"frequency": "monthly",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"invoices_made": 1,
"kind": "sales_invoice",
"lines": [
{
"description": "Hosting and support",
"quantity": "1",
"rate_type": "standard",
"reverse_charge": false,
"supply_type": "services",
"unit_price": "450.00",
"vat_scope": "in_scope"
}
],
"name": "Hosting and support, monthly",
"net_total": "450.00",
"next_due": "2026-12-01",
"party_code": "C-CH",
"party_id": "7d1e2f3a-4b5c-4d6e-8f70-91a2b3c4d5e6",
"party_name": "Zürich Kunde AG",
"payment_terms_days": 30,
"start_date": "2026-11-01",
"status": "active",
"terms_approved": true,
"terms_digest": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8"
}
GET /v1/recurring-bills/{template_id}/runs
List the bills a recurring bill made
Every period a run has made or tried for the template, oldest first: the due date, what came
of it (drafted, posted, pending_approval, failed), the bill with its number and its
status now, the error of a failed period, and who ran it. 404 when it does not exist.
| Required scope | read (admin implies every scope) |
| Operation id | list_recurring_bill_runs_v1_recurring_bills__template_id__runs_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | template_id |
string (uuid) | yes | Id of the recurring bill (GET /v1/recurring-bills). |
Example request
curl "$ERP_URL/v1/recurring-bills/3fa85f64-5717-4562-b3fc-2c963f66afa6/runs" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of RecurringRunOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"created_at": "2026-11-02T08:30:00Z",
"created_by": {
"id": "user:alice",
"name": "Alice",
"type": "human"
},
"document_id": "9b2f6a3e-1c4d-4e8a-8f10-5d7c2a9e4b11",
"document_number": "INV-2026-000042",
"document_status": "posted",
"due_date": "2026-11-01",
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"status": "posted",
"template_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
Schemas
RecurringBillInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the entity that receives the bills. (min length 1) |
party |
string | yes | Code (or id) of the vendor the bills are from. (min length 1) |
name |
string | yes | What the template is called in lists, e.g. Office rent, monthly. (min length 1; max length 200) |
frequency |
"monthly" | "quarterly" | "yearly" |
yes | monthly, quarterly (every 3 months) or yearly. The due dates are counted from start_date and keep its day of the month; a month that is too short takes its last day (start on the 31st: 31 Jan, 28 Feb, 31 Mar, 30 Apr). |
start_date |
string (date) | yes | The first due date (ISO 8601): the date of the first bill. It may lie in the past; a run then makes the bills that are due, a year of monthly ones at most per run. |
end_date |
string (date) or null | The last day a bill may fall due, inclusive (ISO 8601), e.g. the end of the lease; null for no end. After the last due date the template ends by itself. | |
currency |
string or null | ISO 4217 currency of the bills; default: the vendor's currency. (pattern ^[A-Z]{3}$) |
|
payment_terms_days |
integer or null | Days from the bill's date to the day it is to be paid (0: on that day, as rent usually is); default: the vendor's own payment terms. (min 0; max 365) | |
auto_submit |
boolean | false (default): each due bill is created as a draft for a person to submit. true: the system submits it through the approval policy as it is made; the approval of the terms says so on its face. (default false) |
|
notes |
string or null | Free text kept on every bill. | |
lines |
array of DocumentLineInput |
yes | The lines of every bill, as on POST /v1/documents for a purchase_bill: the input VAT is determined for each bill on its own date by the same rules as for a bill entered by hand. (min items 1) |
RecurringBillUpdate
Changes to a recurring bill. Omitted fields keep their value; null clears an optional one.
A change to anything but name is a change of the terms: it pauses an active template (and
takes a template waiting for approval back to draft), and the template runs again only after
the new terms are approved. frequency and start_date can change only before the first bill
was made.
| Field | Type | Required | Description |
|---|---|---|---|
party |
string or null | Code (or id) of the vendor. | |
name |
string or null | What the template is called. (min length 1; max length 200) | |
frequency |
"monthly" | "quarterly" | "yearly" or null |
monthly, quarterly or yearly; before the first invoice. |
|
start_date |
string (date) or null | The first due date (ISO 8601); before the first invoice. | |
end_date |
string (date) or null | The last due date, inclusive; null removes the end. |
|
currency |
string or null | ISO 4217 currency of the bills. (pattern ^[A-Z]{3}$) |
|
payment_terms_days |
integer or null | Days to pay; null takes the vendor's own terms. (min 0; max 365) |
|
auto_submit |
boolean or null | Whether the system submits each bill as it is made. | |
notes |
string or null | Free text on every bill. | |
lines |
array of DocumentLineInput or null |
The new lines; they replace all existing lines (at least one). (min items 1) |