> ## Documentation Index
> Fetch the complete documentation index at: https://developers.lucca.fr/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve processed invoices

> Learn how to retrieve already processed invoices from Lucca Invoices to sync them with your ERP

Retrieving all invoices imported into Lucca Invoices to add them to the ERP requires some precautions, since invoices can be deleted.

<Warning>It is therefore recommended to only sync approved invoices, which can no longer be deleted.</Warning>

For this, the API endpoint to use is the `booked-documents`.

<CodeGroup>
  ```http List booked-documents theme={null}
  GET /cleemy-procurement/booked-documents?invoice.conformityStates=Confirmed&creditNote.conformityStates=Confirmed&createdAt.from={lastImportDate}&limit=0&page=1&fields.root=count HTTPS/2
  Host: example.ilucca.net
  Authorization: lucca application={API_KEY}
  Accept: application/json
  ```
</CodeGroup>

Where:

* `?createdAt.from=` filters out results to only return the ones that were created since your last sync attempt.
* `?invoice.conformityStates` and `creditNote.conformityStates=Confirmed` filter out results to only return approved invoices.

<Note>This API is paginated, and the maximum number of items retrievable per page is 1000. The `?fields.root=count` query parameter will request the server to return the total number of items across all pages.</Note>
<Tip>Information related to the order is present in the `purchase` node. You might need to make a specific call to the purchase API to get the data you need.</Tip>

Please note that this API retrieves all documents accounted for in the system, invoices and credit notes. Hence the `creditNote.conformityState` query parameter in the API request.

Regarding amounts:

* `expectedAmount`: theoretically expected amount (the order amount).
* `costAmount`: charge amount (case where VAT would not be recoverable).
* `amountIncludingTaxes`: object grouping the excluding taxes amount and VAT. **This is the amount I recommend you use.**

<Note>Amounts include both a `counter` part (**converted amount**) and a `base` (**original currency amount**) in order to support foreign currencies.</Note>
