Skip to content

Downloads and webhooks

Retrieve a finished file, deliver it to your bucket or notify a service when a document finishes.

Poll GET /v1/documents/{id} with the workspace credential. On completed, request the relative download path from that response with the same credential. PDFs use /pdf and images use /file. A read before completion returns 409. Use Documents in the workspace to inspect status and download an earlier output.

In Settings, configure a bucket, region, optional slash-terminated prefix and a dedicated AWS key pair. Enable S3 Block Public Access. Scope the principal’s s3:PutObject and s3:GetObject to BUCKET/PREFIX/WORKSPACE-ID/*. Settings return bucket metadata and keep secret values encrypted at rest under the host encryption key.

Set "delivery": "object" in the generation request to select S3. The job records a delivery failure if the object cannot be stored. For a completed S3 document, authenticated GET /v1/documents/{id}/link returns a presigned URL valid for 300 seconds. Treat that URL as a temporary credential. The default delivery stores the file in workspace storage; in the Cloud Run profile this is a private Google Cloud Storage bucket.

Configure a public HTTPS receiver in workspace Settings and save the signing secret when shown. Completion and failure events contain a stable event ID and a document status. Before handling one:

  1. Read the exact request body bytes and x-dockiln-timestamp. Reject stale timestamps and timestamps too far in the future. Five minutes is a practical tolerance.
  2. Compute HMAC-SHA256 over the timestamp, one literal period and the raw body, using the webhook secret. Compare v1= followed by the hex digest with x-dockiln-signature using a constant-time comparison.
  3. Parse the verified payload. Deduplicate its event ID in the same transaction as your side effect, then acknowledge with a 2xx response.

Delivery retries keep the event ID stable and sign each attempt again. Retries use delays of 5 seconds, 30 seconds, 2 minutes and 10 minutes. The fifth failed attempt is terminal. Settings shows the most recent deliveries and their attempt counts. Webhook redirects are rejected.

Use the API reference for supported request fields and the PDFShift comparison for migration considerations. Test the supplied examples against your deployment before migrating production documents.