Documents API: Create, List, and Manage Generated Documents

Last updated March 23, 2026

Complete API reference for creating, retrieving, updating, and deleting documents in PDFMonkey.

Quick start

Generation is asynchronous: you create a document, then check its status until it’s ready.

# 1. Create a document and queue it for generation
curl https://api.pdfmonkey.io/api/v1/documents \
  -X POST \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "document": {
      "document_template_id": "YOUR_TEMPLATE_ID",
      "status": "pending",
      "payload": { "name": "Jane Doe" }
    }
  }'
# Returns a document with "status": "pending" and "download_url": null

# 2. Poll the document status until it reaches "success"
curl -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  https://api.pdfmonkey.io/api/v1/document_cards/DOCUMENT_ID
# Once status is "success", read the download_url from the response

Setting "status": "pending" queues the document for generation immediately. The file isn’t ready yet at this point — you need to poll the document or set up a webhook to know when it’s done. Once the status reaches success, the download_url field contains a signed link to the generated file.

Read on for the full details, including the synchronous endpoint that waits for the result in a single request.

Authentication

All requests require a Bearer token in the Authorization header:

Authorization: Bearer YOUR_SECRET_KEY

See Authentication for how to find your API key and manage access tokens.

Create a document

POST /api/v1/documents

Creates a new document. Set status to "pending" to queue generation immediately, or omit it (defaults to "draft") to generate later.

Parameters

All parameters are nested under a document key.

NameTypeRequiredDescription
document_template_idString (UUID)YesID of the template to use for generation.
payloadObject or StringNoThe dynamic data used to build the document. Must be a JSON object (not an array). Can be passed as a JSON object or a JSON string.
metaObject or StringNoMetadata to attach to the document. Supports special keys like _filename. Must be a JSON object. Max 200 KB.
statusStringNo"draft" (default) or "pending". Set to "pending" to trigger generation on creation.
Set "status": "pending" in your create request to generate the document in one step. Without it, the document is created as a draft and you must update it later to trigger generation.

Request

curl https://api.pdfmonkey.io/api/v1/documents \
  -X POST \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "document": {
      "document_template_id": "2903f5b4-623b-4e10-b2e3-dc7e2e67ea39",
      "status": "pending",
      "payload": {
        "clientName": "Peter Parker",
        "orderDate": "2050-03-14",
        "products": [
          { "name": "Spider silk", "quantity": 12, "unitPrice": 123.50 },
          { "name": "Spandex fabric", "quantity": 2, "unitPrice": 28.90 }
        ]
      },
      "meta": {
        "_filename": "2050-03-14 Peter Parker.pdf",
        "clientRef": "spidey-616"
      }
    }
  }'

Response

{
  "document": {
    "id": "a5e86d72-f5b7-43d4-a04e-8b7e08e6741c",
    "app_id": "d6b4e8f2-7a3c-4d1e-9f5b-2c8a1d3e6f90",
    "checksum": "c230530f6f0aa32900af0924cf228e5c",
    "created_at": "2050-03-13T12:34:56.181+02:00",
    "document_template_id": "2903f5b4-623b-4e10-b2e3-dc7e2e67ea39",
    "download_url": null,
    "failure_cause": null,
    "filename": null,
    "generation_logs": [],
    "meta": {
      "_filename": "2050-03-14 Peter Parker.pdf",
      "clientRef": "spidey-616"
    },
    "output_type": "pdf",
    "payload": {
      "clientName": "Peter Parker",
      "orderDate": "2050-03-14",
      "products": [
        { "name": "Spider silk", "quantity": 12, "unitPrice": 123.50 },
        { "name": "Spandex fabric", "quantity": 2, "unitPrice": 28.90 }
      ]
    },
    "preview_url": "https://preview.pdfmonkey.io/pdf/web/viewer.html?file=...",
    "public_share_link": null,
    "status": "pending",
    "updated_at": "2050-03-13T12:34:56.181+02:00"
  }
}

Validation errors

If required fields are missing or invalid, the API returns a 422 Unprocessable Entity:

{
  "errors": {
    "document_template_id": ["can't be blank"]
  }
}

Synchronous generation

POST /api/v1/documents/sync

A convenience wrapper that creates a document and polls for completion server-side, so you get the finished result in a single request. The response is a DocumentCard (not a Document). For a guided walkthrough, see Generate Documents with the API.

This endpoint accepts the same parameters as Create a document. You must set "status": "pending" for generation to start.

When to use sync vs async

AsyncSync
ResponseReturns immediatelyWaits until generation completes
Getting the resultPoll or use webhooksIncluded in the response
Response objectDocumentDocumentCard
Scales to high volumeYesNo — one open request per document
TimeoutNone6 minutes
Best forProduction pipelines, batch generationLow-volume or interactive use cases
The sync endpoint will wait up to 6 minutes for generation to complete. For production pipelines or batch generation, prefer async generation with webhooks.

