> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dockiln.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Downloads and webhooks

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

## Download a file

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.

## Deliver to Amazon S3

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.

## Receive signed events

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.

## Additional customer destinations in the review build

The 1.1 review build adds R2 and customer GCS delivery, expiring outputs and per-job signed callbacks. [Configure private delivery](https://docs.dockiln.io/pdfshift-migration.md#protect-and-deliver-output).

## Provider setup and receiver examples

Follow the bucket-specific instructions for [Amazon S3](https://docs.dockiln.io/misc/buckets/aws-s3.md), [Google Cloud Storage](https://docs.dockiln.io/misc/buckets/google-cloud-storage.md) or [Cloudflare R2](https://docs.dockiln.io/misc/buckets/cloudflare-r2.md). The [webhook guide](https://docs.dockiln.io/misc/webhook-events.md) includes a Node.js signature verifier.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.