List and download invoices

1. List new incoming invoices

To get information of the new incoming invoices in AutoInvoice, start by listig the new incoming invoice id’s and save them locally.

  • SOAP:
    • invoice_list_ids To get a list of invoice id’s between selected timestamps. Method is called per company, so it is only possible to list invoices from one company at a time.
    • list_vendor_inbound_invoices To list all inbound invoices of companies. Method lists all inbound invoices of all the companies which are linked to certain vendor_api_key.
  • REST:
    • Use GET /v1/invoices with params direction=RECEIVED, received_at_start, and received_at_end to get list of invoices available for download. It is possible to use the param fields to limit the amount of data returned on the response.

2. Download based on listed invoice id’s

After you have listed and saved the new incoming invoice id’s, download the invoice files and attachments into your system

  • Incoming invoices should not be polled more often than once per hour, usually a couple of times per day is enough
    • Call methods starting with latest fetch timestamp and ending with current timestamp
    • If the API returns error or something unexpected, do not update timestamp but allow retry of listing at a later time
    • When the API returns a list of invoices, save invoice IDs locally with a status ‘pending download’ or such
    • Use the local ID list to download an invoice, marking it as successfully retrieved only after it has actually been retrieved (e.g. in case of errors, alert/retry download)
    • Timestamp on the server is GMT +2 and differences between client side and server side clocks might create intervals not covered when listing. Therefore, it is recommended that the timestamps have some buffer, for example 1 minute before and after to avoid any gaps in the time
    • Since the IDs of the invoices are listed locally, that list can be used to make sure the same invoice is not downloaded twice
  • After listing the invoices, have a separate process to download the actual invoice XML and attachments, and update the status with ‘download completed’ only after completed download. This will help to ensure intermittent errors will not cause any invoices to not be downloaded.

Invoice receiving