Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Get an API credential from the HTML-to-PDF provider you choose, then send it exactly where that provider’s documentation requires. There is no universal “HTML to PDF API key” format: one service may use an X-API-Key header, another a token-prefixed Authentication header, and Adobe’s documented REST example uses both a client ID and a bearer token. Keep credentials on your server, match the provider’s input and endpoint, and handle the response according to whether it returns PDF bytes, a download URL, or a job ID.

What an HTML-to-PDF API key does—and why the format varies

An API key or token identifies your application to a particular service. It does not define a standard URL, header, request body, or PDF response. Those details belong to the provider’s API. The examples below illustrate distinct documented patterns; do not mix one provider’s credential with another provider’s endpoint.

  • pdfmyhtml documents a single API key sent in an X-API-Key header.
  • HTML PDF API documents Authentication: Token <token>.
  • Adobe’s HTML-to-PDF REST example uses a client ID in x-api-key and a separate access token in Authorization: Bearer <token>.

These are examples, not a ranking or a complete comparison of current plans. Pricing, quotas, account eligibility, regions, retention, and credential controls were not established as comparable facts. Check the provider’s current documentation and account pages for those details.

Get credentials from the provider you selected

Sign in to the chosen service and follow its current account or dashboard instructions. For example, pdfmyhtml says to generate a key in its dashboard. Adobe’s example describes a client ID and client secret for its SDK setup, and its REST example also requires a bearer token. The credential-creation steps and the exact credentials available depend on the service and account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Before writing code, identify the provider’s documented values for:

  • the API endpoint and HTTP method;
  • the required key, token, or combination of credentials;
  • the authentication header name and exact value format;
  • the accepted input type, such as HTML, a public URL, or a file;
  • whether the result is returned immediately or through a job/download workflow.

Store the key as a server-side secret

Do not put a live API key or secret in browser JavaScript, a public repository, a mobile app bundle, or a page delivered to users. A visitor can inspect client-side code and copy credentials, then use them outside your application. Make the API request from a server you control and load credentials from an environment variable or an equivalent secret-management configuration.

Adobe’s SDK example uses PDF_SERVICES_CLIENT_ID and PDF_SERVICES_CLIENT_SECRET environment variables. The variable names in your own application may differ; follow the selected provider’s instructions and do not assume Adobe’s credential names apply elsewhere.

If a credential is exposed, use the provider’s current account controls and documentation to replace or disable it. The exact revocation and rotation process is provider-specific.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Send HTML to pdfmyhtml with an API key

pdfmyhtml documents this HTML conversion endpoint: POST https://api.pdfmyhtml.com/v1/html-to-pdf. Its example sends JSON containing an html string and supplies the key in X-API-Key. The following uses the documented wait=true mode, which waits for completion and returns a download URL.

curl -X POST "https://api.pdfmyhtml.com/v1/html-to-pdf" 
  -H "Content-Type: application/json" 
  -H "X-API-Key: YOUR_API_KEY" 
  -d '{"html":"<h1>Hello World!</h1>","wait":true}'

Replace YOUR_API_KEY with a credential created for your pdfmyhtml account. This header and endpoint are specific to pdfmyhtml; they are not a general HTML-to-PDF convention. Avoid placing a real key in a command saved to shell history or shared logs. For an automated server workflow, load it from your server’s secret configuration.

Choose synchronous or asynchronous processing

According to pdfmyhtml’s documentation, wait=true waits for the conversion and returns a download URL. With wait=false, the documented default, the response provides a job ID to poll. Use the mode that fits your request duration and application flow. In asynchronous mode, use the provider’s own job-status instructions and do not treat the initial job ID as a PDF file or download URL.

Other providers require different request formats

HTML PDF API: token authentication and selectable input

