Skip to content

Implementation example

This section gives a step-by-step example for fetching debt invoice data, related invoices, spaces, contracts, and optional files, then writing payments or events.

Step 1: Debt invoices (starting point)

Option A — by attested date (e.g. last 1 day).

Option B — by known IDs.

Endpoint: GET /accounting/debt/debtinvoice/list/

Option A:

GET .../accounting/debt/debtinvoice/list/?_page=1&_page_size=500&attested_date__gte=2025-01-15

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • attested_date__gte — Only debt invoices attested on or after this date (e.g. 2025-01-15)

Option B:

GET .../accounting/debt/debtinvoice/list/?_page=1&_page_size=500&id__in=<debt-invoice-id-1>,<debt-invoice-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • id__in — Comma-separated debt invoice IDs

Build the set of invoice IDs from the debt invoices' invoice field.

Endpoint: GET list for accounting.invoice

GET .../accounting/invoice/list/?_page=1&_page_size=500&id__in=<invoice-id-1>,<invoice-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • id__in — Comma-separated invoice IDs from debt invoices (step 1)

Step 3: Invoice recipients

Endpoint: GET list for accounting.invoicerecipient

GET .../accounting/invoicerecipient/list/?_page=1&_page_size=500&invoice__in=<invoice-id-1>,<invoice-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • invoice__in — Comma-separated invoice IDs from step 1

Step 4 (optional): Debt invoice events

Endpoint: GET list for accounting.debtinvoiceevent

GET .../accounting/debtinvoiceevent/list/?_page=1&_page_size=500&debt_invoice__in=<debt-invoice-id-1>,<debt-invoice-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • debt_invoice__in — Comma-separated debt invoice IDs from step 1

Step 5 (optional): Tenants and sub-tenants

Collect tenant IDs from the recipients, then fetch accounts.tenant. If needed, do the same for sub-tenants.

Endpoint: GET list for accounts.tenant

GET .../accounts/tenant/list/?_page=1&_page_size=500&id__in=<tenant-id-1>,<tenant-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • id__in — Comma-separated tenant IDs from recipients (step 3)

Step 6 (optional): Invoice PDF files

Endpoint: List endpoint for accounting.invoicerelatedpdffile (see API Reference).

GET .../accounting/invoicerelatedpdffile/list/?_page=1&_page_size=500&invoice__in=<invoice-id-1>,<invoice-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • invoice__in — Comma-separated invoice IDs from step 1

Step 7: Space and contract data

From each accounting.invoice, use originates_from_content_type and originates_from_object_id to build a map of contract IDs per content type. From the contracts, collect space IDs and fetch spaces.

Endpoint: List endpoint for the contract type (e.g. contracts.apartmentcontract).

GET .../contracts/apartmentcontract/list/?_page=1&_page_size=500&id__in=<contract-id-1>,<contract-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • id__in — Comma-separated contract IDs from invoices (originates_from_object_id)

Endpoint: List endpoint for the space type (e.g. objects.apartment).

GET .../objects/apartment/list/?_page=1&_page_size=500&id__in=<space-id-1>,<space-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • id__in — Comma-separated space IDs from contracts

SignedContractDocument (imported, not signed in Pigello).

SignableDocument (signed in Pigello). For SignableDocument file data, GET /documents/signing/signabledocument/<id>/document_data/. The response may contain a URL to a file (often a ZIP with the main PDF, attachment PDFs, and metadata). Unzip to get the main PDF or other content.

Endpoint: List endpoint for contracts.signedcontractdocument.

GET .../contracts/signedcontractdocument/list/<content-type>/?_page=1&_page_size=500&object_id__in=<contract-id-1>,<contract-id-2>

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • object_id__in — Comma-separated contract IDs from step 7

Example content-type: contracts.apartmentcontract.

Endpoint: List endpoint for documents.signabledocument.

GET .../documents/signing/signabledocument/list/<content-type>/?_page=1&_page_size=500&object_id__in=<contract-id-1>,<contract-id-2>&signed_time__isnull=false

Query parameters:

  • _page — Page number (e.g. 1)
  • _page_size — Page size (e.g. 500)
  • object_id__in — Comma-separated contract IDs from step 7
  • signed_time__isnullfalse to only include signed documents

Data writing