---
title: "Create a document"
method: POST
path: "/v1/documents/"
tags: ["Documents"]
---

# Create a document

`POST /v1/documents/`

## Request

- Base URL: `https://api.pdfbetter.com`
- URL: `https://api.pdfbetter.com/v1/documents/`
- Auth: HTTP bearer

From a multipart upload (`file`, up to ~4 MB per request — use an upload for larger files), an https `url` (≤ 50 MB; private addresses refused, redirects not followed), a library `template` slug, or an `uploadId`. Same file-size, page and encryption checks as the app.

## Headers

- `Idempotency-Key` string

## Request body

- union
  - object
    - `url` string, required: https URL of a PDF (≤ 50 MB). Private and internal addresses are refused; redirects aren't followed.
    - `title` string
  - object
    - `template` string, required: Library template slug (see GET /v1/templates/)
    - `title` string
  - object
    - `uploadId` string, required: From POST /v1/uploads/ after you PUT the file
    - `title` string

## Response `201`

Create a document

- Document
  - `object` 'document', required
  - `id` string, required
  - `title` string, required
  - `kind` 'document' | 'template' | 'form', required
  - `status` 'draft' | 'completed' | 'archived', required
  - `pageCount` integer, required
  - `tags` string[], required
  - `folderId` string, nullable, required
  - `sourceName` string, nullable, required
  - `sourceSize` integer, nullable, required
  - `createdFromTemplate` string, nullable, required: Library template slug or user template id this document was created from
  - `createdAt` string, required: ISO 8601 timestamp (UTC)
  - `updatedAt` string, required: ISO 8601 timestamp (UTC)

## Other responses

- `400`: Invalid request (see `error.details.issues`)
- `401`: Missing or invalid API key
- `402`: Your plan doesn't include this (API access needs Business) or a monthly allowance is used up
- `403`: The API key lacks the required scope
- `404`: Not found (or not yours)
- `409`: Conflict with the current state
- `422`: Validation failed
- `429`: Rate limited — see RateLimit-* and Retry-After

---

[API](https://skmtc.dev/pdfbetter/apis/pdfbetter-api.md) · [All operations](https://skmtc.dev/pdfbetter/apis/pdfbetter-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pdfbetter/apis/pdfbetter-api/revisions/6960b18754a8?raw)