HTML PDF API documents the header format Authentication: Token <token>. Its PDF endpoint accepts one of url, file, or html; select the input mode supported by your use case and follow its documentation for the required body and response handling. Its example writes the returned PDF bytes to a file. Do not substitute the pdfmyhtml X-API-Key header or endpoint for this service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Its reference says a 401 can indicate a missing or invalid token. That is useful when diagnosing this provider’s authentication, but it should not be assumed to describe every provider’s status codes or error body.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Adobe PDF Services: client ID plus bearer token

Adobe’s documented HTML-to-PDF REST request uses a client ID in x-api-key and an access token in Authorization: Bearer .... The illustrated request also includes an uploaded asset ID and operation fields. This is not a one-key example: obtain and supply the values the Adobe documentation requires for your chosen REST or SDK workflow. The environment-variable names above apply to the cited SDK example, not to other services.

Handle the response according to its type

“The API returned something” does not necessarily mean the response body is a PDF. Confirm the selected provider’s documented success response and inspect what your request actually received before saving it with a .pdf extension.

  • PDF bytes: write the response body as binary data. Do not decode it as ordinary text or pass it through a JSON parser.
  • Download URL: make the follow-up download request described by the provider and save its response as binary PDF data.
  • Job ID: poll the provider’s documented status mechanism until the job finishes, then follow its result or download instructions.
  • Error response: retain the HTTP status and provider response details in server logs without logging secrets. A JSON error body is not a PDF, even if the request was sent to a conversion endpoint.

HTML PDF API’s example demonstrates saving PDF bytes to a file. pdfmyhtml documents a download URL for its waiting mode and a job ID for its default non-waiting mode. Other providers can return different structures, so build response handling around the selected provider’s reference rather than assuming these examples are interchangeable.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common key and conversion failures

Authentication is rejected

  • Check that the credential belongs to the account and service behind the endpoint.
  • Verify the exact header name, capitalization as documented, token prefix, and whether the request needs one credential or multiple values.
  • For HTML PDF API, its reference identifies a missing or invalid token as a possible cause of a 401.
  • Do not paste secrets into a public issue or share a complete authorization header while asking for help.

The service rejects the request body

  • Confirm the endpoint and HTTP method for the selected input mode.
  • Set the content type required by the provider. The pdfmyhtml example uses Content-Type: application/json and an html field.
  • Check that the request uses a supported input field. HTML PDF API documents a choice among url, file, or html, rather than requiring all three.
  • Ensure HTML embedded in JSON is validly escaped for the language or shell used to construct the request.

The response is not a usable PDF

  • Check whether the provider returned a download URL or job ID rather than file bytes.
  • For asynchronous conversion, follow the documented polling and completion flow before attempting a download.
  • Check the HTTP status and response body before saving; an error payload should not be named as a PDF.

Compare providers on the details that affect your integration

Before committing to an implementation, compare the current official documentation and account details for the specific service you plan to use.

Decision What to verify Why it matters
Credential shape One key, a token with a required prefix, or multiple credentials Determines your secret configuration and authentication headers.
Input mode Raw HTML, public URL, or an uploaded file/archive Changes how you prepare, upload, or expose the source content.
Processing and result Immediate PDF bytes, a download URL, or asynchronous job and polling Determines whether the caller can wait for completion or needs a background workflow.
Account and operational terms Current price, quota, region availability, retention terms, and key controls These vary by provider and were not established as comparable values here; check the live account and documentation pages.

Or skip the browser setup

ScreenshotNeo is a website screenshot API, not an HTML-to-PDF conversion service. Use it when the result you need is a screenshot image of a web page rather than a PDF. Its API accepts a URL in one GET request; see the ScreenshotNeo documentation for request options.

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 known cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers indicate the page verdict and billing status. An MCP server provides screenshot tools for AI agents. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does an HTML-to-PDF API key work with every provider?

No. Credentials are provider-specific and may require different headers, token formats, or multiple values.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can a screenshot API return a PDF?

Some screenshot services offer PDF output, but ScreenshotNeo’s API example here returns a screenshot image; it is not an HTML-to-PDF converter.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.