Search and download received invoices
France onlyLearn how to search for and retrieve incoming invoices using the AFNOR connector API. This recipe covers searching for incoming invoices, changing the invoice status and downloading invoice files.
To receive real-time notifications about the processing and delivery status of sent invoices, see how to set up and manage AFNOR webhooks.
Prerequisites
- The Peppol connector is installed and activated in the Network Connectors app.
- An app registered on a Jefacture space. See step 2 in this recipe.
- Banqup permissions.
- Resource ID:
Step 1: Search for incoming invoices
Endpoint: /network/documents/spaces/connectors/afnor/v1/flows/search
Header parameters:
Organization-Id: ThespaceIdof the sending space in Jefacture.Request-Id(optional): Client-generated unique identifier used to trace logs across requests.
Requires a JSON request body.
- You must include at least one search criterion in the
wherepayload.
When filtering by flowType, only the following values represent actual received invoices:
SupplierInvoice: Non-self-billed incoming or self-billed outgoing invoices.CustomerInvoice: Non-self-billed outgoing or self-billed incoming invoices.
curl -L 'https://{{serverURL}}/network/documents/spaces/connectors/afnor/v1/flows/search' \
-H 'Request-Id: 4803c35e-d132-4d4a-a29a-9da5f583b89a' \
-H 'Organization-Id: 60debf1a-e348-46a2-8e28-36403f83b022' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{
"limit": 10,
"where": {
"flowDirection": [
"In"
],
"flowType": [
"SupplierInvoice"
],
"updatedAfter": "2025-01-01T00:00:00.000Z"
}
}'
Successful response:
- Save the
flowIdfor further use. - To retrieve the next page of results, pass the returned
nextCursorvalue ascursorin your subsequent request.
{
"limit": 10,
"filters": {
"updatedAfter": "2025-01-01T00:00:00Z",
"flowType": [
"SupplierInvoice"
],
"flowDirection": [
"In"
]
},
"nextCursor": "uyJ1cGRhdGVkQXQiOiIyMDI2LTA4LTI1VDEyOjI2OjM1LjQ0MzIwNloiLCJmaWxlSWQiOiI2MjQxOWY3Yi1jYTQ1LTRlODAtOGE4Ny0xY2MzYmYxOTA0ZmQifQ==",
"results": [
{
"name": "017eda74-1ede-44a3-a977-bbef6131e626_f8d3daa1-4dd9-451c-bc18-fc41982e0f0f.pdf",
"flowSyntax": "Factur-X",
"flowId": "g1488ab9-f36a-40b7-9ba9-d21c18d479de",
"submittedAt": "2026-08-25T12:54:31.778441Z",
"updatedAt": "2026-08-25T12:54:50.416681Z",
"flowType": "SupplierInvoice",
"processingRule": "Undefined",
"flowProfile": "CIUS",
"processingRuleSource": "Computed",
"flowDirection": "In",
"acknowledgement": {
"status": "Ok"
}
}
]
}
Step 2: Update an invoice status (optional)
To update the status of an invoice, trigger a status transition via the CDAR event lifecycle by uploading a CDAR-compliant XML file.
Endpoint: /network/documents/spaces/connectors/afnor/v1/flows
Header parameters:
Organization-IdRequest-Id(optional)
Request body: multipart/form-data
flowInfomust have Content-type: application/jsonfilemust have Content-type: application/xml
curl -L 'https://{{serverURL}}/network/documents/spaces/connectors/afnor/v1/flows' \
-H 'Organization-Id: a2a801ff-41d8-40c5-9911-035c0cce8b47' \
-H 'Content-Type: multipart/form-data; boundary=<calculated when request is sent>' \
-H 'Authorization: Bearer YOUR_TOKEN' \
--form 'flowInfo="{\"flowSyntax\": \"CDAR\", \"name\":\"lifecycle_update.xml\"}"' \
--form 'file=@@"/path/to/lifecycle_update.xml"'
Response: 202 Accepted means the request was accepted for processing.
{
"name": "lifecycle_update.xml",
"flowSyntax": "CDAR",
"sha256": "f4611dad84b098f6779a71f411a1828a89c7270e17016aca4a8e1aa0b2a8125f",
"processingRule": "NotApplicable",
"flowProfile": "Undefined",
"flowId": "01a08530-c0b4-7c26-8675-374a243699e3",
"submittedAt": "2026-09-09T08:02:39.924269Z"
}
Check the invoice status using the path parameter
flowIdand the query parameterdocType=Metadatawith this endpoint /network/documents/spaces/connectors/afnor/v1/flows/{flowId}?docType=Metadata.
Step 3: Download invoice files
Use the flowId returned by the search to retrieve the invoice metadata or download its files.
Endpoint: /network/documents/spaces/connectors/afnor/v1/flows/{flowId}
Path parameters:
flowId
Header parameters:
Organization-IdRequest-Id(optional)
Query parameters:
-
docType: (Optional) Type of file to download. Allowed values:Metadata(default, returns JSON),Original,Converted,ReadableView.docTypeReturns Use when MetadataJSON You need invoice metadata OriginalOriginal invoice file You need the file as received ConvertedConverted invoice file You need the converted format ReadableViewHuman-readable file You want to display/read the invoice
curl -L 'https://{{serverURL}}/network/documents/spaces/connectors/afnor/v1/flows/{flowId}?docType=ReadableView' \
-H 'Request-Id: 4803c35e-d132-4d4a-a29a-9da5f583b89a' \
-H 'Organization-Id: 60debf1a-e348-46a2-8e28-36403f83b022' \
-H 'Authorization: Bearer YOUR_TOKEN' \
--output ~/Downloads/invoice.pdf
Successful response:
- For invoice types (
Original,Converted,ReadableView): Returns the raw binary stream and saves it directly to the specified file (invoice.pdf). - For
Metadata(default): Returns invoice details as JSON.
{
"id": "flow-8f3a92b1-1239",
"trackingId": "trk-550e8404",
"flowType": "SupplierInvoice",
"flowDirection": "In",
"createdAt": "2026-08-25T14:30:00.000Z"
}