Invoices

Manage accounts receivable invoices.


Accounts receivable invoices issued to customers.

Dependency: Requires Customers to be uploaded first.

Endpoint

POST /full-csv-integration/upload-invoices

  • Form Field: invoicesFile

Required Fields

FieldTypeDescriptionValidations
erp_customer_idStringCustomer ID in ERPCannot be empty. Must exist in Customers — see the warning below
erp_invoice_idStringInvoice ID in ERPCannot be empty
currencyStringCurrency codee.g., COP, USD, EUR. Cannot be empty and must be 3 letters: a longer one passes validation but makes processing fail
original_amountFloatOriginal invoice amountDecimal number, greater than or equal to 0
pending_amountFloatPending/outstanding amountDecimal number
statusStringInvoice statusOPEN or CLOSED. Write it in uppercase: in lowercase the response confirms the upload, but processing of the whole file fails afterwards
issue_dateDateInvoice issue dateIf it carries a value it must be YYYY-MM-DD; other formats are rejected. An empty cell is accepted and the date is left empty
due_dateDatePayment due dateIf it carries a value it must be YYYY-MM-DD; other formats are rejected. An empty cell is accepted and the date is left empty

Optional Fields

FieldTypeDescriptionValidationsDefault
advance_amountFloatAdvance payment appliedDecimal number. If omitted or left empty it is stored as 0.000.00
allow_collectionBooleanAllow collectionOnly 1 or 0. The default applies only if you omit the column; an empty cell stores 0, both on create and on update1
invoice_typeEnumInvoice commercial termCREDIT or CASH. Case and surrounding whitespace are ignored. Any other nonblank value rejects the uploadCREDIT on create; blank or omitted preserves the existing value on update
invoice_urlStringURL to invoice document-null
pre_tax_amountFloatInvoice subtotal before taxesDot as decimal separator, no thousands separators or exponents. Must fit numeric(18,2); rounded to two decimals. An invalid value drops that invoice from the upload, with a warning: if it already existed it keeps its previous data (installments and payments in the same upload still apply); if it is new, it is not created. Empty or omitted stores null on update too: it erases the value the invoice already had. See Amount before taxesnull
cost_center_1_erp_idStringCost center 1 IDMust provide matching _pctnull
cost_center_1_pctFloatCost center 1 percentageNumber between 0 and 100. Only values greater than 0 are recordednull
cost_center_2_erp_idStringCost center 2 IDMust provide matching _pctnull
cost_center_2_pctFloatCost center 2 percentageNumber between 0 and 100. Only values greater than 0 are recordednull
cost_center_3_erp_idStringCost center 3 IDMust provide matching _pctnull
cost_center_3_pctFloatCost center 3 percentageNumber between 0 and 100. Only values greater than 0 are recordednull
cost_center_4_erp_idStringCost center 4 IDMust provide matching _pctnull
cost_center_4_pctFloatCost center 4 percentageNumber between 0 and 100. Only values greater than 0 are recordednull
cost_center_5_erp_idStringCost center 5 IDMust provide matching _pctnull
cost_center_5_pctFloatCost center 5 percentageNumber between 0 and 100. Only values greater than 0 are recordednull

Cost center allocations

Up to 5 cost center pairs are accepted. For each pair i:

  • If you send either cost_center_i_erp_id or cost_center_i_pct, you must send both columns, otherwise the upload fails.
  • Each percentage must be between 0 and 100; outside that range the upload is rejected. The sum per invoice is not validated: it does not need to add up to 100.
  • Only rows with a percentage greater than 0 produce an allocation.
  • cost_center_i_erp_id is stored as given — it is not verified against Cost Centers.
  • Allocations are replaced per invoice, but only if the invoice carries at least one pair with a percentage greater than 0. An invoice that carries no cost centers keeps the allocation it already had: send all of an invoice’s cost centers together.

Invoice type and metrics

  • CREDIT means a sale with deferred payment terms; it does not mean a credit note or payment method.
  • A CASH invoice may remain OPEN, retain an outstanding balance, and stay in collection workflows. In that case the response carries a warning (CASH_WITH_PENDING_BALANCE), but the row is accepted.
  • Financial metrics —sales, balances, aging, DSO, turnover, collection effectiveness, behavior, projections, and derived executive metrics— use CREDIT invoices only.
  • Operational collections, statements, and campaign attribution continue to include both types.
  • Changing an existing invoice’s type also reclassifies its financial history.

Amount before taxes

pre_tax_amount is the amount of the whole invoice before taxes: the subtotal the ERP shows, including items exempt from VAT (it is not the VAT taxable base).

  • Fibek uses it when the early payment discount, or a discount agreed with the customer, is computed “On the amount before VAT”. If the invoice does not carry it, Fibek does not propose that discount.
  • If the invoice already has partial payments or credit notes, the discount is computed on the share that matches the balance: pre_tax_amount × pending_amount / original_amount.
  • You do not need to send Invoice taxes to use it. If Fibek has the invoice’s taxes (from this upload or an earlier one), it checks that pre_tax_amount + taxes − withholdings already deducted equals original_amount, within $1, and the invoice detail warns when it does not add up.
  • The base_amount of each tax row is the base of that tax; it does not replace pre_tax_amount.
  • Send the column in every upload: an upload without the column, or with an empty cell, erases the stored value.

Repeated rows and dropped rows

  • If the same erp_invoice_id appears in several rows, the last one is kept.
  • Rows whose erp_customer_id does not exist in Customers are dropped while the file is processed, and this is not reflected in the response, which had already confirmed the upload. If no customer in the file exists, nothing is processed.

Example CSV

erp_customer_id,erp_invoice_id,currency,original_amount,pending_amount,status,issue_date,due_date,advance_amount,allow_collection,invoice_type,pre_tax_amount,cost_center_1_erp_id,cost_center_1_pct,cost_center_2_erp_id,cost_center_2_pct
CUST001,INV001,COP,1000000.00,500000.00,OPEN,2024-01-15,2024-02-15,0.00,1,CREDIT,840336.13,CC001,60.0,CC002,40.0
CUST002,INV002,COP,500000.00,0.00,CLOSED,2024-01-20,2024-02-20,0.00,1,CASH,420168.07,CC001,100.0,,