> ## 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.

# Node.js

> Learn how to integrate using the Node.js SDK.

export const LearnMoreLink = ({title, href}) => {
  return <a href={href}>
      <span className="my-2.5 not-prose flex items-center text-primary space-x-2 font-medium">
        <Icon icon="book-open" color="#0D9373" />
        <span>{title}</span>
      </span>
    </a>;
};

## Install

Download the Node.js SDK using your favorite package manager.

<CodeGroup>
  ```bash npm theme={null}
  npm install @doczilla/node
  ```

  ```bash yarn theme={null}
  yarn add @doczilla/node
  ```

  ```bash pnpm theme={null}
  pnpm add @doczilla/node
  ```
</CodeGroup>

<Snippet file="package-requires-api-key.mdx" />

## Usage

```ts theme={null}
import Doczilla from '@doczilla/node'

const doczilla = new Doczilla('doczilla-...')

const pdfBuffer = await doczilla.pdf.direct({
  page: {
    html: '<div>Your first Doczilla PDF</div>'
  }
})
```

### Webhook signing

Doczilla can optionally sign the webhook events it sends to your endpoint, allowing you to validate that they were not
sent by a third party. You can read more about it [here](/examples/securing-webhooks).

Please note that you must pass the *raw* request body, exactly as received from Doczilla, to the `verifyPayload()`
function; this will not work with a parsed (i.e., JSON) request body.

```js theme={null}
const event = doczilla.webhooks.verifyPayload(
  webhookRawBody,
  webhookDoczillaSignatureHeader,
  webhookSecret
)
```

## Learn more

<LearnMoreLink title="Examples" href="/examples/introduction" />

<LearnMoreLink title="Different API endpoint types" href="/api-reference/introduction" />
