Skip to content

Create & Book Invoice

Issuing an invoice is two stages: create it (status CREATED), then activate it. Activation posts the invoice into the ledger and is what “booked” means - the invoice reaches status ACTIVATED with a bookedDate. Factoring adds a credit-decision step on top of the same path.

POST /invoices takes the structured createInvoice object (nested debtor, dates, articleRows, currency), not a flat amount. Required right: CreateInvoices. There is also a machine-to-machine variant, POST /invoices/integration (permission invoice:create), for token-based integrations. Such an integration uploads invoice PDFs as described in Upload a PDF (machine-to-machine). A user token uploads documents with the routes in Upload invoice documents.

FieldRequiredNotes
invoiceNumberyesYour invoice number. Must be unique per client, credit invoices included (see Invoice numbers and payment references). Leading and trailing spaces are removed.
articleRowsyesList of line items (see below).
debtoryesNested debtor object (see below). The debtor is matched/created automatically - no separate debtor call.
datesyesNested object with invoiceDate and expireDate.
totalsyesNested object with total, totalExclVat and totalVat; totalRoundOff is optional. A request without them is refused with Required field 'totals.total' missing (see Totals and VAT must agree).
clientIdconditionalTop-level. Required with a system token (scopes the invoice to a client). Omit it with a client token - it is taken from the token.
currencynoNested object; see Currency below. Defaults to the tenant’s configured currency.
typenoINVOICE, CREDIT_INVOICE, etc. Defaults to a standard invoice.
serviceProviderCodenoWhich installed service provider administers the invoice.
paymentReferencenoNormally generated by Quiddly. Only send it when the client is allowed to set its own reference; it must be unique per client (see Invoice numbers and payment references).
terms.paymentnoPayment terms text. Printed on the invoice document exactly as sent (see Payment terms).
feesnoNested object with the two header-level fees, administration and freight, each with a ...VatPercentage (see Fees and discounts).
distributionCodenoChannel to start distribution on. Can also be set at activation (see Distribution).
disableFallbackDistributionnotrue stops Quiddly from trying another channel when this one fails (see Distribution).

productCode is not set here - it is chosen at activation (step 2).

FieldRequiredNotes
customerNumberyesYour customer number for the debtor. This is the matching key - Quiddly maps it to an existing debtor or creates one.
nameyesPerson or company name.
typeyesCOMPANY or PERSON.
identificationNumbernoOrg/SSN. Recommended; improves matching and is needed for collection and for financing. Validated against the debtor’s locale (see Identification number and locale).
localenoThe debtor’s legal country: a two-letter country code, or OTHER. Shown as Legal Country in the portals. If omitted it is taken from the debtor already matched by customerNumber. Not the same as invoiceAddress.countryCode.
email, phone, invoiceAddress, deliveryAddress, peppolId, …noContact and routing details.
FMInoRecipient address for the consumer bank e-invoice network (Swedish FMI, Norwegian eFakturaadresse). Only relevant when type is PERSON and the invoice goes out as ELECTRONIC_INVOICE. Leave it out to have it looked up from identificationNumber against the register for the debtor’s country.
segmentCodenoThe code of an existing debtor segment. It sets the segment on the invoice debtor, and on the client debtor only when this invoice creates that debtor. It is not part of the update-invoice request. See Segments.

Debtor data on each invoice updates the debtor

Section titled “Debtor data on each invoice updates the debtor”

The debtor you send with an invoice is stored as a snapshot on that invoice. When the invoice is activated, Quiddly also writes that data to the debtor record matched by customerNumber, so the next invoice and the portals show it:

  • The debtor’s contact name, delivery address and invoice address are copied from the invoice every time. A delivery address that is empty on the invoice empties the one on the debtor.
  • E-mail, phone, cell phone, identification number, legal country (locale), GLN, VAT number and preferred language are written when you send them, and kept when you leave them out. An identification number cannot be blanked out on an existing debtor.

So a correction made on the debtor in a portal can be overwritten by the next activated invoice that still carries the old value. Fix the value in the system that sends the invoices, not only in the portal.

Delivery address. Leave deliveryAddress out when there is none. For an address without a name, Quiddly empties name, address, zip, city and countryCode. name2, address2 and address3 are kept as you sent them.

