Menu
Cookbooks
API reference
- Overview
- Companies
- Capabilities
- Measures
- Packages
- Unexplained
- Liquidity forecast
- Portfolio
- Customers
- Invoices
- Collections
- Articles
- Set-offs
- Suppliers
- Supplier invoices
- Supplier payment files
- Bank payments
- Expense claims
- Transactions
- Reconciliation
- Bank accounts
- POS sales
- Webshop orders
- Journal entries
- Voucher gap explanations
- Fiscal periods
- Accounts
- Accrual schedules
- Agreements and commitments
- Tax loss carry-forwards
- Fixed assets
- Documents
- Signing requests
- Company registers
- Capital events
- Owner tax
- Inbox items
- Dimensions
- Employees
- Salary runs
- Reports
- Budgets
- Imports
- Compliance check
- Skatteverket
- Peppol
- Webhooks
- Operations
- Pending operations
- Health
- API key
- Service accounts
Set-offs
Kvittning: a counterparty that is both customer and supplier as one relation (open customer and supplier invoices, the net per currency, its set-offs), and setting an open customer invoice off against an open supplier invoice of the same counterparty. Served while the company has set-offs switched on.
Endpoints
GET/api/v1/companies/:companyId/setoffs/counterparty: A counterparty that is both customer and supplier, as one relation: its open customer and supplier invoices, the net per currency and its set-offs.POST/api/v1/companies/:companyId/setoffs: Set off (kvitta) an open customer invoice against an open supplier invoice of the same counterparty: one verifikat, both invoices lowered, the net left to pay or receive.
GET /api/v1/companies/:companyId/setoffs/counterparty
invoices.counterparty-balance.get · scope reports:read
A counterparty that is both customer and supplier, as one relation: its open customer and supplier invoices, the net per currency and its set-offs.
Name the counterparty by exactly one of party_id, customer_id or supplier_id. Every customer and supplier card of the same legal person (one party, linked by organisation number) is included. Each open invoice says whether it can be set off now and why not (ineligible_reason). The net is receivable minus payable: above zero they pay us, below zero we pay them. Credit notes are not included.
Use when: Deciding what to set off between a customer that is also a supplier, or checking what is left to pay or receive after a set-off.
Don't use for: The full kund- or leverantörsreskontra (use the ledger reports).
Pitfalls
- A card without an organisation number has no party until it is merged in Motparter (404 SETOFF_PARTY_NOT_FOUND).
- Totals are per currency; only SEK invoices can be set off.
Risk: low · Idempotent: yes · Reversible: no · Dry-run supported: no
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
party_id | string | no | The counterparty (Motparter). |
customer_id | string | no | A customer card of the counterparty. |
supplier_id | string | no | A supplier card of the counterparty. |
Response fields
| Name | Type |
|---|---|
party | object |
customers | object[] |
suppliers | object[] |
receivables | object[] |
payables | object[] |
totals | object[] |
setoffs | object[] |
Example request
{
"customer_id": "6b0e…"
}
Example response
{
"data": {
"party": {
"party_id": "7fc2…",
"name": "Exempel Energi AB",
"org_number": "5599887766"
},
"totals": [
{
"currency": "SEK",
"receivable": 1388,
"payable": 4504,
"net": -3116,
"direction": "we_pay"
}
]
},
"meta": {
"request_id": "req_…",
"api_version": "2026-05-12"
}
}
POST /api/v1/companies/:companyId/setoffs
invoices.setoff.book · scope invoices:write
Set off (kvitta) an open customer invoice against an open supplier invoice of the same counterparty: one verifikat, both invoices lowered, the net left to pay or receive.
Books Dr accounts payable / Cr accounts receivable (the accounts the invoices' own vouchers booked) for amount, at most the smaller remaining amount (the default). VAT is untouched. Both invoices get a payment row dated setoff_date and their remaining amounts go down; the net is then matched to the bank line like any part payment. A kvittningsavräkning is archived on the verifikat as underlag. SEK only; refused for credit notes, ROT/RUT invoices, invoices not booked as receivable or payable (kontantmetoden), an open collection case, or a supplier invoice with a payment on its way.
Use when: A company sells to and buys from the same legal person and settles the two against each other instead of paying both in full.
Don't use for: Settling a credit note against its invoice (credit the invoice), or recording a payment received or made (mark the invoice paid or match the bank line).
Pitfalls
- Both cards must belong to the same counterparty (same organisation number, or merged in Motparter): 422 SETOFF_PARTY_MISMATCH / SETOFF_NO_PARTY.
- A supplier invoice entered at the bank, in a payment file or in an open payment order is refused (409 SETOFF_PAYMENT_IN_FLIGHT): the bank would pay the full amount.
- A mistake is undone by reversing (storno) the set-off verifikat; it is never corrected in place.
Risk: high · Idempotent: yes · Reversible: yes · Dry-run supported: yes · Stage for approval: yes (?stage=true)
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
dry_run | string | no | true (any case) previews the write without committing it, like the X-Dry-Run: true header. Any other value commits. |
stage | string | no | true 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
| Name | Type | Required | Description |
|---|---|---|---|
invoice_id | string | yes | The open customer invoice. |
supplier_invoice_id | string | yes | The open supplier invoice of the same counterparty. |
amount | number | no | In SEK; the smaller of the two remaining amounts when omitted. |
setoff_date | string | no | The verifikat date; today when omitted. |
note | string | no | The agreement or notice the set-off rests on. |
party_id | string | no | The counterparty the approver saw; refused if the invoices belong to another. |
Response fields
| Name | Type |
|---|---|
setoff_id | string |
journal_entry_id | string |
voucher_series | string | null |
voucher_number | number | null |
party_id | string |
amount | number |
setoff_date | string |
invoice | object |
supplier_invoice | object |
net | object |
underlag_document_id | string | null |
Example request
{
"invoice_id": "2a9c…",
"supplier_invoice_id": "79f1…",
"setoff_date": "2026-09-30",
"note": "Kvittning enligt flexavtal"
}
Example response
{
"data": {
"setoff_id": "5d1e…",
"journal_entry_id": "c41d…",
"amount": 1388,
"invoice": {
"invoice_id": "2a9c…",
"status": "paid",
"remaining_amount": 0
},
"supplier_invoice": {
"supplier_invoice_id": "79f1…",
"status": "partially_paid",
"remaining_amount": 3116
},
"net": {
"direction": "we_pay",
"amount": 3116
}
},
"meta": {
"request_id": "req_…",
"api_version": "2026-05-12"
}
}