API Documentation

Convert HTML to PDF with a simple API call. Get started in minutes.

Authentication

All API requests require an API key. Include it in the Authorization header:

Authorization: Bearer sf_pdf_your_api_key_here

Get your free API key →

Base URL

https://pdf.siteforge.build/v1

Endpoints

POST /v1/convert

Convert HTML to PDF.

Request Body

FieldTypeDescription
htmlstringHTML content to convert (required if no url)
urlstringURL to fetch and convert (required if no html)
optionsobjectPDF options (optional)

Options

FieldTypeDefaultDescription
formatstring"Letter"Page format: A4, Letter, Legal
landscapebooleanfalseLandscape orientation
marginobject{}Page margins: {top, bottom, left, right}
filenamestring"document.pdf"Downloaded filename

Example Request

curl -X POST https://pdf.siteforge.build/v1/convert \
  -H "Authorization: Bearer sf_pdf_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<h1>Hello World</h1><p>This is my PDF.</p>",
    "options": {
      "format": "A4",
      "margin": {
        "top": "1in",
        "bottom": "1in"
      }
    }
  }' \
  -o document.pdf

Response

Returns the PDF file directly with Content-Type: application/pdf

GET /v1/usage

Get your usage statistics for the current billing period.

Example Request

curl https://pdf.siteforge.build/v1/usage \
  -H "Authorization: Bearer sf_pdf_your_api_key"

Example Response

{
  "plan": "free",
  "period": "2026-02",
  "currentMonth": {
    "conversions": 42,
    "totalBytes": 15728640,
    "avgProcessingMs": 1250,
    "estimatedCost": "0.00"
  },
  "limits": {
    "monthly": 100,
    "remaining": 58
  }
}

Rate Limits

PlanConversions/MonthRate Limit
Free10010/minute
Pay As You GoUnlimited60/minute
Pro2,000 included120/minute

Error Codes

CodeMeaning
400Bad request — check your input
401Unauthorized — invalid or missing API key
429Rate limit exceeded or monthly limit reached
500Server error — try again or contact support
💡 Free Tier Note: Free tier PDFs include a small "Generated by SiteForge PDF" watermark. Upgrade to Pay As You Go ($0.02/conversion) to remove it.

Need Help?

Email us at [email protected]