FieldRequired
invoiceDateyes
expireDateyes
deliveryDateno

The list is required. Individual rows have no single mandatory field - send the ones you have (description, quantity, unit, price, vatPercentage, articleNumber, accountNumber, …). Alternatively set articleRowsGenerate: true to let Quiddly compute the rows/totals from the invoice data.

The invoice has two header-level fees, set in the fees object: administration and freight, each with its own VAT percentage (administrationVatPercentage, freightVatPercentage). fees has no other fee. (claimedFees, meant for COLLECTION_SERVICE, records a reminder fee and interest already claimed from the debtor.) Send any further fee as an article row.

There is no header-level discount either. A discount belongs to an article row: set totalDiscount and discountType (PERCENTAGE or CURRENCY) on the row, or lower the row’s price. To discount a whole invoice, split the discount across the rows yourself.

Currency is set inside the nested currency object, not at the top level:

"currency": { "invoiceCurrency": "SEK", "baseCurrency": "SEK" }

invoiceCurrency is what the PDF shows. baseCurrency (optional) is the currency the invoice is settled in, and it, not invoiceCurrency, decides which client account (payment account) the invoice uses. If you send no baseCurrency, Quiddly uses the system currency. If you send no invoiceCurrency, both are the system currency, even when you sent a baseCurrency.

At activation the product matters. An invoice activated with a financed product (INVOICE_FACTORING_SELL or INVOICE_FACTORING_LOAN) gets baseCurrency set to invoiceCurrency, whatever you sent. An invoice activated as a service invoice keeps the baseCurrency you sent. When an invoice is booked on an unexpected account, check its baseCurrency first, then the payment account it resolves to.

GET /invoices/<id>/payment-account (right ReadInvoice) returns the account the invoice resolves to, from the client (and its instance provider), the baseCurrency, the product and the service provider: currency, accountNumber, receiverName, bankName, iban, bic and isFinanced. When no account can be resolved, the call answers 400 with a message that starts with No payment account found.

totals is required (total, totalExclVat and totalVat). The VAT breakdown (vats) is optional: when you leave it out, Quiddly builds it from the article rows.

totals, and vats when you send it, are used as sent, so they must add up:

  • vats needs articleRows in the same request. Send one entry per VAT percentage with percentage and totalVat; Quiddly computes the taxable amount per percentage from the rows.
  • The e-invoice takes the invoice’s total VAT from totals.totalVat and the VAT per rate from vats. Make totals.totalVat equal the sum of the vats entries. When the VAT per row rounds differently, send vats explicitly with the same total as totals.totalVat.
  • Let totalExclVat plus totalVat plus totalRoundOff equal total. The e-invoice derives its rounding amount as total minus totalExclVat minus totalVat, and the ledger books totalRoundOff as its own posting when it is not zero, so put any rounding difference in totalRoundOff.

Quiddly stores every row amount (totalDiscount, totalExclVat, totalVat, total) and every header total rounded to two decimals, half up. The row price keeps up to six decimals. Nothing recalculates the header totals from the stored rows: totalExclVat is kept as you sent it.

The e-invoice takes its line total from the stored rows and its tax-exclusive total from the invoice’s totalExclVat. Peppol rule BR-CO-13 requires that tax-exclusive total to equal the sum of the line amounts, minus header allowances, plus header charges. If you compute the header from unrounded rows, for example rows with a discount that gives more than two decimals, the two can differ by a few cents. When totalExclVat differs from the sum of the rounded rows by 0.01 to 0.05, Quiddly adds a rounding row at 0% VAT for the difference, with the sign of the difference, and includes it in the 0% VAT breakdown, so the e-invoice still validates. A larger difference gets no rounding row and fails BR-CO-13. Rounding each row amount to two decimals in your system, and sending a totalExclVat that is the sum of the rounded rows, avoids the rounding row altogether.

If the client sends e-invoices over Peppol, check an invoice before it is sent with GET /electronic-invoices/invoices/<id>/validate (right ReadElectronicInvoice). It returns valid and a list of issues, each with the rule id. For a client that does not have Peppol BIS 3 enabled it always answers valid with no issues. For how e-invoices are delivered, see the knowledge base page How e-invoices are delivered.

