Search and download received invoices
France onlyLearn how to search for and retrieve incoming invoices using the AFNOR connector API.
This recipe covers setting up real-time webhook notifications for new invoices, retrieving incoming documents, downloading invoice files, and managing webhook subscriptions.
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.
- The resource ID necessary to start this recipe:
Step 1: Set up webhook subscriptions (optional)
Register a listener endpoint to get real-time alerts whenever a new invoice arrives.
Endpoint: /network/documents/spaces/connectors/afnor/v1/webhooks
Header parameters:
Request-Id: Client-generated unique identifier used to trace logs across requests.Organization-Id: ThespaceIdof the receiving space in Jefacture.
Requires a JSON request body.
curl -L 'https://{{serverURL}}/network/documents/spaces/connectors/afnor/v1/webhooks' \
-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 '{
"callbackUrl": "https://app.btx.jefacture.com",
"flowDirection": "In",
"flowTypes": [
"SupplierInvoice"
]
}'
Successful response: Save both the webhookId and the generated signingKey. You must use the signing key to validate the Afnor-Signature header on incoming callback events.
{
"webhookId": "6bf9fa3c-704e-44c7-8dd4-e76d0800c324",
"signingKey": "jsXizLtzADbksSH5kJ1+U4N6/nkOVOOKCEjLm7TwMqI=",
"createdAt": "2026-08-25T12:11:41.280443742Z"
}
Step 2: Search for incoming invoices
Endpoint: /network/documents/spaces/connectors/afnor/v1/flows/search
Header parameters:
Request-IdOrganization-Id
Requires a JSON request body.
You must include at least one search criterion in thewherepayload.
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 3: Download invoice files
Retrieve either the metadata or the raw document files of an invoice.
Endpoint: /network/documents/spaces/connectors/afnor/v1/flows/{flowId}
Path parameters:
flowId
Header parameters:
Request-IdOrganization-Id
Query parameters:
docType: (Optional) Type of file to download. Allowed values:Metadata(default, returns JSON),Original,Converted,ReadableView.
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 document 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"
}
Step 4: Manage webhook subscriptions
Step 4.1: Retrieve existing subscriptions
Endpoint: /network/documents/spaces/connectors/afnor/v1/webhooks
Header parameters:
Request-IdOrganization-Id
curl -L 'https://{{serverURL}}/network/documents/spaces/connectors/afnor/v1/webhooks' \
-H 'Request-Id: 4803c35e-d132-4d4a-a29a-9da5f583b89a' \
-H 'Organization-Id: 60debf1a-e348-46a2-8e28-36403f83b022' \
-H 'Authorization: Bearer YOUR_TOKEN' \
Successful response: Save the webhookId for further use.
{
"count": 1,
"webhooks": [
{
"webhookId": "6bf9fa3c-704e-44c7-8dd4-e76d0800c324",
"callbackUrl": "https://app.btx.jefacture.com",
"signingKey": "jsXizLtzADbksSH5kJ1+U4N6/nkOVOOKCEjLm7TwMqI=",
"flowTypes": [
"SupplierInvoice"
],
"flowDirection": "In",
"createdAt": "2026-08-25T12:11:41.280443742Z"
}
]
}
Step 4.2: Remove obsolete subscriptions
Endpoint: /network/documents/spaces/connectors/afnor/v1/webhooks/{webhookId}
Path parameters:
webhookId
Header parameters:
Request-IdOrganization-Id
curl -L -X DELETE 'https://{{serverURL}}/network/documents/spaces/connectors/afnor/v1/webhooks/{webhookId}' \
-H 'Request-Id: 4803c35e-d132-4d4a-a29a-9da5f583b89a' \
-H 'Organization-Id: 60debf1a-e348-46a2-8e28-36403f83b022' \
-H 'Authorization: Bearer YOUR_TOKEN'
Successful response: The subscription was deleted successfully.