DocumentUpsert

One invoice or credit note with all its lines. A newer source_updated_at replaces the document and every line: a line left out of the newer version is removed.

A credit note is a document of its own, with its own document_id. It never voids or replaces the invoice it credits: the invoice stays as it was, and the credit note reduces the return in its own period.

Amounts are signed as printed. Lines may carry either sign, so a discount line on an invoice is negative. The totals decide: the sum of line net, and the sum of line vat, must not be negative on an invoice or positive on a credit note. Otherwise the document is refused with total_sign_invalid.

  • Your id for the client legal entity. Unique within your partner account.

  • Where the customer or supplier is established. Drives the VAT number checks and the counterparty columns on listings.

  • The other party to the document. The customer on a sale, the supplier on a purchase.

  • ISO 4217.

  • Your permanent id for the document. Never reused. A credit note has its own.

  • On a credit note, the credit note's own date.

  • As printed. On a credit note, the credit note's own number.

  • Properties: 9
  • When the document last changed in your ERP. Orders versions of the document.

  • The country of the client's VAT registration the document falls under: the registration whose VAT number the client issued or received the invoice under. For OSS and IOSS sales it is the registration country, not the consumer's: VAT IT takes the consumer's country from the ship countries or counterparty_country. An ISO 3166-1 alpha-2 country, or an ISO 3166-2 subdivision where VAT IT files below country level (CA-QC).

  • The customer's or supplier's VAT number with its country prefix, as printed. Required when a line's tax code needs it: B2B cross-border and reverse charge in every EU country.

  • The e-invoice clearance id, for example the KSeF number (PL) or SDI id (IT).

  • full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21

  • On a credit note, the invoice it credits, whenever it credits one invoice. Links the two.

  • Where the goods left from. Required for goods that cross a border.

  • Where the goods arrived. Required for goods that cross a border. The consumer's country for OSS goods.

  • The date of supply or payment, when it differs from the invoice date. PL and CZ use it to set the period.