On an invoice with reverseCharge set, the e-invoice marks every row as reverse charge, and that category requires a VAT rate of 0 on every row (rule BR-AE-05) and exactly one reverse-charge entry in the VAT breakdown (BR-AE-01). Each entry of the invoice’s vats becomes one entry there. Send vatPercentage 0 on every row, including text rows without a price, and no other percentage in vats. When Quiddly builds vats from the rows, all rows without vatPercentage share one entry without a percentage, separate from the entry for 0. A row whose vatPercentage and totalExclVat are both missing or 0 takes over the first non-zero percentage in vats, which breaks the rule on a reverse-charge invoice.

invoiceNumber is unique per client, and credit invoices share the same numbering as invoices. The uniqueness is enforced in the database, so it holds for every way of creating an invoice. Creating an invoice with a number that the client already uses fails with HTTP 409 and the message Entity with provided keys: <invoiceNumber>, <clientId> already exists.

Quiddly does not add a suffix. If your system reuses a number, for example when a collection claim is created through the API for an invoice that already exists, make the number unique yourself, for instance with a running suffix (-1, -2).

paymentReference is normally generated by Quiddly when the invoice is activated. If you send your own:

  • The client must be allowed to set it, through a client setting or the setting on the payment account. Otherwise activation is rejected with Payment reference was defined but payment account does not allow it. or Payment reference was defined but client setting does not allow it.
  • A tenant can be configured to ignore a reference sent on creation for clients that are not allowed to set one. The invoice then gets a system note saying which reference was ignored, and Quiddly generates one.
  • The reference must be unique per client, credit invoices included. A duplicate is rejected at activation with Invoice with payment reference <reference> already exists.

The payment terms text printed on the invoice document is exactly the value you send in terms.payment, under the heading Payment Terms (the heading is translated to the document language, the value is not). Quiddly does not add a unit such as “days”. Send the final text in the debtor’s language, or a bare number used consistently across your invoices. The dates.expireDate is what the e-invoice carries as payment terms.

debtor.identificationNumber is checked against the debtor’s locale:

LocaleWhat is checked
SENon-digits such as dashes are removed. The number must have 10 or 12 digits and a valid check digit (Luhn). An invalid number does not fail the request: the invoice is created with identificationNumber stored as null.
NO9 digits (organisation) or 11 digits (person). An invalid format rejects the request with <value> is invalid identification number.
FIThe Finnish organisation and person formats. An invalid format rejects the request with the same message.
any other value, including OTHERNot validated, the number is stored as sent.

Without a valid identification number the invoice cannot be financed (Debtor identification number must be present to use factoring.), and collection needs it as well.

debtor.locale is the legal country of the debtor, shown as Legal Country in the Operations and Client Portals. Send a two-letter country code or OTHER. If you omit it, the value on the debtor already matched by customerNumber is used. Quiddly uses it to validate the identification number, to decide which country the debtor belongs to for credit checks (with OTHER it falls back to the country of the invoice address), and to decide whether a letter to the debtor is an international distribution with its own charge. It is separate from invoiceAddress.countryCode, which is where the invoice is sent.

distributionCode selects the channel the invoice is sent on. Set it at creation or at activation (PUT /invoices/<id>/activate, or POST /invoices/actions/bulk-activate with invoiceIds).

ValueChannel
EMAILE-mail.
LETTERPrinted letter.
SMSSMS.
ELECTRONIC_INVOICEE-invoice.
DIGITAL_MAILBOXDigital mailbox.
PARTNERDistribution by an external partner.
APPLY_CLIENT_DISTRIBUTION_HIERARCHYNot a channel for an invoice. It is built for reminder profile levels, where it means “use the client’s distribution order”. Do not send it when you create or activate an invoice (see below).

