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

# Installation

> Install and configure the official Next.js SDK for Markpdf.

# Installation

Use `@markpdf/nextjs` for Next.js App Router projects. It keeps `MARKPDF_API_KEY` on the server and gives you Route Handler and Server Action helpers.

## Install

<CodeGroup>
  ```bash npm theme={null}
  npm install @markpdf/nextjs
  ```

  ```bash pnpm theme={null}
  pnpm add @markpdf/nextjs
  ```

  ```bash yarn theme={null}
  yarn add @markpdf/nextjs
  ```

  ```bash bun theme={null}
  bun add @markpdf/nextjs
  ```
</CodeGroup>

## Configure the API key

Create or update `.env.local`:

```bash theme={null}
MARKPDF_API_KEY=YOUR_API_KEY
```

Do not prefix it with `NEXT_PUBLIC_`.

## Minimal route handler

```ts app/api/convert/route.ts theme={null}
import { createConvertRouteHandler } from "@markpdf/nextjs";

export const POST = createConvertRouteHandler();
```

Your client component can upload a `FormData` file to `/api/convert`; the API key never reaches the browser.

## API endpoint

The production API endpoint is:

```text theme={null}
https://api.markpdf.tech
```

## Next step

Continue with [Quickstart](/docs/sdks/nextjs/quickstart).
