Documentation Playground
Docs / Delivery Mode
Document Routing

Delivery Modes

PDFKong supports multiple ways to deliver the generated PDF. You can stream it back directly, receive a base64 string, upload it directly to your AWS S3 bucket, or receive it asynchronously via webhook.

curl -X POST "https://api.pdfkong.com/v1/convert" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "html": "<h1>Hello PDF</h1>", "delivery_mode": "webhook", "webhook_endpoint": "https://api.example.com/hooks/pdf" }'

Understanding Delivery Modes

inline
Generated in RAM and streamed directly for browser preview. Never saved on our servers.
attachment
Generated in RAM and forces a "Save As" file download. Never saved on our servers.
base64
Generated in RAM and returned as a Base64 string in JSON. Never saved on our servers.
json
Temporarily stored on our servers to return a secure download URL. Auto-deleted after 24 hours.
webhook
Temporarily stored to send an async URL via Webhook. Auto-deleted after 24 hours.
s3 / gcp
Generated in RAM and uploaded directly to your cloud bucket. Never saved on our servers.

Main Configuration

delivery_mode select
Default: json

Specifies the response output flow mechanism: inline, attachment, json, base64, s3, webhook, jsonp. Note: In JSON and Webhook modes, files are temporarily stored for 24 hours to allow downloading. In all other modes, files are processed strictly in-memory and are never stored on our servers.

Accepted Values:inlineattachmentjsonbase64s3webhookjsonpgoogle_storage

Webhook Configuration

Required when delivery_mode is set to webhook.

webhook_endpoint text
Default: null

Webhook URL callback endpoint.

Amazon S3 Configuration

Required when delivery_mode is set to s3.

s3_bucket_name text
Default: null

Amazon S3 target bucket name.

s3_bucket_key text
Default: null

AccessKeyID of your S3 bucket.

s3_bucket_secret text
Default: null

Secret of your S3 bucket.

s3_region text
Default: us-east-1

Amazon S3 bucket service region.

s3_path text
Default: documents

Custom folder upload sub-path key.

Google Cloud Storage Configuration

Required when delivery_mode is set to google_storage.

gcp_project_id text
Default: null

Your Google Cloud Platform Project ID.

gcp_user_email text
Default: null

The email address of your GCP service account.

gcp_private_key text
Default: null

The private key associated with your GCP service account.

gcp_bucket_name text
Default: null

The name of your target Google Cloud Storage bucket.

JSONP Configuration

Required when delivery_mode is set to jsonp.

callback text
Default: null

Function name for the jsonp delivery mode.