ScreenshotNeo

BlogHow-to

How to Automate DocRaptor PDF Generation with Zapier

Build a Zap that sends HTML or a URL to DocRaptor, handles PDF bytes or hosted links, and passes the result to the right next step.

By the ScreenshotNeo team4 October 20268 min read

Direct answer: use a Zap trigger followed by Webhooks by Zapier configured as a POST request to send DocRaptor a JSON document request. Then map the response to a later Zap step according to the response type: PDF bytes, hosted-document JSON, or an asynchronous job ID. DocRaptor documents this API-based Zapier route; do not assume it is a native DocRaptor Zapier app. DocRaptor’s Zapier guide and Zapier’s webhook documentation describe the relevant integration approach.

1. Choose what the Zap should generate

Before building the Zap, decide how DocRaptor will get the document and how the next action will use it.

Choice What you send or receive Use it when
HTML content Set document_content to HTML or XML in the request. The trigger data is used to assemble a document directly in the Zap.
Document URL Set document_url to a URL DocRaptor can retrieve. The source document already exists at a reachable URL.
Synchronous PDF DocRaptor returns PDF bytes. The next step accepts a file or binary document payload.
Hosted result With hosted enabled, the response is URL-oriented JSON. A downstream step needs a hosted document URL. Hosted documents are a paid add-on.
Asynchronous job The response includes a status_id to check later. The workflow can accommodate a separate status check or callback.

DocRaptor accepts pdf, xls, and xlsx as document types. This guide focuses on PDF generation. A successful request does not always produce a URL: the response depends on the selected synchronous, hosted, or asynchronous behavior. See the API reference and API overview when configuring response handling.

2. Build the Zap with Webhooks by Zapier

  1. Create a trigger. Choose the app and event that provides the data for the PDF, such as a new record or submitted form. Test the trigger and confirm that the sample record contains every field you plan to include.
  2. Add a Webhooks by Zapier action. Select POST. DocRaptor’s Zapier-specific instructions use the endpoint https://docraptor.com/docs and a JSON payload.
  3. Set the payload type to JSON. Add the document-generation fields below and map dynamic values from the trigger into your HTML or document URL.
  4. Configure Basic Authentication using the Zapier-specific instructions. DocRaptor’s guide says to use your API key followed immediately by | as the Basic Authentication key, with no spaces. Keep the API key private and do not put it in the document HTML.
  5. Test the action. Inspect the output to identify whether the result is PDF data, hosted JSON, or a status_id. Choose the next Zap action based on that actual response.
  6. Add the downstream action. Map the PDF as a file where supported, map the hosted URL from the returned JSON when using hosted mode, or add status retrieval/callback handling for an asynchronous request.

Important endpoint and authentication distinction

There are two official examples that should not be silently combined. The DocRaptor Zapier guide specifies https://docraptor.com/docs and its API-key-plus-pipe Basic Authentication setup. The general API overview describes posting JSON to https://api.docraptor.com/docs with the key as the Basic Authentication username and a blank password. Follow the Zapier-specific instructions for the walkthrough above. If you switch to the general API endpoint or build a request outside that documented Zap configuration, use the corresponding authentication instructions for that route and verify it against the current DocRaptor documentation.

3. Configure the request fields

Field Purpose Configuration notes
type Output format, such as pdf. Set to pdf for this workflow.
document_content HTML/XML supplied in the request. Use this or document_url as the document source. Escape or map dynamic data safely into HTML.
document_url URL of content DocRaptor retrieves. Use this instead of inline content when the document is already hosted and reachable by DocRaptor.
hosted Requests hosted-document behavior. The Zapier tutorial example uses hosted mode. Hosted documents are a paid add-on and return URL-oriented JSON rather than ordinary PDF bytes.
hosted_expires_at Optional hosted-document expiry control. Set only if the workflow needs an expiry time; consult the API reference for accepted value syntax.
hosted_download_limit Optional limit for hosted-document downloads. Set only if the workflow needs to restrict downloads.
javascript Enables JavaScript processing. JavaScript is disabled by default. Enable it only when the source document needs client-side rendering.
prince_options.media Selects print or screen media behavior. PDF generation defaults to print media rules. Consider screen if the rendered layout should use screen styles.

For print CSS, provide print-friendly styles in the HTML. If a site relies on client-side JavaScript, remember that JavaScript processing is off by default. DocRaptor’s API reference also documents additional Prince options; use that reference for the specific formatting, page, and rendering options your document requires rather than assuming browser print behavior.

4. Example Zap payloads

A minimal inline HTML request has the following JSON shape. In Zapier, replace the example content with mapped trigger fields using the editor’s field picker.

{
  "type": "pdf",
  "document_content": "<html><body><h1>Invoice</h1><p>Customer: Example Customer</p></body></html>"
}

The hosted pattern adds the hosted option used in DocRaptor’s Zapier example:

