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
| Field | Type | Description | Validations |
|---|---|---|---|
erp_customer_id | String | Customer ID in ERP | Cannot be empty. Must exist in Customers — see the warning below |
erp_invoice_id | String | Invoice ID in ERP | Cannot be empty |
currency | String | Currency code | e.g., COP, USD, EUR. Cannot be empty and must be 3 letters: a longer one passes validation but makes processing fail |
original_amount | Float | Original invoice amount | Decimal number, greater than or equal to 0 |
pending_amount | Float | Pending/outstanding amount | Decimal number |
status | String | Invoice status | OPEN or CLOSED. Write it in uppercase: in lowercase the response confirms the upload, but processing of the whole file fails afterwards |
issue_date | Date | Invoice issue date | If 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_date | Date | Payment due date | If 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
| Field | Type | Description | Validations | Default |
|---|---|---|---|---|
advance_amount | Float | Advance payment applied | Decimal number. If omitted or left empty it is stored as 0.00 | 0.00 |
allow_collection | Boolean | Allow collection | Only 1 or 0. The default applies only if you omit the column; an empty cell stores 0, both on create and on update | 1 |
invoice_type | Enum | Invoice commercial term | CREDIT or CASH. Case and surrounding whitespace are ignored. Any other nonblank value rejects the upload | CREDIT on create; blank or omitted preserves the existing value on update |
invoice_url | String | URL to invoice document | - | null |
pre_tax_amount | Float | Invoice subtotal before taxes | Dot 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 taxes | null |
cost_center_1_erp_id | String | Cost center 1 ID | Must provide matching _pct | null |
cost_center_1_pct | Float | Cost center 1 percentage | Number between 0 and 100. Only values greater than 0 are recorded | null |
cost_center_2_erp_id | String | Cost center 2 ID | Must provide matching _pct | null |
cost_center_2_pct | Float | Cost center 2 percentage | Number between 0 and 100. Only values greater than 0 are recorded | null |
cost_center_3_erp_id | String | Cost center 3 ID | Must provide matching _pct | null |
cost_center_3_pct | Float | Cost center 3 percentage | Number between 0 and 100. Only values greater than 0 are recorded | null |
cost_center_4_erp_id | String | Cost center 4 ID | Must provide matching _pct | null |
cost_center_4_pct | Float | Cost center 4 percentage | Number between 0 and 100. Only values greater than 0 are recorded | null |
cost_center_5_erp_id | String | Cost center 5 ID | Must provide matching _pct | null |
cost_center_5_pct | Float | Cost center 5 percentage | Number between 0 and 100. Only values greater than 0 are recorded | null |
Cost center allocations
Up to 5 cost center pairs are accepted. For each pair i:
- If you send either
cost_center_i_erp_idorcost_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_idis 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
CREDITmeans a sale with deferred payment terms; it does not mean a credit note or payment method.- A
CASHinvoice may remainOPEN, 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
CREDITinvoices 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 equalsoriginal_amount, within $1, and the invoice detail warns when it does not add up. - The
base_amountof each tax row is the base of that tax; it does not replacepre_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_idappears in several rows, the last one is kept. - Rows whose
erp_customer_iddoes 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,,