Skip to main content
Generating invoices programmatically speeds up your billing cycle and ensures every invoice meets electronic invoicing standards without manual intervention. In this guide, we will find or create a client, draft and finalize an invoice, then poll until the Factur-X PDF (a standard PDF with embedded XML required for e-invoicing compliance) is ready to download.
Example: A SaaS platform automatically generates a Qonto invoice at the end of each billing period and sends the Factur-X PDF to the customer, with no manual step required.
Prerequisites:
  • E-invoicing must be enabled on your Qonto account.
  • Scopes: client.read, client.write, client_invoice.read, client_invoice.write, attachment.read, organization.read (optional).
1

Find or create the client

Look up an existing client by email or create a new one. Save the client_id — you’ll need it in the next step.Endpoint: List clients · Create a client
OAuth scopes required: client.read, client.write
2

Get your receiving bank account IBAN

The invoice must reference the Qonto bank account where you want to receive payment. Fetch your organization to retrieve the IBAN of the account you’ll use.Endpoint: Retrieve the authenticated organization and list bank accounts
OAuth scope required: organization.read
This step is optional if you already know the IBAN of the account you want to use.
3

Create the invoice draft

Create the invoice in draft state. It will not yet be sent or assigned a number.Endpoint: Create a client invoice
OAuth scope required: client_invoice.write
4

Finalize the invoice

Finalizing the invoice assigns it an official number, locks it for editing, and triggers the asynchronous generation of the Factur-X PDF.Endpoint: Finalize a client invoice
OAuth scope required: client_invoice.write
5

Poll until the Factur-X PDF is ready

The Factur-X PDF is generated asynchronously after finalization. The attachment_id may not be set immediately on the invoice — re-fetch the invoice until it appears, then poll GET /attachments/{id} until it returns 200. That is your signal to download.
Do not download the PDF until the attachment endpoint returns 200.
Endpoints: Retrieve a client invoice · Retrieve an attachment
OAuth scope required: client_invoice.read, attachment.read
6

Download the Factur-X PDF

Download the file from the attachment URL. The URL is valid for 30 minutes, download immediately.
To verify the Factur-X XML is correctly embedded, open the PDF in Adobe Acrobat Reader and check for a paperclip icon, it should contain a factur-x.xml attachment.
Factur-X PDF example
Example output:
We now have the finalized Factur-X PDF downloaded locally. It contains the embedded factur-x.xml file required for electronic invoicing compliance.