### Status Embed Installation Source: https://onfact.stoplight.io/docs/onfact/71eb78a3be446-send-with-email This section describes how to correctly install the status embed for displaying incidents or maintenance updates from your status page. This is a client-side integration, typically involving embedding a script or HTML element. -------------------------------- ### API Response Example for Attachment Creation Source: https://onfact.stoplight.io/docs/onfact/d282708dc7223-create-attachment An example of a successful response when creating an attachment via the onFact API. It includes the ID of the newly created resource and a success code. ```json { "id": 0, "code": "string" } ``` -------------------------------- ### onFact REST API - Use Cases Source: https://onfact.stoplight.io/docs/onfact/ca4dc9f0399f4-on-fact-rest-api Examples of common use cases for the onFact REST API. ```APIDOC ## Use Cases - [Send PEPPOL Invoice](link-to-peppol-invoice-usecase) - [Excel import](link-to-excel-import-usecase) ``` -------------------------------- ### Filter Invoices using Query Parameters Source: https://onfact.stoplight.io/docs/onfact/r13wjvr6fcpo0-searching-and-filtering Demonstrates how to filter invoices by modification date and customer name using logical operators in a GET request. The query uses the 'q' parameter to combine conditions with the AND operator. ```http GET /v1/invoices.json?q=modified > "2022-01-01" AND customer_name:"*google*" ``` -------------------------------- ### List Invoices (GET) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Retrieves a list of invoices, with options for filtering and pagination. Requires authentication. Returns an array of invoice objects. ```javascript get("/invoices?page=1&limit=20&status=open") ``` -------------------------------- ### GET List Endpoints Paging Source: https://onfact.stoplight.io/docs/onfact/q8p7z3flbv2vy-paging Standard pagination parameters and response structure for list-based API endpoints. ```APIDOC ## GET /resource ### Description Retrieves a paginated list of resources. The response includes a count of total items and metadata for navigating through pages. ### Method GET ### Endpoint /resource ### Parameters #### Query Parameters - **limit** (integer) - Optional - Number of results per page. Max: 100, Default: 10. - **offset** (integer) - Optional - The number of items to skip before starting to collect the result set. ### Request Example GET /invoices?limit=20&offset=0 ### Response #### Success Response (200) - **count** (integer) - Total number of results available. - **paging** (object) - Metadata object containing amount of pages, results per page, and current page index. #### Response Example { "count": 150, "paging": { "total_pages": 8, "results_per_page": 20, "current_page": 1 }, "data": [] } ``` -------------------------------- ### GET /v1/invoices/{id}.pdf Source: https://onfact.stoplight.io/docs/onfact/4f6us2s04tyj8-url-extensions Retrieve the raw PDF representation of an invoice or credit note. ```APIDOC ## GET /v1/invoices/{id}.pdf ### Description Retrieves the raw PDF file for a specific invoice or credit note. ### Method GET ### Endpoint /v1/invoices/{id}.pdf ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the invoice or credit note. ### Response #### Success Response (200) - **Content-Type** (application/pdf) - The raw PDF document binary data. ``` -------------------------------- ### Get Next Invoice Number (GET) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Retrieves the next available invoice number in the sequence. Useful for ensuring unique invoice numbering. Returns the next number as a string. ```javascript get("/invoices/next-number") ``` -------------------------------- ### GET /v1/invoices.json Source: https://onfact.stoplight.io/docs/onfact/r13wjvr6fcpo0-searching-and-filtering Retrieves a list of invoices filtered by a logical expression provided in the 'q' query parameter. ```APIDOC ## GET /v1/invoices.json ### Description Filters invoice results based on entity attributes using a logical expression. ### Method GET ### Endpoint /v1/invoices.json ### Parameters #### Query Parameters - **q** (string) - Optional - A logical expression to filter results (e.g., modified > "2022-01-01" AND customer_name:"*google*") ### Supported Operators - **:** (Equality/LIKE with *) - **!:** (Not equal) - **>** (Greater than) - **>=** (Greater than or equal) - **<** (Less than) - **<=** (Less than or equal) - **IS NULL** (Empty/null check) - **IS NOT NULL** (Non-empty check) - **AND / OR** (Logical operators) ### Request Example GET /v1/invoices.json?q=modified > "2022-01-01" AND customer_name:"*google*" ### Response #### Success Response (200) - **data** (array) - List of filtered invoice objects. ``` -------------------------------- ### InboundDocument JSON Structure Example Source: https://onfact.stoplight.io/docs/onfact/f9a3746368ce0-inbound-document This JSON object represents an InboundDocument, showcasing its various fields including document metadata, AI extraction status, and details about associated PDF and original attachments. It also includes an empty purchase object. ```json { "id": 521, "inbound_email_id": null, "payment_id": null, "attachment_type": "xml", "original_attachment_id": 1521, "pdf_attachment_id": 1523, "supplier_id": null, "purchase_id": null, "manual_extracted_information": null, "ai_status": "completed", "ai_extracted_information": "completed", "ai_completed": "2025-06-19 08:21:26", "pages": null, "external_id": null, "archived": false, "api": false, "created": "2025-06-19 08:20:18", "modified": "2025-06-19 08:21:26", "pingwin5_document_id": null, "attachments": [], "supplier": null, "pdf_attachment": { "id": 1523, "company_id": 7, "model": "Ocr", "model_id": 521, "language_id": null, "name": "25001 (1)", "filename": "7_b4ca1b3b-2405-4be6-861a-3b1e5572075d.pdf", "extension": "pdf", "thumbnail": null, "size": 121992, "email": false, "attach_to_proposal": "no", "attach_to_orderslip": "no", "attach_to_deliveryslip": "no", "attach_to_paymentrequest": "no", "attach_to_posticket": "no", "attach_to_invoice": "no", "attach_to_creditnote": "no", "attach_to_purchaseslip": "no", "attach_to_purchaseorder": "no", "attach_to_workorder": "no", "ready": true, "compressed": false, "created": 1750321284, "url": "http://localhost/v1/attachments/1523.pdf", "full_name": "25001 (1).pdf" }, "original_attachment": { "id": 1521, "company_id": 7, "model": "InboundDocument", "model_id": null, "language_id": null, "name": "25001 (1)", "filename": "7_39ddfb96-105a-49fe-b2be-e23cdf81a85a.xml", "extension": "xml", "thumbnail": null, "size": 181484, "email": false, "attach_to_proposal": "no", "attach_to_orderslip": "no", "attach_to_deliveryslip": "no", "attach_to_paymentrequest": "no", "attach_to_posticket": "no", "attach_to_invoice": "no", "attach_to_creditnote": "no", "attach_to_purchaseslip": "no", "attach_to_purchaseorder": "no", "attach_to_workorder": "no", "ready": true, "compressed": false, "created": 0, "url": "http://localhost/v1/attachments/1521.xml", "full_name": "25001 (1).xml" }, "purchase": {} } ``` -------------------------------- ### GET /v1/invoices/{id}.xml Source: https://onfact.stoplight.io/docs/onfact/4f6us2s04tyj8-url-extensions Retrieve the structured electronic invoice (UBL) for a specific document. ```APIDOC ## GET /v1/invoices/{id}.xml ### Description Retrieves the structured electronic invoice in UBL format for supported document types. ### Method GET ### Endpoint /v1/invoices/{id}.xml ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the invoice or credit note. ### Response #### Success Response (200) - **Content-Type** (application/xml) - The UBL-compliant XML representation of the document. ``` -------------------------------- ### GET /invoices/{id} Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Retrieve the details of a specific invoice by its unique identifier. ```APIDOC ## GET /invoices/{id} ### Description Retrieves the full details of an invoice resource based on the provided ID. ### Method GET ### Endpoint https://api5.onfact.be/v1/invoices/{id}.json ### Parameters #### Path Parameters - **id** (integer) - Required - The unique resource ID of the invoice. ### Request Example GET https://api5.onfact.be/v1/invoices/123.json ### Response #### Success Response (200) - **status** (string) - Indicates the success of the request. #### Response Example { "status": "ok", "data": { "id": 123, "invoice_number": "INV-2023-001" } } ``` -------------------------------- ### GET /invoices/{uuid} Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Retrieve detailed information about a specific invoice using its unique identifier. ```APIDOC ## GET /invoices/{uuid} ### Description Retrieves the full details of an invoice, including line items, internal notes, and accounting integration status. ### Method GET ### Endpoint /invoices/{uuid} ### Parameters #### Path Parameters - **uuid** (string) - Required - The unique identifier for the invoice. ### Response #### Success Response (200) - **uuid** (string) - Unique code for the invoice. - **invoice_lines** (array) - List of items on the invoice. - **online_payment_link** (string) - URL for online payment. - **locked** (boolean) - Indicates if the document is locked due to accounting sync. #### Response Example { "uuid": "inv-12345", "online_payment_link": "https://pay.example.com/inv-12345", "locked": true } ``` -------------------------------- ### Invoice Retrieval (GET) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Retrieves a specific invoice by its ID. Requires authentication. Returns the invoice details if found, otherwise an error. ```javascript get("/invoices/123") ``` -------------------------------- ### Using Smart Functions via X-ACTIONS Source: https://onfact.stoplight.io/docs/onfact/ql7gh252p040l-smart-functions Learn how to use the X-ACTIONS header to perform automated tasks like finding or creating customers and products during an invoice creation request. ```APIDOC ## POST /invoices ### Description Creates an invoice while applying automated smart functions to handle related entities like customers and products in a single request. ### Method POST ### Endpoint /invoices ### Parameters #### Headers - **X-ACTIONS** (string) - Optional - A comma-separated list of smart functions to execute (e.g., "FIND-OR-CREATE-CUSTOMER,FIND-PRODUCTS") #### Request Body - **customer_name** (string) - Required - Name of the customer - **lines** (array) - Required - List of invoice items ### Request Example { "customer_name": "John Doe", "lines": [{"product_name": "Widget A", "price": 10.00}] } ### Response #### Success Response (201) - **id** (integer) - The ID of the created invoice #### Response Example { "id": 12345, "status": "created" } ### Available Actions - **CREATE-CUSTOMER**: Creates a new customer from provided invoice data. - **FIND-OR-CREATE-CUSTOMER**: Searches for an existing customer by EID, email, VAT, or name; creates if not found. - **UPDATE-CUSTOMER**: Updates existing customer profile data. - **FIND-PRODUCTS**: Connects product lines to existing catalog items. - **USE-FIRST-DESCRIPTION**: Loads the default invoice footer text from account settings. - **USE-FIRST-TOPTEXT-DESCRIPTION**: Loads the default invoice header text from account settings. ``` -------------------------------- ### Create Event (POST) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Creates a new event in the system. Requires event details. Returns the created event object. ```javascript post("/events", { "type": "invoice_sent", "related_id": 123, "timestamp": "2023-01-15T10:00:00Z" }) ``` -------------------------------- ### Invoice Creation (POST) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Creates a new invoice in the onFact system. Requires authentication and provides invoice details as input. Outputs the created invoice object. ```javascript post("/invoices", { "invoice_number": "INV-001", "issue_date": "2023-01-01", "due_date": "2023-01-31", "customer_id": 123, "lines": [ { "description": "Product A", "quantity": 2, "unit_price": 50 } ] }) ``` -------------------------------- ### POST /invoices Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Create a new invoice document with line items and configuration settings. ```APIDOC ## POST /invoices ### Description Creates a new invoice. Includes support for HTML-formatted text fields and detailed line item definitions. ### Method POST ### Endpoint /invoices ### Parameters #### Request Body - **invoice_lines** (array) - Required - List of invoice items. - **text** (string) - Optional - HTML-formatted text below the lines table. - **toptext** (string) - Optional - HTML-formatted text above the lines table. ### Request Example { "invoice_lines": [ { "name": "Service Fee", "quantity": 1, "price": 100.00 } ], "text": "

