Adds a render endpoint to configured collections that sends a document to the API and stores the resulting PDF, PNG, JPEG or WebP file in an upload collection. A read-only sidebar group links to the latest file. It requires a account and API key, and Payload 3.37 or newer.
Payload CMS plugin that renders a document to PDF or image with the thirds.ai API and stores the file in an upload collection.
Installation
npm i payload-plugin-thirds-render0
Stars
0
Forks
0
Open Issues
1 months ago
Last Updated
0
Weekly Downloads
v
npm Version
Dependencies
00 since Oct 25
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
| Oct 31, 2026 | 0 |
| Oct 30, 2026 | 0 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 0 |
| Oct 25, 2026 | 0 |
Trends appear after 7 days of data. Daily snapshots have not started yet.
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1439784509-root)<a href="https://payloaddirectory.dev/plugins/1439784509-root"><img src="https://payloaddirectory.dev/badge/1439784509-root.svg" alt="Payload Directory"></a>README
(Disclosure: I'm connected to thirds.ai.) Drafted with AI help.
A Payload CMS plugin that renders a document to a PDF or an image with the thirds.ai API and stores the file in an upload collection.
The plugin requires a thirds.ai account and API key.
POST /api/<collection>/:id/thirds-render to each configured collection.thirds-renders collection that the plugin adds (live-tested), or an existing upload collection (tested against a local stand-in, not the live API).thirdsRender group to the document sidebar. It links to the latest file and shows the thirds.ai job id, the format and the render time. Checked through the REST API; the admin panel view is not yet live-tested.Idempotency-Key built from the document content, so rendering an unchanged document again reuses the earlier job.Version 1 has no publish hook and no background jobs. A render runs only when the endpoint is called.
^3.37.0. Tested against the live API on 3.92.1. Tested on 3.37.0 against a local stand-in, not the live API.THIRDS_API_KEY, or passed as apiKey.The package is not on npm yet. Install it from GitHub:
npm install github:thirdsai/payload-plugin-thirds-render#v0.1.0
The built files in dist/ are part of the repository, so no build step runs on install.
// payload.config.ts
import { buildConfig } from 'payload'
import { thirdsRenderPlugin } from 'payload-plugin-thirds-render'
export default buildConfig({
// ...
plugins: [
thirdsRenderPlugin({
collections: {
invoices: {
filename: ({ doc }) => `invoice-${doc.number}`,
pdf: { format: 'A4', margins: { bottom: '16mm', left: '16mm', right: '16mm', top: '16mm' } },
image: { width: 1200, height: 630 },
},
posts: true,
},
}),
],
})
THIRDS_API_KEY=... # read when a render runs, never logged
The plugin adds a thirdsRender field group to each listed collection and, unless uploadsCollection is set, a thirds-renders upload collection. Run your usual migration step after adding it.
curl -X POST "http://localhost:3000/api/invoices/42/thirds-render?format=pdf" \
-H "Authorization: JWT <token>"
Query parameters:
| Parameter | Values | Default |
|---|---|---|
format | pdf, png (live-tested), jpeg, webp (not yet live-tested) | defaultFormat, else pdf |
force | true skips the stored file check and calls thirds.ai | off |
draft | true renders the latest draft (not yet live-tested) | off |
locale | any configured locale (localized collections not yet live-tested) | the request locale |
Response:
{
"id": 7,
"url": "/api/thirds-renders/file/invoice-42.pdf",
"filename": "invoice-42.pdf",
"mimeType": "application/pdf",
"filesize": 16811,
"format": "pdf",
"jobId": "pdf_0123456789abcdef0123456789abcdef",
"credit": "settled",
"idempotencyKey": "payload-...",
"sha256": "...",
"replayed": false,
"reused": false
}
id and url belong to the upload document. The same file is linked from the sidebar of the source document.
The Idempotency-Key is a hash of the collection, the document id, the locale, the draft flag, the format and the exact request body. The default HTML leaves out id, createdAt, updatedAt, _status and thirdsRender, so saving the document without changing its content keeps the same key.
reused: true and makes no API call.force=true, unchanged document: the endpoint calls thirds.ai with the same key. thirds.ai returns the earlier job (replayed: true) without rendering again, within its 24 hour replay window. A new upload document is stored with the same bytes.A custom html or template.data function that adds timestamps or other values that change on every save gives a new key every time.
| Option | Type | Notes |
|---|---|---|
collections | Record<slug, true | CollectionRenderConfig> | Required. Collections that get the endpoint and the sidebar field. |
uploadsCollection | string | Slug of an existing upload collection (tested against a local stand-in, not the live API). When omitted the plugin adds thirds-renders. |
uploadData | ({ doc, req, format, collection }) => object | Extra data for the upload document, such as a required alt field (tested against a local stand-in, not the live API). |
rendersCollection | (collection) => collection | Changes the added thirds-renders collection, for example its upload.staticDir or access. |
access | ({ doc, id, req }) => boolean | Who may render. See Access. Not yet live-tested. |
apiKey | string | Default process.env.THIRDS_API_KEY. |
baseUrl | string | Default process.env.THIRDS_API_BASE, else https://thirds.ai. |
timeoutMs | number | Whole request including polling. Default 60000. The timeout path is not yet live-tested. |
disabled | boolean | Removes the endpoint. The fields and the collection stay so the schema does not change. |
CollectionRenderConfig:
| Option | Notes |
|---|---|
defaultFormat | pdf, png, jpeg or webp. |
formats | Formats this collection accepts. Default all four. |
html | ({ doc, req, format, collection }) => string. Replaces the default layout. Not yet live-tested. |
template | { id, version?, data? }. Renders a saved thirds.ai template with data({ doc, ... }). Not yet live-tested (the request shape is checked against the public API schema only). |
pdf | thirds.ai PDF options: format, width, height, margins, landscape, print_background, scale, display_header_footer, header_template, footer_template, title, author, subject. Live-tested: format, margins, print_background, title; the others are not yet live-tested. |
image | thirds.ai image options: width (320 to 7680), height (200 to 4320), quality, transparent. The format comes from the request. Live-tested at 1200x630; other sizes, quality and transparent are not yet live-tested. |
filename | ({ doc, ... }) => string. Default <collection>-<id>. |
The default layout prints the useAsTitle field as a heading, then each visible field with its label. Values are HTML escaped. Fields with hidden or admin.hidden are left out. Lexical rich text is converted with @payloadcms/richtext-lexical/html when that package is installed, and printed as plain paragraphs otherwise (the plain paragraph fallback is not yet live-tested).
By default a user may render a document when logged in and allowed to update it under the collection's own update access, including access functions that return a query. The document is read with overrideAccess: false, so read access and field access apply to what is rendered. Set access to replace the update check (not yet live-tested).
The thirdsRender group cannot be written through the API. Only the plugin sets it.
| Status | Meaning |
|---|---|
| 400 | Unknown format, or thirds.ai refused the request body. |
| 401 | Not logged in. |
| 403 | Not allowed to read or render the document. |
| 404 | Document not found. |
| 409 | The same idempotency key was sent with a different request. Tested against a local stand-in, not the live API. |
| 422 | The render failed at thirds.ai. The body has the error code. Not yet live-tested. |
| 429 | Rate limited by thirds.ai. Not yet live-tested. |
| 500 | THIRDS_API_KEY is not set. Tested against a local stand-in, not the live API. |
| 502 | thirds.ai rejected the key or was unavailable, or the file could not be stored. Not yet live-tested. |
| 504 | The render did not finish within timeoutMs. Not yet live-tested. |
force=true stores a new upload document each time. Older upload documents are left in place.Tested against the live thirds.ai API on Payload 3.92.1 with sqlite, over the REST API:
thirds-renders collection, with the sidebar link and the upload metadata.force=true replaying the same job.Tested against a local stand-in, not the live API: storage in an existing upload collection with uploadData, a changed document giving a new job, the thirdsRender group not being writable over REST, the 500 for a missing key, and the 409 for a reused key. The same suite passed on Payload 3.37.0 and 4.0.0-beta.5.
Not yet live-tested: JPEG and WebP, saved templates (the request shape is only checked against the public API schema), a custom html function, the access option, drafts, localized collections, a render that fails at thirds.ai (422), the 429, 502 and 504 responses, and the plain paragraph fallback for rich text without @payloadcms/richtext-lexical. The sidebar group was checked through the REST API, not by eye in the admin panel.
npm test runs the unit tests in test/ against a local stand-in of the thirds.ai API (test/mock-thirds.mjs). No API key is needed and nothing is rendered.
MIT
Topics
payloadcms plugin image optimizer
Client-side resize, ThumbHash blur placeholders, filename strategies and bulk regeneration on top of Payload's sharp…
79666/wk27v3
payload plugin aspect preview
Live multi-aspect-ratio previews with crop and focal point editing for Payload upload collections
78174/wk6v3
payload storage sanity
Store Payload media uploads in Sanity Content Lake with crops, focal points and video posters
721.2k/wk0v3
blur data urls
Generate blur placeholder data URLs automatically for images uploaded to Payload media collections
66139/wk84v3
payload og image
Generates versioned Open Graph share cards from Payload content, served through a Next.js route
64605/wk1v3 v4
image framing
Non-destructive crop and focus areas for Payload uploads, with per-usage overrides and responsive framing
6080/wk2v3