---
title: "Start a bulk fill"
method: POST
path: "/v1/documents/{id}/bulk-fill/"
tags: ["Bulk fill"]
---

# Start a bulk fill

`POST /v1/documents/{id}/bulk-fill/`

## Request

- Base URL: `https://api.pdfbetter.com`
- URL: `https://api.pdfbetter.com/v1/documents/{id}/bulk-fill/`
- Auth: HTTP bearer

One filled PDF per row (≤ 5,000 rows), zipped in parts of 500. `mapping` is field name → column name. Returns a job (202); poll Retrieve a job or listen for `bulk_job.completed`. `dryRun: true` validates rows and previews file names without using quota.

## Path parameters

- `id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `rows` object[], required
  - `mapping` object, required
  - `fileNameTemplate` string
  - `flatten` boolean
  - `dryRun` boolean

## Response `202`

Start a bulk fill

- Job
  - `object` 'job', required
  - `id` string, required
  - `type` 'bulk_fill', required
  - `documentId` string, required
  - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled', required
  - `rowCount` integer, required
  - `doneCount` integer, required
  - `succeededCount` integer, required
  - `failedCount` integer, required
  - `progress` integer, required: 0–100
  - `failedRows` object[], required
    - `row` integer, required
    - `error` string, required
  - `error` string, nullable, required
  - `createdAt` string, required: ISO 8601 timestamp (UTC)
  - `downloads` object[], required: Zip parts (≤ 500 rows each); links valid 15 minutes
    - `name` string, required
    - `url` string, required
    - `size` integer, required
    - `fromRow` integer, required
    - `toRow` integer, required

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