Docs / Documents

Rendering

Documents

Every render and every PDF tool call is recorded as a document. The log is what you see under Documents in the dashboard, and you can read it through the API.

#The document object

{
  "object": "document",
  "id": "doc_nWWGc4ehhC44vpOsHFGn",
  "status": "succeeded",
  "format": "pdf",
  "url": "https://devilpdf.com/f/doc_nWWGc4ehhC44vpOsHFGn/invoice.pdf?exp=1773532800&sig=8fe4b5c6330ae0d9427ba7e78b54a66c",
  "filename": "invoice.pdf",
  "pages": 1,
  "bytes": 29384,
  "duration_ms": 412,
  "template": "invoice",
  "source": "template",
  "batch": null,
  "metadata": { "order_id": "8813" },
  "error": null,
  "expires_at": "2026-03-15T14:02:11.000Z",
  "created_at": "2026-03-14T14:02:10.588Z",
  "completed_at": "2026-03-14T14:02:11.000Z"
}

Field by field, it is described in the render reference.

#Get a document

curl https://devilpdf.com/v1/documents/doc_nWWGc4ehhC44vpOsHFGn \
  -H "Authorization: Bearer $DEVILPDF_API_KEY"

The url is signed again on every read, so fetch the document whenever you need a fresh link. A document that failed has "status": "failed" and an error with a type and message.

#List documents

curl "https://devilpdf.com/v1/documents?limit=25&status=succeeded" \
  -H "Authorization: Bearer $DEVILPDF_API_KEY"

Documents are returned newest first.

QueryDescription
limit1 to 100. Default 25.
beforeA document id. Returns documents older than this one.
statusqueued, processing, succeeded or failed.
templateA template id.
batchA batch id.
qSearch. Matches a document id exactly, or part of a filename or template name.
Response
{
  "object": "list",
  "data": [
    { "object": "document", "id": "doc_nWWGc4ehhC44vpOsHFGn", "status": "succeeded" }
  ],
  "has_more": true
}

#Pagination

When has_more is true, pass the id of the last document you received as before to get the next page.

let before;
do {
  const url = new URL("https://devilpdf.com/v1/documents");
  url.searchParams.set("limit", "100");
  if (before) url.searchParams.set("before", before);
  const page = await fetch(url, { headers: { Authorization: `Bearer ${process.env.DEVILPDF_API_KEY}` } }).then((r) => r.json());
  for (const doc of page.data) console.log(doc.id, doc.status);
  before = page.has_more ? page.data.at(-1).id : undefined;
} while (before);

url is a signed link on devilpdf.com. Anyone with the link can download the file until it expires, so treat it like the file itself. Add &download=1 to make browsers save the file instead of showing it.

How long a link lasts depends on your plan. Shorten it per request with expires_in.

PlanLinks and files kept for
Free24 hours
Starter7 days
Growth30 days
Business30 days
Scale30 days

After expires_at, the link stops working and the file is deleted. To keep files longer, download them when they are created, or deliver them to your own bucket.

#Delete a document's file

curl -X DELETE https://devilpdf.com/v1/documents/doc_nWWGc4ehhC44vpOsHFGn \
  -H "Authorization: Bearer $DEVILPDF_API_KEY"
Response
{ "object": "document", "id": "doc_nWWGc4ehhC44vpOsHFGn", "deleted": true }

This deletes the stored file immediately and removes the download link. The log entry stays, so your usage history is intact. Files delivered to your own bucket are not touched.

#Retention of the log

Log entries are kept for 90 days, then removed.