Docs/APIs/Website to PDF

Website to PDF

Convert website to PDF

OperationalCredits 20 per callp50 5140msDocumentsStar

Overview

Website to PDF works by converting the website provided into a PDF file. It uses advanced algorithms to convert the website into a PDF file and returns the PDF file.

Endpoint

One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.

POSThttps://api.apiverve.com/v1/websitetopdf
curl -X POST https://api.apiverve.com/v1/websitetopdf \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "marginTop": 0.4,
  "marginBottom": 0.4,
  "marginLeft": 0.4,
  "marginRight": 0.4,
  "landscape": false,
  "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts"
}'
const res = await fetch('https://api.apiverve.com/v1/websitetopdf', {
  method: 'POST',
  headers: {
    'x-api-key': 'your_api_key_here',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "marginTop": 0.4,
  "marginBottom": 0.4,
  "marginLeft": 0.4,
  "marginRight": 0.4,
  "landscape": false,
  "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts"
}),
});

if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);

const { data } = await res.json();
console.log(data);
import requests

res = requests.post(
    "https://api.apiverve.com/v1/websitetopdf",
    headers={"x-api-key": "your_api_key_here"},
    json={
    "marginTop": 0.4,
    "marginBottom": 0.4,
    "marginLeft": 0.4,
    "marginRight": 0.4,
    "landscape": False,
    "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts"
},
    timeout=15,
)
res.raise_for_status()

print(res.json()["data"])
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{
  "marginTop": 0.4,
  "marginBottom": 0.4,
  "marginLeft": 0.4,
  "marginRight": 0.4,
  "landscape": false,
  "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts"
}`)
	req, _ := http.NewRequest("POST", "https://api.apiverve.com/v1/websitetopdf", body)
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("x-api-key", "your_api_key_here")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}

Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.

Authentication

Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.

401 is the only auth verdict

A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.

Parameters

Sent as JSON in the request body. Premium parameters are accepted on every plan but only take effect on plans that include them.

ParameterTypeDescription
urlRequiredstringThe URL of the website to convert to PDF
url
marginTopOptionalPremiumnumberThe top margin of the PDF in inches (e.g., 0.4)
default 0.4
marginRightOptionalPremiumnumberThe right margin of the PDF in inches (e.g., 0.4)
default 0.4
marginBottomOptionalPremiumnumberThe bottom margin of the PDF in inches (e.g., 0.4)
default 0.4
marginLeftOptionalPremiumnumberThe left margin of the PDF in inches (e.g., 0.4)
default 0.4
landscapeOptionalPremiumbooleanSet to true for landscape orientation

Response

Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.

Sample response
{
  "status": "ok",
  "error": null,
  "data": {
    "marginLeft": "0.4in",
    "marginRight": "0.4in",
    "marginTop": "0.4in",
    "marginBottom": "0.4in",
    "landscape": false,
    "pdfName": "128deceb-c515-444b-8863-82cb3f6ba632.pdf",
    "expires": 1766097122116,
    "url": "https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts",
    "downloadURL": "https://storage.googleapis.com/apiverve-helpers.appspot.com/websitetopdf/128deceb-c515-444b-8863-82cb3f6ba632.pdf?GoogleAccessId=1089020767582-compute%40developer.gserviceaccount.com&Expires=1766097122&Signature=LI747FKqKj5i5TYX3KIoVy%2FHgXsLOSXfVEUM0Ekqz2SiiYOZWuk3Of7QBDUklSrcbjiHV0AjbzFTKt6oDU83UkN282HbmhxwrolN6v1Zb9twVi1y7gmTpapCiJi%2BpA1r89ioe%2Fe0%2FV7KrIWaqsorzpdJrnMqe2izMWBaZq%2FYkSO2qlwSyhg2R8EsfxYNAANtd%2FuNS0RuIzqTdhNCiTrRirnDAKS3dMCySQJRznHFnyqzNj1OXwVjvdpSMn9XhWCUa%2FDRR8q%2BE9B0yF8eTvIrDSe2OzJT%2FJLc9rxcLfXAny21gtNqrzMJPU4yM9Ge%2BEbepmDnNZf9xpODNsnq5eLF0g%3D%3D"
  }
}

Response fields

Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.

FieldTypeExampleDescription
marginLeftstring"0.4in"Left margin of generated PDF in inches
marginRightstring"0.4in"Right margin of generated PDF in inches
marginTopstring"0.4in"Top margin of generated PDF in inches
marginBottomstring"0.4in"Bottom margin of generated PDF in inches
landscapebooleanfalsePDF orientation mode (true for landscape)
pdfNamestring"128deceb-c515-444b-8863-82cb3f6ba632.pdf"Generated PDF filename with unique identifier
expiresnumber1766097122116PDF expiration timestamp in milliseconds
urlstring"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/concepts"Original source URL that was converted to PDF
downloadURLstring"https://storage.googleapis.com/apiverve-helpers.appspot.com/websitetopdf/128deceb-c515-444b-8863-82cb3f6ba632.pdf?GoogleAccessId=1089020767582-compute%40developer.gserviceaccount.com&Expires=1766097122&Signature=LI747FKqKj5i5TYX3KIoVy%2FHgXsLOSXfVEUM0Ekqz2SiiYOZWuk3Of7QBDUklSrcbjiHV0AjbzFTKt6oDU83UkN282HbmhxwrolN6v1Zb9twVi1y7gmTpapCiJi%2BpA1r89ioe%2Fe0%2FV7KrIWaqsorzpdJrnMqe2izMWBaZq%2FYkSO2qlwSyhg2R8EsfxYNAANtd%2FuNS0RuIzqTdhNCiTrRirnDAKS3dMCySQJRznHFnyqzNj1OXwVjvdpSMn9XhWCUa%2FDRR8q%2BE9B0yF8eTvIrDSe2OzJT%2FJLc9rxcLfXAny21gtNqrzMJPU4yM9Ge%2BEbepmDnNZf9xpODNsnq5eLF0g%3D%3D"Temporary signed URL for downloading the PDF file

Errors

Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.

StatusMeaningWhat to do
400Input was rejectedRead error; it names the parameter.
401Key missing or invalidCheck the header name and the key value.
403Key valid, but not permittedA key restriction or IP allow-list; see key scoping.
429Rate limited, or out of creditsRead error to tell them apart; see rate limits.

Other ways to use Website to PDF

Set up Website to PDF on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.

Give it to an AI agentConnect over MCP and your agent calls it as a native tool — Claude, Cursor, ChatGPT.VerveKitReference →

More in Documents:

Was this page helpful?