Generate your first PDF
Submit a small HTML document, follow its job and save the PDF. This walkthrough uses Bash, curl and jq against a running DocKiln instance.
Connect to a workspace
Section titled “Connect to a workspace”Open the workspace, sign in and choose Settings → API keys → Create key. Copy the key when it appears. For local development, start the Docker stack first.
Set the instance URL to the origin you use in your browser. For the default local stack:
export DOCKILN_URL=http://localhost:3000read -rsp 'Workspace API key: ' DOCKILN_API_KEY; echoexport DOCKILN_API_KEYSubmit the HTML
Section titled “Submit the HTML”curl --fail-with-body -sS "$DOCKILN_URL/v1/documents" \ -H "Authorization: Bearer $DOCKILN_API_KEY" \ -H "Content-Type: application/json" \ -d '{"html":"<h1>Order confirmed</h1><p>Order DK-1042</p>"}'Copy the returned id. The status in the initial response describes the job at admission. Rendering continues on the worker.
Download the result
Section titled “Download the result”Set JOB_ID to the ID from your response. This loop checks for up to one minute, stops on an error and only writes a file when the worker has finished.
set -eu: "${JOB_ID:?Set JOB_ID to the returned document ID}"for attempt in {1..30}; do job=$(curl -fsS -H "Authorization: Bearer $DOCKILN_API_KEY" \ "$DOCKILN_URL/v1/documents/$JOB_ID") case "$(jq -r '.status' <<<"$job")" in completed) curl -fsS -H "Authorization: Bearer $DOCKILN_API_KEY" \ "$DOCKILN_URL$(jq -r '.download' <<<"$job")" -o order.pdf exit 0 ;; failed) jq -r '.error' <<<"$job" >&2; exit 1 ;; esac sleep 2doneecho "Still processing. Keep JOB_ID and check again." >&2exit 1Open order.pdf. The first page should read Order confirmed and show Order DK-1042. The same job appears under Documents in the workspace.
Use it in an application
Section titled “Use it in an application”Submit requests from your server so the workspace key stays private. The Next.js invoice guide and Node client example show how to integrate submission, bounded polling and downloads. Use idempotency keys when retrying a submission.