Working with e-invoicesWebhooks

Webhooks

Events, HMAC-SHA256 signature, replay protection and retry policy.

Webhooks are an extension of Doklado SAPI+ beyond the SAPI-compatible polling workflow. They serve to actively notify the client about events, especially about a new received document or a change in the status of a sent document.

Webhook does not replace polling. The client must also be able to obtain documents via the endpoints described in the section Receiving eInvoices. Check the current status of the sent document, the result of TDD reporting and available receipts via Sending status and receipts. A webhook is meant to be used as a processing accelerator, not as a single source of truth.

Basic rules:

  • the webhook payload contains only event metadata, not an XML document,
  • The client downloads the XML content of the received document via GET /v1/sapi/document/receive/{documentId},
  • the received document is considered processed only after a successful call to acknowledge,
  • each webhook request is signed using HMAC-SHA256,
  • the client must process webhooks idempotently according to X-SAPI-Delivery-Id,
  • if the client is unavailable, Doklado repeats the delivery according to the retry policy.

Enter the URL for receiving notifications when creating a SAPI+ connection in Account overview → SAPI+ connections. If you enter the URL, a Webhook Secret will also be generated to verify the signature. Save it safely before closing the dialog; secrets are displayed only once. The current REST API reference does not include an endpoint to manage or test webhooks.

Overview of webhook delivery

If the client does not return HTTP 2xx, Doklado considers the delivery of the webhook unsuccessful and queues it for retry.

Document notification URL

For document notification, documentId is added to the configured base URL of the webhook:

POST https://your-system.example/webhooks/doklado/doc_01HX0000000000000000000000
Content-Type: application/json

Enter a base URL in the connection settings, for example https://your-system.example/webhooks/doklado. Prepare the receiving endpoint for the path /webhooks/doklado/{documentId}. This is an outgoing Doklado call to your server.

Event details are in the JSON body. For document.received, use data.documentId to load the XML and after successful download to acknowledge according to the instructions Receiving eInvoices.

Webhook request headers

Each webhook request from Doklado contains the following HTTP headers:

The headerMandatoryValue exampleDescription
X-SAPI-Signatureyessha256=a3f9b2...HMAC-SHA256 signature calculated from timestamp and raw request body.
X-SAPI-Timestampyes1778531400Unix timestamp of sending the webhook. It serves to protect against a replay attack.
X-SAPI-Webhook-Idyeswh_01HX0000000000000000000000Identifier of the webhook configuration in Doklado.
X-SAPI-Delivery-Idyesdel_01HX0000000000000000000000Unique delivery ID. It remains the same for reruns of the same event.
Content-Typeyesapplication/jsonWebhook request body format.

Custom HTTP headers

A custom HTTP header can be added to webhook requests, for example an API key required by your receiving system:

X-Integration-Key: YOUR_INTEGRATION_KEY

X-Integration-Key is a sample name; set the name and value according to the receiving endpoint. The custom header complements the standard webhook headers. Continue to verify the X-SAPI-Signature signature, timestamp and delivery duplicate according to X-SAPI-Delivery-Id.

Signature Verification

Doklado calculates the signature from the raw request body. The client must use the exact bytes of the received body before JSON parsing.

signed_payload = X-SAPI-Timestamp + "." + raw_request_body
signature = HMAC-SHA256(webhook_secret, signed_payload)
X-SAPI-Signature = "sha256=" + hex(signature)

Recommended client-side validation:

  1. Check that X-SAPI-Timestamp is not older than the allowed tolerance, recommended 5 minutes.
  2. Calculate HMAC-SHA256 over timestamp + "." + raw_request_body.
  3. Compare the calculated signature with the value X-SAPI-Signature using a constant-time comparison.
  4. Check if X-SAPI-Delivery-Id has not already been processed.
  5. Only then process the payload.

If the signature does not match, the client must reject the webhook with a HTTP 401 or HTTP 403 response.

Types of events

EventTriggerRecommended client action
document.receivedDoklado accepted a new document for the given participantId.Download detail via GET /v1/sapi/document/receive/{documentId} and call after successful processing acknowledge.
document.acknowledgedThe document was confirmed via /acknowledge.Write the status to the client system if the client is tracking return confirmations.
document.send.acceptedThe submitted document has been technically accepted by Doklado for processing.Save providerDocumentId and monitor the next status.
document.send.deliveredThe sent document reached the status of successful delivery according to the available transport or status response.Update the submission status in the client system.
document.send.failedFailed to send or deliver the document.Show the error to the user or run an internal correction workflow based on the type of error.
webhook.pingTest delivery from web interface or API.Verify signature and return HTTP 2xx.
document.reconciliation.completedDoklado matched the document to the bank transaction. Linked bank account condition in Doklado.Update the status of the document in the client system and save the reference to the bank transaction.

Webhook Payload Structure

Doklado sends POST to the configured client webhook endpoint.

Example payload for document.received:

{
  "deliveryId": "del_01HX0000000000000000000000",
  "webhookId": "wh_01HX0000000000000000000000",
  "event": "document.received",
  "timestamp": "2026-05-11T12:00:05Z",
  "participantId": "0245:9876543210",
  "data": {
    "documentId": "doc_01HX0000000000000000000000",
    "clientDocumentId": "INV-2026-0001",
    "documentTypeId": "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1",
    "processId": "urn:fdc:peppol.eu:2017:poacc:billing:01:1.0",
    "senderParticipantId": "0245:1234567890",
    "receiverParticipantId": "0245:9876543210",
    "receivedAt": "2026-05-11T12:00:05Z",
    "status": "RECEIVED",
    "payloadFormat": "XML"
  }
}

Payload fields:

FieldTypeDescription
deliveryIdstringDelivery identifier. Matches the header X-SAPI-Delivery-Id.
webhookIdstringIdentifier of the webhook configuration. Matches the header X-SAPI-Webhook-Id.
eventstringType of event, e.g. document.received.
timestampdatetimeThe time when the event was created or sent in ISO 8601.
participantIdstringPeppol Participant ID to which the event relates.
dataobjectEvent metadata. For document events, it mainly contains document identifiers and status.

For document events, the data object uses the same field names as DocumentMetadata, supplemented by status and time fields relevant to the given event.

For the document.received event, data.documentId can correspond to a document identifier (expense) or a company file (organizationFile) in Doklado. Take the value without modification and use it when loading the received document and confirming acknowledge. clientDocumentId is a client-assigned identifier and does not replace documentId in these paths.

Retry delivery policy

The webhook is considered successfully delivered if the client returns any HTTP 2xx status within 30 seconds.

If the client does not respond in time or returns a non-2xx status, Doklado repeats the delivery:

An attemptDelay
11 minute
25 minutes
330 minutes

After the retries are exhausted, the specific delivery will be marked as FAILED. Webhook configuration can be automatically disabled if multiple events fail repeatedly. The exact deactivation limits are operational setting Doklado.

Safe and reliable processing

Check the tolerance of the timestamp against the current time, including unreasonable future values. Mark the delivery identifier as processed only after the event has been securely saved. For an already received event, return a successful acknowledgment without repeating the side effects.

Perform longer XML processing after persistently saving the webhook to respond within 30 seconds. Regular polling also captures documents whose notification was not delivered after repeated attempts.