Thank you for your business.

" } ### Response #### Success Response (201) - **uuid** (string) - The unique identifier of the created invoice. ``` -------------------------------- ### POST /documents Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Create a new document in the Onfact system. This endpoint accepts various fields related to customer information, VAT handling, and document metadata. ```APIDOC ## POST /documents ### Description Creates a new document record. Note that customer data must be provided explicitly as it is not automatically copied from contact records. ### Method POST ### Endpoint /documents ### Parameters #### Request Body - **customer_name** (string) - Required - The name of the customer for this document. - **journal_id** (integer) - Optional - The id of the journal. Default: null. - **date** (string) - Optional - Document date in yyyy-mm-dd format. Default: today. - **template_id** (integer) - Optional - The id of the template used for PDF generation. - **vattype** (string) - Optional - Pricing method: 'excl' or 'incl'. - **discount** (number) - Optional - Discount amount or percentage. - **discount_type** (string) - Optional - 'amount' or 'percent'. ### Request Example { "customer_name": "Example Corp", "date": "2023-10-27", "vattype": "excl" } ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the created document. #### Response Example { "id": 12345 } ``` -------------------------------- ### onFact REST API - General Documentation Links Source: https://onfact.stoplight.io/docs/onfact/ca4dc9f0399f4-on-fact-rest-api Links to general documentation sections for the onFact REST API. ```APIDOC ## General Documentation - [Authentication](link-to-authentication) - [Paging](link-to-paging) - [Searching and filtering](link-to-searching-filtering) - [Smart functions](link-to-smart-functions) - [URL Extensions](link-to-url-extensions) - [API-Limits](link-to-api-limits) ``` -------------------------------- ### Add Bulk Invoices (POST) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Adds multiple invoices in a single request. Requires an array of invoice objects. Returns a summary of the import process. ```javascript post("/invoices/bulk", [ { "invoice_number": "INV-002", "issue_date": "2023-01-02", "customer_id": 124, "lines": [ { "description": "Product B", "quantity": 1, "unit_price": 100 } ] }, { "invoice_number": "INV-003", "issue_date": "2023-01-03", "customer_id": 125, "lines": [ { "description": "Product C", "quantity": 3, "unit_price": 25 } ] } ]) ``` -------------------------------- ### Create Invoice Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Creates a new invoice with the provided details. ```APIDOC ## POST /invoices ### Description Creates a new invoice with the provided details. ### Method POST ### Endpoint /invoices ### Parameters #### Request Body - **customer_id** (integer) - Required - The ID of the customer for this invoice. - **issue_date** (string) - Required - The date the invoice is issued (YYYY-MM-DD). - **due_date** (string) - Optional - The due date for the invoice (YYYY-MM-DD). - **lines** (array) - Required - An array of invoice line items. - **product_id** (integer) - Required - The ID of the product. - **quantity** (number) - Required - The quantity of the product. - **description** (string) - Optional - A description for the line item. - **notes** (string) - Optional - Additional notes for the invoice. ### Request Example { "customer_id": 101, "issue_date": "2023-10-26", "due_date": "2023-11-25", "lines": [ { "product_id": 5, "quantity": 2, "description": "Example Product" } ], "notes": "Thank you for your business." } ### Response #### Success Response (201) - **id** (integer) - The unique identifier for the newly created invoice. - **invoice_number** (string) - The generated invoice number. - **status** (string) - The initial status of the invoice (e.g., 'draft'). #### Response Example { "id": 1, "invoice_number": "INV-001", "status": "draft" } ``` -------------------------------- ### GET /inbound-documents/{id} Source: https://onfact.stoplight.io/docs/onfact/f9a3746368ce0-inbound-document Retrieves the details of a specific inbound document, including its AI extraction status and associated file attachments. ```APIDOC ## GET /inbound-documents/{id} ### Description Retrieves a single InboundDocument object by its unique identifier. This includes metadata about AI extraction, file attachments (PDF and original), and processing status. ### Method GET ### Endpoint /inbound-documents/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the inbound document. ### Response #### Success Response (200) - **id** (integer) - Unique document ID - **ai_status** (string) - Status of the AI extraction process - **ai_completed** (string) - Timestamp of when AI processing finished - **pdf_attachment** (object) - Details of the generated PDF file - **original_attachment** (object) - Details of the original source file - **archived** (boolean) - Whether the document is archived #### Response Example { "id": 521, "ai_status": "completed", "ai_completed": "2025-06-19 08:21:26", "archived": false, "pdf_attachment": { "id": 1523, "filename": "7_b4ca1b3b-2405-4be6-861a-3b1e5572075d.pdf", "url": "http://localhost/v1/attachments/1523.pdf" }, "original_attachment": { "id": 1521, "filename": "7_39ddfb96-105a-49fe-b2be-e23cdf81a85a.xml", "url": "http://localhost/v1/attachments/1521.xml" } } ``` -------------------------------- ### POST /invoices.json Source: https://onfact.stoplight.io/docs/onfact/zoulkihh83xpc-use-case-send-peppol-invoice Creates a new invoice in the onFact system to be processed for PEPPOL transmission. ```APIDOC ## POST /invoices.json ### Description Creates a new invoice record in onFact. This is the first step in the PEPPOL invoice workflow. ### Method POST ### Endpoint https://api5.onfact.be/v1/invoices.json ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication - **Content-Type** (string) - Required - application/json - **X-ACTIONS** (string) - Optional - Additional action headers #### Request Body - **customer_name** (string) - Required - Name of the customer - **customer_street** (string) - Required - Street address - **customer_streetnumber** (string) - Required - Street number - **customer_city** (string) - Required - City name - **customer_citycode** (string) - Required - Postal code - **country_id** (string) - Required - ISO country code (e.g., BEL) - **customer_vat** (string) - Required - Customer VAT number - **invoice_lines** (array) - Required - List of products/services ### Request Example { "customer_name": "onFact", "customer_street": "Stationsstraat", "customer_streetnumber": "98", "customer_city": "Asse", "customer_citycode": "1730", "country_id": "BEL", "customer_vat": "BE0714992641", "invoice_lines": [ { "quantity": 1, "name": "First Product Line", "price": 10, "vat": 21 }, { "quantity": 1, "name": "Second Product Line", "price": 10, "vat": 21 } ] } ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the created invoice. ``` -------------------------------- ### GET /v1/invoices/{id}.json Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Retrieves a specific invoice by its ID. Includes detailed information about the invoice, its lines, and associated financial calculations. ```APIDOC ## GET /v1/invoices/{id}.json ### Description Retrieves a specific invoice by its ID. This endpoint provides comprehensive details about an invoice, including its lines, customer information, and various calculated financial amounts. ### Method GET ### Endpoint /v1/invoices/{id}.json ### Parameters #### Path Parameters - **id** (string) - Required - External ID of the invoice. #### Query Parameters None #### Request Body None ### Request Example ```shell curl --request GET \ --url https://api5.onfact.be/v1/invoices/{id}.json \ --header 'Accept: application/json' \ --header 'X-SESSION-KEY: 123' ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier of the invoice. - **journal_id** (integer) - The ID of the journal associated with the invoice. - **currency_id** (string) - The currency of the company. - **number** (string) - The invoice number. - **number_formatted** (string) - The formatted invoice number. - **date** (string) - The date the invoice was issued (yyyy-mm-dd). - **delivery_date** (string) - The delivery date of the invoice (yyyy-mm-dd). - **order_reference** (string) - Reference to an order. - **status** (string) - The status of the invoice. - **template_id** (string) - The ID of the template used for the invoice. - **customer_id** (integer) - The ID of the customer. - **customer_name** (string) - The name of the customer. - **customer_attn** (string) - Attention line for the customer. - **customer_street** (string) - The street address of the customer. - **customer_streetnumber** (string) - The street number of the customer's address. - **customer_citycode** (string) - The postal code of the customer's city. - **customer_city** (string) - The city of the customer's address. - **customer_vat** (string) - The VAT number of the customer. - **customer_email** (string) - The email address of the customer. - **country_id** (string) - The ID of the country. - **language_id** (string) - The ID of the language. - **vattype** (string) - The VAT type (e.g., 'excl'). - **vat_exception** (string) - VAT exception code. - **discount** (number) - The discount amount. - **discount_type** (string) - The type of discount ('amount' or 'percentage'). - **exchange_rate** (string) - The exchange rate if currencies differ, or the rate for the document date. - **term** (string) - Payment terms. - **term_end_of_month** (boolean) - Whether payment terms are end of month. - **expiration_date** (string) - The expiration date of the invoice (yyyy-mm-dd). - **section_behavior** (string) - Behavior for sections (e.g., 'sum'). - **settlement_discount** (number) - Settlement discount amount. - **settlement_term** (integer) - Settlement term in days. - **automatic_reminders** (boolean) - Whether automatic reminders are enabled. - **text** (string) - Additional text for the invoice. - **toptext** (string) - Text displayed at the top of the invoice. - **nota** (string) - Note for the invoice. - **online_payment_link** (string) - Link for online payment. - **uuid** (string) - Unique universal identifier. - **ogm** (string) - OGM identifier. - **returned_empty_goods_value** (number) - Value of returned empty goods. - **codabox_uploaded** (boolean) - Whether the invoice has been uploaded to Codabox. - **twikey_transaction_id** (string) - Twikey transaction ID. - **exact_online_document_number** (string) - Exact Online document number. - **yuki_document_id** (string) - Yuki document ID. - **basecone_document_id** (string) - Basecone document ID. - **clearfacts_document_id** (string) - Clearfacts document ID. - **octopus_document_id** (string) - Octopus document ID. - **created** (string) - Creation date (yyyy-mm-dd). - **modified** (string) - Last modification date (yyyy-mm-dd). - **deleted** (boolean) - Whether the invoice is deleted. - **locked** (boolean) - Whether the invoice is locked. - **invoice_lines** (array) - An array of invoice line items. - **id** (integer) - The ID of the invoice line. - **unit_code_id** (string) - The unit code ID for the line item. - **type** (string) - The type of the line item (e.g., 'line'). - **quantity** (number) - The quantity of the item. - **name** (string) - The name of the item. - **text** (string) - Description of the item. - **price** (number) - The price of the item. - **purchase_price** (number) - The purchase price of the item. - **empty_goods_value** (number) - The value of empty goods. - **vat** (number) - The VAT amount for the line item. - **discount** (number) - The discount amount for the line item. - **discount_type** (string) - The type of discount for the line item ('amount' or 'percentage'). - **product_id** (integer) - The ID of the product. - **g_l_account_code** (integer) - The general ledger account code. - **base_price_excl** (object) - Base price excluding VAT. - **_** (number) - The base price in the document currency. - **EUR** (number) - The base price in EUR. #### Response Example ```json { "id": 0, "journal_id": null, "currency_id": "company currency", "number": "next number in document journal", "number_formatted": "string", "date": "today (yyyy-mm-dd)", "delivery_date": "2019-08-24", "order_reference": "2019-08-24", "status": "string", "template_id": "The first available template", "customer_id": 0, "customer_name": "string", "customer_attn": "string", "customer_street": "string", "customer_streetnumber": "string", "customer_citycode": "string", "customer_city": "string", "customer_vat": "string", "customer_email": "string", "country_id": "string", "language_id": "string", "vattype": "excl", "vat_exception": "00", "discount": 0, "discount_type": "amount", "exchange_rate": "1 if currencies are the same or exchange rate of the document date", "term": "Company term settings", "term_end_of_month": true, "expiration_date": "2019-08-24", "section_behavior": "sum", "settlement_discount": 0, "settlement_term": 0, "automatic_reminders": true, "text": "string", "toptext": "string", "nota": "string", "online_payment_link": "string", "uuid": "string", "ogm": "string", "returned_empty_goods_value": 0, "codabox_uploaded": true, "twikey_transaction_id": "string", "exact_online_document_number": "string", "yuki_document_id": "string", "basecone_document_id": "string", "clearfacts_document_id": "string", "octopus_document_id": "string", "created": "2019-08-24", "modified": "2019-08-24", "deleted": true, "locked": true, "invoice_lines": [ { "id": 0, "unit_code_id": "ZZ", "type": "line", "quantity": 0, "name": "string", "text": "string", "price": 0, "purchase_price": 0, "empty_goods_value": 0, "vat": 0, "discount": 0, "discount_type": "amount", "product_id": 0, "g_l_account_code": 0, "base_price_excl": { "_": 0, "EUR": 0 } } ] } ``` ``` -------------------------------- ### Create Payment (POST) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Records a payment made against an invoice or other receivable. Requires payment details including amount, date, and related invoice ID. Returns the created payment object. ```javascript post("/payments", { "amount": 100, "payment_date": "2023-01-20", "invoice_id": 123, "method": "bank_transfer" }) ``` -------------------------------- ### Create Attachment (POST) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Attaches a file to a record (e.g., invoice, contact). Requires file data and the related record ID. Returns the created attachment object. ```javascript post("/attachments", { "file_name": "document.pdf", "content_type": "application/pdf", "related_type": "invoice", "related_id": 123, "data": "base64_encoded_file_content" }) ``` -------------------------------- ### Create Payment Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Records a payment against a specific invoice. ```APIDOC ## POST /invoices/{id}/payments ### Description Records a payment against a specific invoice. ### Method POST ### Endpoint /invoices/{id}/payments ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the invoice to record the payment against. #### Request Body - **payment_date** (string) - Required - The date the payment was made (YYYY-MM-DD). - **amount** (number) - Required - The amount of the payment. - **currency** (string) - Required - The currency of the payment (e.g., 'EUR'). - **method** (string) - Optional - The method of payment (e.g., 'bank_transfer', 'credit_card'). ### Request Example { "payment_date": "2023-10-26", "amount": 121.00, "currency": "EUR", "method": "bank_transfer" } ### Response #### Success Response (201) - **id** (integer) - The ID of the recorded payment. - **message** (string) - Confirmation message. #### Response Example { "id": 789, "message": "Payment recorded successfully." } ``` -------------------------------- ### Send Document to Clearfacts (PUT Request) Source: https://onfact.stoplight.io/docs/onfact/b69df491952ef-send-document-to-clearfacts This snippet demonstrates how to send a document to Clearfacts via a PUT request to the onFact API. Ensure your API connection is configured in your account. The request requires an 'id' path parameter and an 'X-SESSION-KEY' header for authentication. It accepts and returns JSON. ```curl curl --request PUT \ --url https://api5.onfact.be/clearfacts/v1/invoices/{id}.json \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'X-SESSION-KEY: 123' ``` -------------------------------- ### POST /v1/invoices.json Source: https://onfact.stoplight.io/docs/onfact/gof1k96c2md4r-use-case-excel-import Creates a new invoice in the onFact system by sending a JSON payload containing customer details and invoice line items. ```APIDOC ## POST /v1/invoices.json ### Description Creates a new invoice record in the onFact platform. ### Method POST ### Endpoint https://api5.onfact.be/v1/invoices.json ### Parameters #### Request Headers - **X-Company-Uuid** (string) - Required - The unique identifier for the company. - **X-Session-Key** (string) - Required - The authentication session key. #### Request Body - **customer_name** (string) - Required - Name of the customer. - **customer_street** (string) - Optional - Street address. - **customer_streetnumber** (string) - Optional - Street number. - **customer_citycode** (string) - Optional - Postal code. - **customer_city** (string) - Optional - City name. - **customer_vat** (string) - Optional - VAT number. - **invoice_lines** (array) - Required - List of items on the invoice. ### Request Example { "customer_name": "John Doe", "customer_street": "Main Street", "customer_streetnumber": "1", "customer_citycode": "1000", "customer_city": "Brussels", "customer_vat": "BE0123456789", "invoice_lines": [ { "quantity": "1", "name": "Service Fee", "price": "100", "vat": 21 } ] } ### Response #### Success Response (200) - **status** (string) - Success message or invoice ID. #### Response Example { "status": "success", "invoice_id": "INV-12345" } ``` -------------------------------- ### Create Invoice via onFact API Source: https://onfact.stoplight.io/docs/onfact/zoulkihh83xpc-use-case-send-peppol-invoice Sends a POST request to create a new invoice in the onFact system. Requires customer details and invoice line items in the request body. ```json { "customer_name": "onFact", "customer_street": "Stationsstraat", "customer_streetnumber": "98", "customer_city": "Asse", "customer_citycode": "1730", "country_id": "BEL", "customer_vat": "BE0714992641", "invoice_lines": [ { "quantity": 1, "name": "First Product Line", "price": 10, "vat": 21 }, { "quantity": 1, "name": "Second Product Line", "price": 10, "vat": 21 } ] } ``` -------------------------------- ### API Request Sample for Creating Attachment Source: https://onfact.stoplight.io/docs/onfact/d282708dc7223-create-attachment A sample JSON payload for creating an attachment via the onFact API. It includes the filename and the base64 encoded file content. This is used in the request body for the attachment creation endpoint. ```json { "name": "file.pdf", "file": "base64==" } ``` -------------------------------- ### POST /invoices/{id}/peppol.json Source: https://onfact.stoplight.io/docs/onfact/zoulkihh83xpc-use-case-send-peppol-invoice Sends a previously created invoice via the PEPPOL network. ```APIDOC ## POST /invoices/{id}/peppol.json ### Description Sends an existing invoice via the PEPPOL network using the invoice ID obtained from the creation step. ### Method POST ### Endpoint https://api5.onfact.be/v1/invoices/{id}/peppol.json ### Parameters #### Path Parameters - **id** (integer) - Required - The unique invoice ID #### Request Body - **identifier** (string) - Required - The VAT or enterprise number of the customer - **scheme** (string) - Required - The scheme identifier (e.g., BE:VAT) ### Request Example { "identifier": "BE0714992641", "scheme": "BE:VAT" } ### Response #### Success Response (200) - **status** (string) - Confirmation of the PEPPOL transmission status. ``` -------------------------------- ### Create Invoice Attachment via API Source: https://onfact.stoplight.io/docs/onfact/d282708dc7223-create-attachment This snippet demonstrates how to create an attachment for an invoice using the onFact API. It requires the invoice ID and a base64 encoded file. The API returns the ID and a success code upon successful creation. ```shell curl --request POST \ --url https://api5.onfact.be/v1/invoices/{id}/attachments.json \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'X-SESSION-KEY: 123' \ --data '{ "name": "file.pdf", "file": "base64==" }' ``` -------------------------------- ### Bulk Invoice Upload Source: https://onfact.stoplight.io/docs/onfact/420a3e39fd990-create-invoice Endpoint for adding multiple invoices in bulk. ```APIDOC ## POST /api/invoices/bulk ### Description Adds bulk invoices. ### Method POST ### Endpoint /api/invoices/bulk ### Parameters #### Request Body - **invoices** (array) - Required - A list of invoice objects to add. ### Request Example { "invoices": [ { "customer_id": "cust_456", "amount": 100.50 }, { "customer_id": "cust_789", "amount": 200.00 } ] } ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example { "message": "Bulk invoices added successfully." } ``` -------------------------------- ### Send Invoice via Email (POST) Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Sends a specified invoice to a customer via email. Requires the invoice ID and email details. Returns a confirmation of sending. ```javascript post("/invoices/123/send-email", { "recipient": "customer@example.com", "subject": "Your Invoice", "body": "Please find your invoice attached." }) ``` -------------------------------- ### onFact REST API - Authentication Source: https://onfact.stoplight.io/docs/onfact/ca4dc9f0399f4-on-fact-rest-api Information on how to authenticate your API requests using an API Key. ```APIDOC ## Authentication ### Description An API key is a token that you provide when making API calls. Include the token in a header parameter called `X-SESSION-KEY`. ### Method All HTTP Methods (GET, POST, PUT, DELETE, etc.) ### Endpoint All API Endpoints ### Parameters #### Header Parameters - **X-SESSION-KEY** (string) - Required - Your unique API key for authentication. ### Request Example ``` GET https://api5.onfact.be/some/endpoint Headers: X-SESSION-KEY: YOUR_API_KEY ``` ``` -------------------------------- ### onFact REST API - Base URLs Source: https://onfact.stoplight.io/docs/onfact/ca4dc9f0399f4-on-fact-rest-api The base URLs for accessing the onFact REST API in different environments. ```APIDOC ## API Base URL ### Production `https://api5.onfact.be/` ### UAT (User Acceptance Testing) `https://uat-api5.onfact.be/` ### Mock Server `https://stoplight.io/mocks/onfact/onfact/43690509` ``` -------------------------------- ### Create Event Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Creates a new event associated with an invoice. ```APIDOC ## POST /invoices/{id}/events ### Description Creates a new event associated with an invoice. ### Method POST ### Endpoint /invoices/{id}/events ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the invoice to associate the event with. #### Request Body - **type** (string) - Required - The type of event (e.g., 'note', 'reminder'). - **content** (string) - Required - The content or details of the event. ### Request Example { "type": "note", "content": "Customer requested a payment extension." } ### Response #### Success Response (201) - **id** (integer) - The ID of the created event. - **message** (string) - Confirmation message. #### Response Example { "id": 123, "message": "Event created successfully." } ``` -------------------------------- ### Create Attachment Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Adds an attachment to a specific invoice. ```APIDOC ## POST /invoices/{id}/attachments ### Description Adds an attachment to a specific invoice. ### Method POST ### Endpoint /invoices/{id}/attachments ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the invoice to attach the file to. #### Request Body - **file** (file) - Required - The file to upload. - **description** (string) - Optional - A description for the attachment. ### Request Example (Form data with 'file' and 'description' fields) ### Response #### Success Response (201) - **id** (integer) - The ID of the created attachment. - **filename** (string) - The name of the uploaded file. - **message** (string) - Confirmation message. #### Response Example { "id": 456, "filename": "invoice_scan.pdf", "message": "Attachment added successfully." } ``` -------------------------------- ### Send Invoice with Email Source: https://onfact.stoplight.io/docs/onfact/23dc086113a03-view-invoice Sends a specific invoice to a customer via email. ```APIDOC ## POST /invoices/{id}/send/email ### Description Sends a specific invoice to a customer via email. ### Method POST ### Endpoint /invoices/{id}/send/email ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the invoice to send. #### Request Body - **recipient_email** (string) - Optional - The email address to send the invoice to. If not provided, the customer's default email will be used. - **subject** (string) - Optional - The subject line for the email. - **body** (string) - Optional - The body content of the email. ### Request Example { "recipient_email": "customer@example.com", "subject": "Your Invoice", "body": "Please find attached your invoice." } ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the email was sent. #### Response Example { "message": "Invoice sent via email successfully." } ``` -------------------------------- ### onFact REST API - Available APIs Source: https://onfact.stoplight.io/docs/onfact/ca4dc9f0399f4-on-fact-rest-api List of available API categories within the onFact REST API. ```APIDOC ## Available APIs - Contacts - Time Entries - Products - Proposals - Orderslips - Deliveryslips - Postickets - Paymentrequests - Invoices - Purchases - Subscriptions - Creditnotes - Purchaseslips - Payments - Export - Import - Company Settings - Journals - InboundDocuments - Attachments - Reseller - PEPPOL - Schemas ```