> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdfdyno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Generate your first PDF in under 2 minutes.

Follow this no-bullshit guide to generate your first PDF using the PDFDyno API.

## 1. Get your API Key

To authenticate your requests, you need an API key.
Grab your free API key from the [PDFDyno Dashboard](https://pdfdyno.com/login). No credit card required.

Your API key will look like this: `sk_live_12345abcdef...`

## 2. Make your first request

Our API expects a JSON payload containing two things:

1. `data`: The JSON data you want to inject into your PDF.
2. `template`: The raw Typst markup string.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.pdfdyno.com/v1/pdf/generate \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "template": "= Hello #data.name!",
      "data": {
        "name": "Developer"
      }
    }' \
    --output result.pdf
  ```

  ```javascript Node.js theme={null}
  import fs from 'fs';

  async function generatePdf() {
    const response = await fetch('https://api.pdfdyno.com/v1/pdf/generate', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        template: "= Hello #data.name!",
        data: { name: "Developer" }
      })
    });

    if (!response.ok) throw new Error(`API error: ${response.status}`);

    const buffer = Buffer.from(await response.arrayBuffer());
    fs.writeFileSync('result.pdf', buffer);
    
    console.log('Successfully generated result.pdf in 40ms!');
  }

  generatePdf();
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.pdfdyno.com/v1/pdf/generate"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
  }
  data = {
      "template": "= Hello #data.name!",
      "data": {
          "name": "Developer"
      }
  }

  response = requests.post(url, headers=headers, json=data)

  if response.status_code == 200:
      with open("result.pdf", "wb") as f:
          f.write(response.content)
      print("Successfully generated result.pdf in 40ms!")
  else:
      print(f"Error: {response.status_code}")
  ```
</CodeGroup>

<Warning>
  **Important:** The response body is raw PDF bytes with `Content-Type: application/pdf`. Do not call `response.json()` in your code, or it will crash. Use `.arrayBuffer()` instead.
</Warning>

## 3. Done.

Open `result.pdf` on your machine. It's that simple.

Next, head over to our [Template Gallery](/templates/index) to grab ready-to-use templates for invoices, tickets, and certificates.
