Receive invoice lifecycle events and download CDAR files
France onlyLearn how to configure an event-driven webhook mechanism to receive notifications for invoice lifecycle flows using the AFNOR connector API, download the original CDAR lifecycle files, and investigate lifecycle flows with acknowledgement errors.
Prerequisites
- The AFNOR connector is installed and activated in the Banqup Store.
- An app registered on a Jefacture space. See step 2 in this recipe.
- Banqup permissions.
- Resource ID:
Step 1: Set up a webhook
To configure a webhook, see the recipe Set up webhooks.
Configure the webhook to subscribe to the flow types relevant to your use case. The webhook notification contains the flowId that you use in Step 2 to download the corresponding CDAR lifecycle file.
Step 2: Download the CDAR lifecycle file
Endpoint: /network/documents/spaces/connectors/afnor/v1/flows/{flowId}
Path parameters:
flowId: Unique identifier of the lifecycle flow received in the webhook notification.
Header parameters:
Organization-Id: ThespaceIdof the space in Jefacture.Request-Id(optional): Client-generated unique identifier used to trace logs across requests.
Query parameters:
docType: Set toOriginalto download the original CDAR XML file.
curl -L 'https://{{serverURL}}/network/documents/spaces/connectors/afnor/v1/flows/{flowId}?docType=Original' \
-H 'Request-Id: 4803c35e-d132-4d4a-a29a-9da5f583b89a' \
-H 'Organization-Id: 60debf1a-e348-46a2-8e28-36403f83b022' \
-H 'Authorization: Bearer YOUR_TOKEN' \
--output ~/Downloads/cdar_lifecycle.xml
Successful response: Returns the binary CDAR XML file and saves it locally.
Step 3: Handle webhook failure fallback
If you need to investigate lifecycle flows with acknowledgement errors, use the flow search endpoint to find the affected flows.
Endpoint: /network/documents/spaces/connectors/afnor/v1/flows/search
Header parameters:
Organization-Id: ThespaceIdof the space in Jefacture.Request-Id(optional): Client-generated unique identifier used to trace logs across requests.
Requires a JSON request body.
You can filter the results byackStatusand, optionally, byflowType.
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": {
"ackStatus": "Error",
"flowType": [
"CustomerInvoice",
"SupplierInvoice"
]
}
}'
Successful response: Inspect returned flows to review error details, then use the returned flowId with Step 2 to retrieve the original CDAR file.
{
"limit": 2,
"filters": {
"flowType": [
"CustomerInvoice",
"SupplierInvoice"
],
"ackStatus": "Error"
},
"nextCursor": "eyJ1cGRhdGVkQXQiOiIyMDI2LTA2LTIyVDEyOjQyOjjI1OTNaIiwiZmlsZUlkIjoiNGI1NmQyMzctOTdhYS00NDg3LWE5NTgtNmY2MWIxNzIzOTU0In0=",
"results": [
{
"name": "CDAR_test.xml",
"flowId": "41c51547-e533-48ef-8979-81e3583aba96",
"submittedAt": "2026-06-22T12:23:48.028123Z",
"updatedAt": "2026-06-22T12:24:03.781653Z",
"flowType": "CustomerInvoice",
"processingRule": "Undefined",
"flowProfile": "Undefined",
"processingRuleSource": "Computed",
"flowDirection": "Out",
"acknowledgement": {
"status": "Error",
"details": [
{
"level": "Error",
"item": "N/A",
"reasonCode": "OtherTechnicalError",
"reasonMessage": "Autre problème technique"
}
]
}
},
{
"name": "CDAR_File",
"flowId": "4b56d237-97aa-4487-a958-6f61b1723955",
"submittedAt": "2026-06-22T12:42:18.066685Z",
"updatedAt": "2026-06-22T12:42:32.2593Z",
"flowType": "CustomerInvoice",
"processingRule": "Undefined",
"flowProfile": "Undefined",
"processingRuleSource": "Computed",
"flowDirection": "Out",
"acknowledgement": {
"status": "Error",
"details": [
{
"level": "Error",
"item": "N/A",
"reasonCode": "OtherTechnicalError",
"reasonMessage": "Autre problème technique"
}
]
}
}
]
}