🎉 Launch Alert BrewPDF is completely free during our early alpha phase. Discover more 1,003 PDF's created

Rest API REST API Documentation

Create PDF from HTML string

This endpoint allows you to convert HTML to a PDF document.


HTTP Request

POST https://brewpdf.com/api/create

Request Body

{
  "code": "String of HTML content to be converted into PDF."
}

Request Type

application/json

Response

The API will respond with the following:

  • Success: HTTP 200 OK with PDF file stream.
  • Failure: HTTP 4xx/5xx with a JSON response containing the error message.

Usage Example

curl -X POST brewpdf.com/api/create \
-H "Content-Type: application/json" \
-d '{"code": "<h1>Hello, World!</h1>"}' \
-o output.pdf

Create PDF from URL

This endpoint allows you to convert the content of a URL to a PDF document.


HTTP Request

POST https://brewpdf.com/api/create

Request Body

{
  "url": "URL of the webpage to be converted into PDF."
}

Request Type

application/json

Response

The API will respond with the following:

  • Success: HTTP 200 OK with PDF file stream.
  • Failure: HTTP 4xx/5xx with a JSON response containing the error message.

Usage Example

curl -X POST brewpdf.com/api/create \
-H "Content-Type: application/json" \
-d '{"url": "https://brewpdf.com"}' \
-o output.pdf

Create PDF from URL using GET

This endpoint allows you to convert the content of a URL to a PDF document using a GET request.


HTTP Request

GET https://brewpdf.com/api/create?url=[URL]

Parameters

url

The URL of the webpage to be converted into PDF. It should be URL encoded if necessary.


Response

The API will respond similarly to the POST requests:

  • Success: HTTP 200 OK with PDF file stream.
  • Failure: HTTP 4xx/5xx with a JSON response containing the error message.

Usage Example

curl "https://brewpdf.com/api/create?url=https%3A%2F%2Fexample.com" -o output.pdf
Ready to get started? Create PDF from HTML