Following the client’s distribution order. To let the client’s distribution profile decide, leave distributionCode out. At creation Quiddly then takes the first suitable channel that is enabled in the profile’s priority order: e-invoice or digital mailbox when the debtor has an identification number and an invoice address in the environment’s own country (e-invoice also for a foreign country that can be reached when the client has an issuer address for it), e-mail when the debtor has an e-mail address, and letter as the last resort. Do not send APPLY_CLIENT_DISTRIBUTION_HIERARCHY to get this. The creation call does not find it among the profile’s channels and takes the profile order anyway, but the activation call accepts it and stores it as the invoice’s channel. No invoice code treats it as a channel: the invoice’s own fallback chain is built from the position of the channel in the client’s profile, and this value has none, so the invoice gets no fallback channels.

How fallback works. The invoice gets a copy of the client’s distribution profile, starting at the channel you chose and continuing through the later channels of the profile that are enabled, in the profile’s priority order. Each channel is tried as many times as the profile says before the next channel is used. Reminders are never sent as e-invoice, only by the other channels.

disableFallbackDistribution: set it to true on an invoice (at creation, at activation, or in bulk activation) to stop the chain after the chosen channel. When that channel fails, no e-mail or letter is tried instead. Quiddly creates a Failed Distribution errand for the client and sends a DISTRIBUTION webhook with distributionStatus FAILED.

A channel can first report an invoice as delivered or opened and report it as failed later, for example when the recipient’s mail server bounces it afterwards. The later failure is handled like any other failure: the next attempt or channel in the chain, or, with disableFallbackDistribution, the errand and webhook above.

Financed invoices. An invoice activated with a financing product waits in PENDING_AUTHORIZATION for the financing decision. Its document is generated and it is distributed when the decision approves it, or denies financing but keeps it as a service invoice. To distribute earlier, call POST /invoices/distribute with { "invoiceIds": [...] } (right DistributeInvoices). It distributes invoices that are in PENDING_AUTHORIZATION, have a distributionCode and are not yet distributed, and lists the others under skipped_invoices with the reason. There is no setting that does this automatically.

GET /invoices/<id>/transfer-text (right ReadInvoice) returns the payment text printed on the invoice, with the payment reference filled in, as { "transferText": "..." }. It is read-only and meant for external distribution partners, and it changes nothing about how or when the invoice is submitted or distributed. It answers 400 with Invoice missing associated transfer text. when no text applies.

Quiddly takes the text from the client’s transfer texts. The match is on the client, the invoice type (an invoice without a type counts as a standard invoice), the product (all service products share one text), the language and the service provider of the invoice, or, when the invoice has none, the default service provider for that product that is available to the client. The language follows the country of the debtor’s invoice address: Swedish for SE, Norwegian for NO and English for any other country. When there is no such text in that language, Quiddly tries the client’s general text and the service provider’s text in that language, and then the same three in English.

At creation Quiddly decides the invoice’s distributionCode in this order:

  1. If Enable Invoice Distribution is off in the client’s distribution settings, the invoice has no distribution code and nothing is distributed.
  2. If the debtor, matched by customerNumber, has a distribution channel override, the debtor’s channel is used and the distributionCode you sent is ignored. In the Client Portal the debtor’s Invoice Distribution Method sets this. Do Not Distribute there is an override with no channel, so the invoice gets none. Preselected from ERP is no override.
  3. If you send distributionCode as null, the invoice gets none.
  4. Otherwise the code you sent is used if that channel is enabled in the client’s distribution profile. If it is not, or you sent none, the profile order above applies.

At activation, a distributionCode in the request replaces whatever creation chose, a debtor override included. Send null to activate without distribution, which is Do not distribute in the Operations Portal. Leave the field out to keep the code from creation.

To take over open invoices without sending them to the debtors again, create and activate them without distribution: send distributionCode as null at creation and at activation (or choose Do not distribute when you activate in the Operations Portal). No invoice distribution is created and the invoice gets no fallback channels. Reminders use the reminder profile and are not affected. Send the paymentReference that debtors already pay with, so that incoming payments match the invoice. The client must be allowed to set its own reference (see Invoice numbers and payment references), and the reference must be unique per client.

The response marshals the created invoice; the main status surfaces under statuses.main (and ledger progress under statuses.ledger).

