Retrieve Completed Documents from a Webhook
Overview
When Evia Sign sends a signing_completed or request.completed webhook, the completed documents are ready for retrieval. Before downloading, validate the webhook and exchange your API key for a short-lived access token.
Follow the steps below to retrieve the completed documents securely:
Receive the webhook and read requestId, deliveryId, and event ID.
Validate X-Webhook-Signature when HMAC security is enabled.
Use deliveryId as an idempotency key to prevent repeat downloads.
Exchange the API key for an access token.
List and download the required completed documents.
Webhook response
The webhook payload includes the identifiers needed to correlate the event and retrieve its completed documents. Preserve the raw body before HMAC verification.
{
"deliveryId": "delivery-123",
"eventId": "signing_completed",
"tenantId": "tenant-123",
"requestId": "request-123",
"requestTitle": "document-123.pdf",
"timestamp": "2026-09-04T10:00:00Z",
"schemaVersion": "1.0"
}
deliveryId
Unique delivery identifier. Store it to make webhook handling idempotent.
eventId
Event type, for example signing_completed.
tenantId
Tenant ID of the request
requestId
Use this ID to list the completed documents.
requestTitle
Human-readable request title. Use it for display only.
timestamp
Event time in UTC.
schemaVersion
Payload schema version for compatible processing.
1. Exchange API key for access token
Before calling a document endpoint, exchange the integration API key for a scoped Bearer token. The API key identifies the integration; do not use it directly for document download calls.
Send the following request:
After a successful exchange, Evia Sign returns the following values:
2. List completed documents
Use the requestId from the webhook to list the available completed documents and their secure download URLs. The response includes signed documents and, when available, the audit trail.
Send the following request:
Evia Sign returns an array like the following:
3. Download a document from the response
Call the exact downloadUrl returned for the document you need. The opaque document token is already part of this URL. Do not construct it from documentId or the file name.
Send the following request:
Download the audit trail
Locate the item where documentName is audit_trail.pdf, then use its downloadUrl. Download and save it in the same way as any other completed document.
End-to-end example
Receive the webhook - Read requestId and deliveryId. Validate the HMAC signature when webhook security is enabled.
Prevent duplicate processing - Store deliveryId and stop processing if the same delivery has already succeeded.
Exchange the API key - Call /api/v2/oauth/exchange with X-Api-Key and read access_token.
Retrieve the documents - Call the list-documents endpoint, then call each returned downloadUrl for the files you need.
Save the files - Save the files in a request-specific location. Mark deliveryId as processed only after the download succeeds.
Failure handling
Invalid webhook signature
Reject the delivery; do not call the token or document endpoints.
Duplicate deliveryId
Return success without downloading the files again.
401 or expired token
Exchange the API key again and retry once.
Request not completed
Do not download. Wait for the completed event or retry according to your delivery policy.
Download failure
Log requestId and deliveryId; retry safely without creating duplicate records.
Last updated
Was this helpful?