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

# Using Doczilla with AI

> Give your coding assistant the API docs and render model output as a PDF or screenshot.

## Give your assistant the API docs

Share the [plain-text documentation index](https://docs.doczilla.app/llms.txt) with your coding assistant. It links to the quickstart, endpoints, and examples.

```text theme={null}
Use the Doczilla API docs at https://docs.doczilla.app/llms.txt.

Build a Node.js function that renders a PDF report from a reusable HTML template. Pass the report content as template data, read DOCZILLA_API_KEY on the server, and return the PDF bytes.
```

## Render a summary as a PDF

Keep the HTML template in your application. Pass text from your model through `page.templateData`. The double braces escape HTML in the summary before rendering.

Get an API key in [Settings → General](https://doczilla.app/login) and set `DOCZILLA_API_KEY` in your server environment.

```javascript render-summary.js theme={null}
export async function renderSummaryPdf(summary) {
  const apiKey = process.env.DOCZILLA_API_KEY
  if (!apiKey) {
    throw new Error('DOCZILLA_API_KEY is missing')
  }

  const template = '<h1>Summary</h1><p>{{summary}}</p>'
  const htmlTemplate = Buffer.from(template, 'utf8').toString('base64')
  const endpoint = 'https://api.doczilla.app/v1/pdf'

  const response = await fetch(endpoint, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      page: { htmlTemplate, templateData: { summary } },
      pdf: { format: 'a4' }
    })
  })

  if (!response.ok) {
    throw new Error(`Doczilla returned HTTP ${response.status}`)
  }

  return Buffer.from(await response.arrayBuffer())
}
```

Send the returned bytes with `Content-Type: application/pdf` or save them to a file. See the [PDF endpoint reference](https://docs.doczilla.app/api-reference/endpoint/pdf.md) for print and layout options.

## Capture a page for visual review

Call [Create screenshot](https://docs.doczilla.app/api-reference/endpoint/screenshot.md) with a URL in `page.url` or Base64-encoded HTML in `page.html`. For a web page, you can set the viewport or capture a specific element before passing the image to your review tool.

* [Quickstart](https://docs.doczilla.app/quickstart.md)
* [Templating guide](https://docs.doczilla.app/templating/introduction.md)
* [Screenshot options](https://docs.doczilla.app/api-reference/screenshot-options.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.