Quickstart

Generate your first PDF in under 5 minutes.

Quickstart

This guide will help you generate your first PDF in just a few steps.

Step 1: Get an API Key

  1. Create a free account
  2. Navigate to the API Keys page
  3. Click "Create New Key"
  4. Copy your API key (it starts with sk_live_)

Keep your API key secret! Never expose it in client-side code.

Step 2: Make Your First Request

Using cURL

curl -X POST https://api.pdfapi.dev/v1/pdf/markdown \
  -H "Authorization: Bearer sk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "# Hello World\n\nThis is my first PDF generated with PDF API!",
    "theme": "default"
  }' \
  --output my-first.pdf

Using JavaScript

const response = await fetch('https://api.pdfapi.dev/v1/pdf/markdown', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_live_your_key_here',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    markdown: '# Hello World\n\nThis is my first PDF!',
    theme: 'default',
  }),
});

const blob = await response.blob();
// Save or display the PDF

Using Python

import requests

response = requests.post(
    'https://api.pdfapi.dev/v1/pdf/markdown',
    headers={
        'Authorization': 'Bearer sk_live_your_key_here',
        'Content-Type': 'application/json',
    },
    json={
        'markdown': '# Hello World\n\nThis is my first PDF!',
        'theme': 'default',
    }
)

with open('my-first.pdf', 'wb') as f:
    f.write(response.content)

Step 3: Customize Your PDF

You can customize the output with various options:

{
  "markdown": "# My Document",
  "theme": "corporate",
  "options": {
    "format": "A4",
    "margin": {
      "top": "20mm",
      "bottom": "20mm",
      "left": "15mm",
      "right": "15mm"
    }
  }
}

Next Steps