Skip to content
CastPDF

Generate PDFs from your own code

CastPDF is one HTTPS endpoint, so any language that can send a POST request can make a PDF. Pick your language or framework below for a working example, the libraries people usually compare it with, and a checklist for production. You only need a free test key, and test PDFs never count towards your plan.

Start here, whatever you write

Every page below uses the same API. You send POST https://api.castpdf.com/v1/pdf with your key in the Authorization header and a JSON body. The body holds either HTML, or the ID of a template you saved plus the data to fill it. The answer is the PDF itself, or a private download link if you ask for one.

Do I need an SDK?

No. We do not publish SDKs yet, and you do not need one. Each example uses the HTTP client your language already has, such as fetch, requests, net/http or HttpClient. That keeps your dependencies short and the code easy to read in a review.

Rendering is limited to 30 seconds and 50 pages per PDF. Set your client's timeout to at least 60 seconds, and send an Idempotency-Key header so a retry never makes, or bills, a second document.

Make your first PDF in 5 minutes

Pick a template, add your details and download your PDF. You get 100 free PDFs every month, and you don’t need a card.