Request

curl https://api.pdfmonkey.io/api/v1/documents/sync \
  -X POST \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "document": {
      "document_template_id": "2903f5b4-623b-4e10-b2e3-dc7e2e67ea39",
      "status": "pending",
      "payload": {
        "clientName": "Peter Parker",
        "orderDate": "2050-03-14",
        "products": [
          { "name": "Spider silk", "quantity": 12, "unitPrice": 123.50 },
          { "name": "Spandex fabric", "quantity": 2, "unitPrice": 28.90 }
        ]
      },
      "meta": {
        "_filename": "2050-03-14 Peter Parker.pdf",
        "clientRef": "spidey-616"
      }
    }
  }'

Response

The sync endpoint returns a DocumentCard, not a Document. The result is nested under document_card and does not include payload or generation_logs.
{
  "document_card": {
    "app_id": "d6b4e8f2-7a3c-4d1e-9f5b-2c8a1d3e6f90",
    "created_at": "2050-03-13T12:34:56.181+02:00",
    "document_template_id": "2903f5b4-623b-4e10-b2e3-dc7e2e67ea39",
    "document_template_identifier": "My Invoice Template",
    "download_url": "https://pdfmonkey.s3.eu-west-1.amazonaws.com/production/backend/document/a5e86d72-f5b7-43d4-a04e-8b7e08e6741c/2050-03-14-peter-parker.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
    "failure_cause": null,
    "filename": "2050-03-14 Peter Parker.pdf",
    "id": "a5e86d72-f5b7-43d4-a04e-8b7e08e6741c",
    "meta": {
      "_filename": "2050-03-14 Peter Parker.pdf",
      "clientRef": "spidey-616"
    },
    "output_type": "pdf",
    "preview_url": "https://preview.pdfmonkey.io/pdf/web/viewer.html?file=...",
    "public_share_link": null,
    "status": "success",
    "updated_at": "2050-03-13T12:34:59.412+02:00"
  }
}

The Document object

The Document object is the full representation of a generated document, including its payload and generation logs.

{
  "id": "a5e86d72-f5b7-43d4-a04e-8b7e08e6741c",
  "app_id": "d6b4e8f2-7a3c-4d1e-9f5b-2c8a1d3e6f90",
  "checksum": "c230530f6f0aa32900af0924cf228e5c",
  "created_at": "2050-03-13T12:34:56.181+02:00",
  "document_template_id": "2903f5b4-623b-4e10-b2e3-dc7e2e67ea39",
  "download_url": "https://pdfmonkey.s3.eu-west-1.amazonaws.com/production/backend/document/a5e86d72-f5b7-43d4-a04e-8b7e08e6741c/2050-03-14-peter-parker.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
  "failure_cause": null,
  "filename": "2050-03-14 Peter Parker.pdf",
  "generation_logs": [
    {
      "type": "info",
      "message": "Starting PDF generation.",
      "timestamp": "Thu, 13 Mar 2050 10:34:57 GMT"
    },
    {
      "type": "info",
      "message": "Generation took 1617ms to load and render.",
      "timestamp": "Thu, 13 Mar 2050 10:34:58 GMT"
    },
    {
      "type": "info",
      "message": "Content size is 96302.",
      "timestamp": "Thu, 13 Mar 2050 10:34:59 GMT"
    }
  ],
  "meta": {
    "_filename": "2050-03-14 Peter Parker.pdf",
    "clientRef": "spidey-616"
  },
  "output_type": "pdf",
  "payload": {
    "clientName": "Peter Parker",
    "orderDate": "2050-03-14",
    "products": [
      { "name": "Spider silk", "quantity": 12, "unitPrice": 123.50 },
      { "name": "Spandex fabric", "quantity": 2, "unitPrice": 28.90 }
    ]
  },
  "preview_url": "https://preview.pdfmonkey.io/pdf/web/viewer.html?file=...",
  "public_share_link": "https://files.pdfmonkey.io/share/72BE2293-D130-4C19-9E11-C82B5CEA8C37/2050-03-14-peter-parker.pdf",
  "status": "success",
  "updated_at": "2050-03-13T12:34:59.412+02:00"
}

Attributes