statuses.mainWhen
CREATEDFreshly created, not yet activated.
PENDING_AUTHORIZATIONWaiting for the financing decision after activation with a financing product (a tenant can configure this away).
PENDINGActivation accepted, queued.
ACTIVATINGActivation running (documents, ledger, financial events).
ACTIVATEDBooked. bookedDate is set.
DENIED_FINANCINGFactoring decision denied.
PAUSED / DISPUTED / STOPPED / CLOSED / ARCHIVEDLater lifecycle states.
CREATED ──activate──> PENDING ──> ACTIVATING ──> ACTIVATED (booked)
│
request factoring + decision
├── approved ─> ACTIVATED (financed, product INVOICE_FACTORING_SELL)
└── denied ──> DENIED_FINANCING

An integration that creates invoices with POST /invoices/integration uploads PDFs for them with the routes below. Upload before you activate the invoice. Activation renders and distributes the invoice, so a PDF uploaded later can miss the distribution.

RoutePermissionWhat it stores
POST /documents/integration/invoiceinvoice:document:createYour own rendered invoice, sent instead of the PDF Quiddly renders. The client must be set up to use its own invoice PDF, otherwise the call answers 400 Upload own invoice document is not enabled on client.
POST /documents/integration/attachments/invoiceinvoice:attachment:createAn attachment that is added to the invoice PDF.

Both take multipart/form-data with file (a PDF, at most 10 MB), clientId and invoiceId, and return the stored document. clientId is required. The invoice must be on that client and created by your integration, otherwise the call answers 400 Invoice could not be found on client. Each route accepts one upload per invoice. Fetch a new token after a permission is assigned to your application.

Terminal window
curl -X POST "https://$HOST/documents/integration/invoice" \
-H "Authorization: Bearer $M2M_TOKEN" \
-F "file=@invoice.pdf" -F "clientId=C.100100" -F "invoiceId=$INVOICE_ID"
  1. Create the invoice.

    Terminal window
    curl -X POST "https://$HOST/invoices" \
    -H "Authorization: Bearer $JWT" -H "Content-Type: application/json" \
    -d '{
    "clientId": "C.100100",
    "invoiceNumber": "2026-0001",
    "debtor": {
    "customerNumber": "CUST-42",
    "name": "Acme AB",
    "type": "COMPANY",
    "identificationNumber": "5560000001"
    },
    "dates": { "invoiceDate": "2026-06-01", "expireDate": "2026-06-30" },
    "currency": { "invoiceCurrency": "SEK" },
    "articleRows": [
    { "description": "Consulting", "quantity": "1", "unit": "h", "price": "1250.00", "vatPercentage": 25 }
    ],
    "totals": { "totalExclVat": "1250.00", "totalVat": "312.50", "total": "1562.50" }
    }'

    Returns the created invoice with statuses.main = CREATED. Omit clientId if you authenticate with a client token. Add ?returnResource=false to get just { "id": "I...." } back.

  2. Activate it. Requires ActivateInvoices. Choose the product here - INVOICE_SERVICE for a plain service invoice, or INVOICE_FACTORING_SELL to send it for financing directly (see below). If you omit productCode the invoice’s default product is used.

    Terminal window
    curl -X PUT "https://$HOST/invoices/$INVOICE_ID/activate" \
    -H "Authorization: Bearer $JWT" -H "Content-Type: application/json" \
    -d '{ "productCode": "INVOICE_SERVICE" }'

    The call returns quickly with PENDING; activation finishes asynchronously (document generation, ledger and financial events) and the invoice lands on ACTIVATED with bookedDate set. Read the invoice with GET /invoices/<id> to see the result. The INVOICE webhook type does not report activation. Later changes to the balance are sent with the INVOICE_BALANCE webhook, which only subscriptions without a clientId receive. In an environment where invoices are checked by a service of your own before activation, the call works differently, see Validate invoices from your own system.

    The productCode you send decides the product. With INVOICE_SERVICE the invoice stays a service invoice; an integration that always sends INVOICE_SERVICE always ends up on service. With INVOICE_FACTORING_SELL the invoice is activated for financing directly: it goes to PENDING_AUTHORIZATION and waits for the financing decision, so step 3 is not needed.

  3. (Factoring only) Request factoring on the activated service invoice. Skip this step if you activated with INVOICE_FACTORING_SELL.

    Terminal window
    curl -X PUT "https://$HOST/factoring-decisions/$INVOICE_ID/factoring" \
    -H "Authorization: Bearer $JWT" -H "Content-Type: application/json" -d '{}'

    Requires UpdateCreditDecisionStatus. Guards: the invoice must be ACTIVATED and product INVOICE_SERVICE, and the debtor must not be blocked for factoring. See the factoring decision flow below.

