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

# Quickstart

> Generate your first PDF in under 5 minutes.

# Quickstart

Get from zero to a generated PDF in 5 minutes.

## 1. Get an API Key

Sign up at [app.getdeckle.dev](https://app.getdeckle.dev) and copy your API key from the dashboard. It starts with `dk_live_`.

## 2. Install the SDK

<CodeGroup>
  ```bash npm theme={null}
  npm install @getdeckle/sdk
  ```

  ```bash pip theme={null}
  pip install deckle
  ```
</CodeGroup>

## 3. Generate Your First PDF

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Deckle } from '@getdeckle/sdk';

  const df = new Deckle(process.env.DECKLE_API_KEY);

  const pdf = await df.generate({
    html: `
      <h1>Hello from Deckle</h1>
      <p>This took 30 seconds, not 3 days.</p>
    `,
    options: { format: 'A4' }
  });

  console.log(pdf.url);
  ```

  ```python Python theme={null}
  from deckle import Deckle

  df = Deckle("dk_live_...")

  pdf = df.generate(
      html="<h1>Hello from Deckle</h1><p>This took 30 seconds, not 3 days.</p>",
      options={"format": "A4"}
  )

  print(pdf.url)
  ```
</CodeGroup>

## 4. Use Templates

Create a reusable template and merge data on each call:

```typescript theme={null}
// Create a template
const template = await df.templates.create({
  name: 'Invoice',
  html_content: `
    <h1>Invoice for {{company}}</h1>
    <table>
      {{#each items}}
      <tr>
        <td>{{description}}</td>
        <td>{{qty}} × ${{rate}}</td>
      </tr>
      {{/each}}
    </table>
    <h2>Total: ${{total}}</h2>
  `
});

// Generate from template
const pdf = await df.fromTemplate({
  template: template.id,
  data: {
    company: 'Acme Corp',
    items: [{ description: 'Consulting', qty: 10, rate: 150 }],
    total: 1500
  }
});
```

## 5. Add Headers & Footers

```typescript theme={null}
const pdf = await df.generate({
  html: invoiceHTML,
  options: {
    format: 'A4',
    margin: { top: '1in', bottom: '1in', left: '0.75in', right: '0.75in' },
    header: '<div style="font-size:10px;text-align:center">Acme Corp</div>',
    footer: '<div style="font-size:10px;text-align:center">Page {{pageNumber}} of {{totalPages}}</div>'
  }
});
```

## Next Steps

* [Authentication](/authentication) — Learn about API key management
* [API Reference](/api-reference/generate) — Full endpoint documentation
* [Guides](/guides/nextjs) — Framework-specific tutorials