NameTypeDescription
idString (UUID)Unique identifier for the document.
app_idString (UUID)Unique identifier of the document’s workspace.
checksumStringInternal checksum used for preview rendering.
created_atString (ISO 8601)Timestamp when the document was created.
document_template_idString (UUID)ID of the template used to generate this document.
download_urlString (URL) or nullTemporary signed URL to download the generated file. null until generation succeeds. Valid for 1 hour (see Download URLs).
failure_causeString or nullReason for generation failure. null unless status is failure.
filenameString or nullName of the generated file. null until generation succeeds. Controllable via the _filename meta key.
generation_logsArrayLogs collected during generation. Each entry has type ("info" or "error"), message, and timestamp. Empty array before generation starts.
metaObject or nullArbitrary metadata attached to the document. Supports special keys like _filename. Also accessible in no-code integrations (Zapier, Make) where payload is not available.
output_typeStringOutput format: "pdf" or "image". Inherited from the template.
payloadObject or nullThe dynamic data used to generate the document.
preview_urlString (URL)URL for embedding a visual preview of the document. Intended for use in an <iframe>, not for downloading.
public_share_linkString (URL) or nullPermanent public link to the generated file. Only available when the Share Links feature is enabled (Pro+ plans).
statusStringCurrent status of the document: draft, pending, generating, success, or failure. See Document Statuses and Lifecycle.
updated_atString (ISO 8601)Timestamp when the document was last updated.

The DocumentCard object

The DocumentCard is a lightweight version of the Document. It contains the same fields except payload, generation_logs, and checksum. It also adds document_template_identifier.

Use DocumentCards when you do not need the full payload, they are faster and lighter. They are the object returned by list endpoints, the sync endpoint, webhooks, and no-code integrations.

Prefer DocumentCard over Document.

Store any data you need later in meta instead of (or in addition to) payload. That way you will never need to fetch the full Document object.
{
  "id": "a5e86d72-f5b7-43d4-a04e-8b7e08e6741c",
  "app_id": "d6b4e8f2-7a3c-4d1e-9f5b-2c8a1d3e6f90",
  "created_at": "2050-03-13T12:34:56.181+02:00",
  "document_template_id": "2903f5b4-623b-4e10-b2e3-dc7e2e67ea39",
  "document_template_identifier": "My Invoice Template",
  "download_url": "https://pdfmonkey.s3.eu-west-1.amazonaws.com/production/backend/document/a5e86d72-f5b7-43d4-a04e-8b7e08e6741c/2050-03-14-peter-parker.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
  "failure_cause": null,
  "filename": "2050-03-14 Peter Parker.pdf",
  "meta": {
    "_filename": "2050-03-14 Peter Parker.pdf",
    "clientRef": "spidey-616"
  },
  "output_type": "pdf",
  "preview_url": "https://preview.pdfmonkey.io/pdf/web/viewer.html?file=...",
  "public_share_link": "https://files.pdfmonkey.io/share/72BE2293-D130-4C19-9E11-C82B5CEA8C37/2050-03-14-peter-parker.pdf",
  "status": "success",
  "updated_at": "2050-03-13T12:34:59.412+02:00"
}

Attributes

NameTypeDescription
idString (UUID)Unique identifier for the document.
app_idString (UUID)Unique identifier of the document’s workspace.
created_atString (ISO 8601)Timestamp when the document was created.
document_template_idString (UUID)ID of the template used to generate this document.
document_template_identifierStringThe name of the template as displayed in the dashboard.
download_urlString (URL) or nullTemporary signed URL to download the generated file. null until generation succeeds. Valid for 1 hour.
failure_causeString or nullReason for generation failure. null unless status is failure.
filenameString or nullName of the generated file. null until generation succeeds.
metaObject or nullArbitrary metadata attached to the document.
output_typeStringOutput format: "pdf" or "image". Inherited from the template.
preview_urlString (URL)URL for embedding a visual preview. Not for downloading.
public_share_linkString (URL) or nullPermanent public link. Requires Share Links (Pro+ plans).
statusStringCurrent status: draft, pending, generating, success, or failure.
updated_atString (ISO 8601)Timestamp when the document was last updated.

Comparison: Document vs DocumentCard

FieldDocumentDocumentCard
payloadIncludedNot included
generation_logsIncludedNot included
checksumIncludedNot included
document_template_identifierNot includedIncluded

Get a document

GET /api/v1/document_cards/{id}

Returns a DocumentCard for the given document. This is the recommended way to check generation status and retrieve the download URL.

curl -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  https://api.pdfmonkey.io/api/v1/document_cards/a5e86d72-f5b7-43d4-a04e-8b7e08e6741c

Response: 200 OK with a document_card object.

Get a full Document

GET /api/v1/documents/{id}

Returns the full Document, including payload and generation_logs. Use this only when you need those fields.

curl -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  https://api.pdfmonkey.io/api/v1/documents/a5e86d72-f5b7-43d4-a04e-8b7e08e6741c

Response: 200 OK with a document object.

