Send e-invoices

Manage the issuance of electronic invoices with the B2Brouter API

Generate an electronic invoice

To manage the creation and import of invoices, as well as other processes, you have two options:

Create the electronic invoice

You can generate an invoice in .json format when your system cannot generate invoices in a structured format like Facturae, UBL, etc:

  1. In the left menu, select the Invoices option.
  2. Within this dropdown, select Create an issued invoice to create an invoice.
  3. In PATH PARAMS, fill in the fields with the data you want to include in the invoice.
  4. In the project field, enter the project identifier of the company where you want to import the invoice. This identifier is obtained by querying the company's data and is located in the "identifier" field.
  5. In the format option, select the format in which you want to receive the response.
  6. Below, you will find additional parameters that allow you to supplement the request with more invoice details.
  7. In the BODY PARAMS section, you can add more invoice details such as lines, taxes, etc.
  8. In send_after_import, use the dropdown to configure whether you want to automatically send the invoice after importing it (True) or keep it in "New" status for manual sending (False).
  9. Under invoice, you will find the INVOICE OBJECT dropdown that allows you to expand more options for creating the invoice.
  10. In this space, you can add general data such as the invoice number, date, etc.
  11. Create the lines under invoice_lines_attributes, using the ADD OBJECT dropdown to add the information.
  12. Apply taxes under taxes_attributes, using the ADD OBJECT dropdown to add the information.
  13. You can add more information through different sections. For example: In client, enter the recipient's invoice data. In transport_type_code, specify the invoice delivery method, etc.
  14. As you add the data, the code in the CURL window (right side of the screen) is updated. This code is the request you need to generate and send (with the correct information in each case) to generate and import the electronic invoice into B2Brouter.

Import the invoice from a file

If your system can already generate electronic invoices in a structured format like UBL, XRechnung, Facturae, FatturaPA, you can import the file through the API. Follow these steps:

  1. In the left menu, select Invoices.
  2. Then select Import an invoice from a file.
  3. In the project field, enter the project identifier where you want to import the invoice.
  4. In format, select the desired response format.
  5. In send_after_import, choose whether you want to automatically send the invoice after importing it (True) or not (False).
  6. In BODY PARAMS, upload the invoice file you want to import.
  7. The code in the CURL window (right side of the screen) is updated with the information required to import the electronic invoice into B2Brouter.

Note: In both cases, if you have not configured automatic invoice sending, you can do so from the left menu by selecting Invoices and then Send invoice. Here, you must provide the internal B2Brouter identifier for the invoice.

Manage information and status of issued electronic invoices

You can retrieve data for invoices and their updated status in the following ways:

Retrieve information for a list of invoices

You can retrieve data for a list of up to 100 invoices at once. Follow these steps:

  1. In the left menu, select Invoices, and then List of issued invoices.
  2. In PATH PARAMS, provide or select the required data.
  3. Enter the project identifier (where you want to make the query) in project.
  4. In format, select the response format (.json or .xml).
  5. In QUERY PARAMS, configure parameters to filter the information you want to receive in the query. For example:
    • In limit, specify the maximum number of invoices to query.
    • In date_from and date_to, specify a time interval.
  6. The code necessary to make the call is generated in the CURL window (right side of the screen).
  7. In the RESPONSE window, you will find the response sent to your system.

In this case, a list of filtered invoices with basic information is generated.

Retrieve detailed information for a single invoice

You can retrieve more detailed information for a specific invoice:

  1. In the left menu, select Invoices, and then Get invoice.
  2. In PATH PARAMS, indicate or select the required data.
  3. Enter the project identifier (where you want to make the query) in project.
  4. In format, select the response format (.json or .xml).
  5. In QUERY PARAMS, configure specific parameters for the invoice you want to query. For example:
    • In include, you can select the detailed_lines option to get line details.
  6. The code necessary to make the call is generated in the CURL window (right side of the screen).
  7. In the RESPONSE window, you will find the response sent to your system.

In this case, the information you obtain about the invoice is much more detailed than in the previous case.

Obtain the electronic invoice in a specific format

You can obtain the invoice in a format other than .json.

  1. In the left menu, select Invoices, and then select the option get an invoice with a specific document type.
  2. In PATH PARAMS, specify the required data.
  3. Enter the project identifier (where you want to make the query) in project.
  4. Specify the format in which you want to download the invoice in document_type_code*. For example, if you want to download the invoice in Facturae format, you should specify it as follows: xml.facturae.3.2**.

Note: Obtain the list of available format codes in Document Types by making the query.