{
  "type": "pdf",
  "document_content": "<html><body><h1>Invoice</h1></body></html>",
  "hosted": true
}

Optional hosted controls can be added when needed:

{
  "type": "pdf",
  "document_content": "<html><body><h1>Invoice</h1></body></html>",
  "hosted": true,
  "hosted_expires_at": "YOUR_SUPPORTED_EXPIRATION_VALUE",
  "hosted_download_limit": 5
}

Use the accepted expiration format documented by DocRaptor before using hosted_expires_at. Do not assume the hosted settings apply to a non-hosted PDF response.

5. Test the PDF and map the response

Test with representative data, including long names, optional fields, special characters, and the largest expected content. DocRaptor says test documents are unlimited and do not count against monthly limits, but test PDFs carry a watermark. Test hosted documents are limited to five downloads and expire after one day. See the DocRaptor test-mode documentation for current details.

  • Non-hosted synchronous request: the response is document bytes. Confirm the next Zap action accepts the returned file data; do not map it as though it were a public URL.
  • Hosted synchronous request: the response is JSON with hosted-document information. Map the URL field actually returned by your test into the next step.
  • Asynchronous request: store the returned status_id, then poll the documented status endpoint or configure the optional callback URL flow. Do not try to pass the job ID to a step expecting a finished PDF.

6. Common errors and fixes

Symptom Likely cause Fix
Authentication failure The key format, endpoint, or Basic Authentication fields do not match the selected DocRaptor instructions. For the Zapier-specific route, use the API-key-plus-pipe format with no spaces and the guide’s endpoint. For the general API route, follow its username and blank-password pattern. Do not mix the two setups.
Missing document or invalid request type is absent, or neither document_content nor document_url is present. Set the output type and provide one valid content source. Check the tested Zap payload for empty mapped fields.
The next step cannot find a PDF URL A non-hosted synchronous request returned bytes, or an asynchronous request returned a job ID. Map the response that your mode produces. Enable hosted behavior only when a URL-oriented response is needed and the paid add-on is appropriate; otherwise route the binary file to a file-compatible action.
PDF layout differs from the website PDF generation uses print media rules by default, or the HTML relies on JavaScript that is disabled. Inspect print CSS and consider selecting screen media through the relevant Prince option. Enable JavaScript when the document needs it.
Content is missing or stale The document URL may not expose the expected content when DocRaptor retrieves it, or client-side rendering has not been enabled. Verify the source URL is reachable and contains the intended document; use inline content or enable JavaScript when needed.
Hosted test link stops working Test hosted documents expire after one day and allow five downloads. Generate a fresh test document. Validate the production hosted behavior separately under the applicable account setup.
Zap test output is difficult to map The selected response mode returns a different shape from the downstream action’s expected input. Run a test for the chosen mode and inspect its fields. If the next service requires a file but receives a URL or job ID, add the appropriate retrieval or polling step.

7. Reliability, speed, and cost considerations

  • Keep test and production expectations separate. Test PDFs are watermarked. Hosted test files have the documented expiry and download limits, so they are useful for mapping checks but not durable production assets.
  • Choose synchronous or asynchronous deliberately. Synchronous responses fit a straightforward Zap step when the result returns within the workflow’s request window. For longer-running jobs, DocRaptor documents asynchronous generation with a status_id, status polling, and an optional success callback. Build the later step around completion rather than assuming the PDF is immediately available.
  • Use hosted output only when it solves a downstream need. Hosted documents are a paid add-on. If a file payload is sufficient, the normal PDF response may better match a file-oriented next step.
  • Control rendering complexity. Large HTML documents, external assets, and JavaScript-dependent pages add work to generation. Keep the document source predictable and test a representative upper-bound document before relying on the Zap.
  • Budget around the services involved. DocRaptor states that test documents do not count against monthly limits. Check current DocRaptor plan limits and Zapier task usage in their respective accounts; the research available for this article does not establish current plan prices.

8. Or skip the browser setup

If your workflow needs a webpage screenshot rather than a generated, typeset PDF, ScreenshotNeo provides a one-request website screenshot API. Its API can return PNG, JPEG, WebP, or PDF, and its documentation lists capture options. For example, use this cURL request to save a page as WebP:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up free for ScreenshotNeo.

9. Frequently asked questions

Is DocRaptor a native Zapier app?

The documented method in DocRaptor’s Zapier guide uses Webhooks by Zapier to call the API. Treat this as an API workflow unless the current Zapier app directory shows otherwise.

Can a Zap send a URL instead of HTML?

Yes. The API accepts document_url as an alternative source to document_content; the URL must be accessible to DocRaptor.

Why does DocRaptor return a status ID instead of a PDF?

That is the asynchronous workflow. Use the status ID to retrieve completion status or configure the documented callback behavior, then handle the completed result.

Can I use this workflow for spreadsheets?

The API reference lists xls and xlsx as document types as well as pdf. Consult the current API reference for the required content and options for those formats.