List documents

GET /api/v1/document_cards

Returns a paginated list of DocumentCards. Results are limited to 24 items per page.

Query parameters

NameTypeDescription
page[number]IntegerPage number (default: 1).
q[document_template_id]String (UUID) or ArrayFilter by one or more template IDs. Accepts a single UUID or a comma-separated list.
q[status]StringFilter by status: draft, pending, generating, success, or failure. See Document Statuses.
q[workspace_id]String (UUID)Filter by workspace ID.
q[updated_since]TimestampOnly return documents updated after this point in time. Accepts a Unix timestamp (e.g. 1640995200 for 2022-01-01 00:00:00 UTC) or an ISO 8601 string.
q[search]StringSearch by document ID or filename. If the value is a UUID, matches by exact ID; otherwise performs a partial match on filename.
curl -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  'https://api.pdfmonkey.io/api/v1/document_cards?q[document_template_id]=2903f5b4-623b-4e10-b2e3-dc7e2e67ea39&q[status]=success&page[number]=1'

Response

{
  "document_cards": [
    {
      "id": "a5e86d72-f5b7-43d4-a04e-8b7e08e6741c",
      "app_id": "d6b4e8f2-7a3c-4d1e-9f5b-2c8a1d3e6f90",
      "created_at": "2050-03-13T12:34:56.181+02:00",
      "document_template_id": "2903f5b4-623b-4e10-b2e3-dc7e2e67ea39",
      "document_template_identifier": "My Invoice Template",
      "download_url": "https://pdfmonkey.s3.eu-west-1.amazonaws.com/...",
      "failure_cause": null,
      "filename": "2050-03-14 Peter Parker.pdf",
      "meta": {
        "_filename": "2050-03-14 Peter Parker.pdf",
        "clientRef": "spidey-616"
      },
      "output_type": "pdf",
      "preview_url": "https://preview.pdfmonkey.io/pdf/web/viewer.html?file=...",
      "public_share_link": null,
      "status": "success",
      "updated_at": "2050-03-13T12:34:59.412+02:00"
    }
  ],
  "meta": {
    "current_page": 1,
    "next_page": null,
    "prev_page": null,
    "total_pages": 1
  }
}

The meta object contains pagination information:

FieldTypeDescription
current_pageIntegerThe current page number.
next_pageInteger or nullThe next page number, or null if this is the last page.
prev_pageInteger or nullThe previous page number, or null if this is the first page.
total_pagesIntegerTotal number of pages available.

Update a document

PUT /api/v1/documents/{id}

Updates an existing document. You can change its payload, meta, or trigger generation by setting status to "pending".

Parameters

All parameters are nested under a document key.

NameTypeRequiredDescription
document_template_idString (UUID)NoChange the template.
payloadObject or StringNoReplace the dynamic data.
metaObject or StringNoReplace the metadata.
statusStringNoSet to "pending" to trigger generation.
curl https://api.pdfmonkey.io/api/v1/documents/a5e86d72-f5b7-43d4-a04e-8b7e08e6741c \
  -X PUT \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "document": {
      "status": "pending",
      "payload": { "name": "Mary Jane Watson" }
    }
  }'

Response: 200 OK with the updated document object.

Delete a document

DELETE /api/v1/documents/{id}

Permanently deletes a document and its generated file.

curl https://api.pdfmonkey.io/api/v1/documents/a5e86d72-f5b7-43d4-a04e-8b7e08e6741c \
  -X DELETE \
  -H 'Authorization: Bearer YOUR_SECRET_KEY'

Response: 204 No Content with an empty body.

Download URLs

Download URLs are temporary signed S3 links, valid for 1 hour. To get a fresh URL after expiration, fetch the document again — no need to regenerate it. For permanent links, enable Share Links (Pro+ plans).

See Download URL for details on expiration, best practices, and troubleshooting.

Frequently asked questions

How do I generate a document with the PDFMonkey API?
Send a POST request to /api/v1/documents with your template ID and dynamic data. Set status to "pending" to queue generation immediately. Then poll the document status or use webhooks to know when the file is ready to download.
What is the difference between Document and DocumentCard in PDFMonkey?
A Document is the full object including payload, generation_logs, and checksum. A DocumentCard is a lighter version without those fields but with document_template_identifier added. Use DocumentCards when you don't need the payload.
Does PDFMonkey support synchronous document generation?
Yes. POST to /api/v1/documents/sync to create a document and wait for the result in a single request. The endpoint has a 6-minute timeout and returns a DocumentCard.
How long is a PDFMonkey download URL valid?
Download URLs are temporary signed S3 URLs valid for 1 hour. After expiration, fetch the document again to get a fresh URL -- no need to regenerate.