The credit decision is tracked by a credit-decision status separate from the invoice main status. Values: PENDING, READY_FOR_DECISION, WAITING, REFINANCE, DECIDED (plus tenant-specific groupings/sub-statuses). The credit-decision status is not the invoice main status: you cannot set the main status through these calls, it changes as a result of the decision.

Quiddly distinguishes internal decisions (made inside Quiddly, by the engine rule or an operator) from external decisions (made by an external financing provider):

ActionEndpointRightUse
Request factoringPUT /factoring-decisions/<invoiceId>/factoringUpdateCreditDecisionStatusAsk to factor an activated service invoice.
Move internal decisionPUT /factoring-decisions/<id>/moveUpdateCreditDecisionStatusAdvance the internal credit-decision status (+ optional sub-status grouping).
Record external decisionPUT /factoring-decisions/<id>/move-externalUpdateExternalFactoringDecisionRecord an external provider’s decision: APPROVED, DENIED, or DENIED_SERVICE. See below.

PUT /factoring-decisions/<id>/move-external takes this body:

FieldRequiredNotes
statusyesA credit-decision status that is enabled in the tenant, for example PENDING, READY_FOR_DECISION, WAITING or DECIDED. REFINANCE cannot be sent here.
decisionwhen status is DECIDEDAPPROVED, DENIED or DENIED_SERVICE. Ignored for every other status. This is a decision value, not a status: sending a status such as WAITING as decision is rejected with 400.
useRecoursenoWhether the financing is with recourse.
overridenotrue to approve although the engine rule validation fails and the failed criteria allow an override.

Moving to any other status only moves the invoice on the credit-decision board and triggers the FACTORING_STATUS webhook. Moving to DECIDED with a decision performs the decision described below.

The board shows the last status that was set. Quiddly does not check the order of the statuses you push. It refuses a move while the invoice is being booked, and sending the status the invoice already has changes nothing. When calls arrive out of order, the invoice stays on whichever one was processed last, and the board shows that status. Push the statuses one at a time, in the order the decision follows, and wait for each answer. Common 400 answers:

MessageCause
External factoring decision cannot use status: REFINANCE.status was REFINANCE.
For status DECIDED decision must be provided.status was DECIDED without decision.
Invoice <id> is already financedThe invoice has already been financed.
Invoice (<id>) status should be PENDING_AUTHORIZATION.A financing decision on an invoice that is not waiting for one.
Status <status> does not exist. / Status <status> is disabled.The status is unknown or switched off in the tenant.
Invoice failed engine rule validation.APPROVED failed the engine rules; the response lists the failed criteria.

The response is the updated invoice, except after a decision, see Response after a financing decision.

The decision resolves to one of FinanceDecision = APPROVED, DENIED, DENIED_SERVICE, REFINANCE:

  • Approved: the product switches to INVOICE_FACTORING_SELL, financed financial events are generated, the invoice is re-booked as financed, and the credit-decision status becomes DECIDED. The invoice stays ACTIVATED.
  • Denied: main status becomes DENIED_FINANCING. Do not send DENIED for an invoice whose product is INVOICE_SERVICE. The call does not complete. Use DENIED_SERVICE for it.
  • Denied as service (DENIED_SERVICE): financing is denied but the invoice continues as a service invoice (product INVOICE_SERVICE), is activated and is distributed.

Track the decision with GET /factoring-decisions/invoice/<id> and the FACTORING_STATUS webhook.

Whether a financing decision call answers with the full invoice or an empty body is controlled by the system setting RETURN_INVOICE_FINANCING_REQUEST_DATA. It is a system-wide setting, not a field in the request, so contact Quiddly support if you need it changed. Off, the default, the call returns 200 with the full invoice. On, it returns 200 with an empty body. Nothing else changes: the decision, saving, webhooks and the jobs that follow activation behave the same either way, so do not read the empty body as a failure.