Prismic integration

Generate PDFs from Prismic

Connect Quaterio to your Prismic repository, bind document fields to block-based templates and render paginated PDFs. Public repos work without auth; private ones use an access token in the URL.

The problem

Prismic gives writers a clean visual editor and a flexible content model. PDF output is one channel it does not own. Teams end up building Next.js routes that render a print-styled version of the page, exporting to Puppeteer and watching every Slice Machine update break the print layout.

How Quaterio handles it

Quaterio's Prismic connector queries /api/v2/documents/search with the current ref and drops document fields into a Remote Content block. Predicate queries pass through on the URL. The ref handshake is explained step by step so the connection keeps working as you publish.

How it works

  1. 1

    Find the current master ref

    Open https://{your-repo}.cdn.prismic.io/api/v2 in a browser. The JSON response has a refs array; copy the ref value where isMasterRef is true. This is the version pointer for the latest published content.

  2. 2

    Pick the Prismic preset in Connections

    Settings → Connections → New Connection → pick "Prismic" from the type dropdown. Replace yourrepo with your repository name and paste the master ref into the ?ref= parameter. For private repos add &access_token={token} to the URL.

  3. 3

    Hit Detect Fields to confirm the shape

    Quaterio fetches /documents/search and shows the JSON paths. Default is results.0.data, the data object of the first document. Drill into specific fields with results.0.data.{fieldName} as needed.

  4. 4

    Generate the PDF via the editor or API

    Export from the editor for one-offs. For batch jobs hit POST /api/v1/generate/template with the template ID. The connector re-fetches at generation time so every PDF reflects the latest Prismic publish (within the CDN refresh window).

What the connector handles

  • Document API /api/v2/documents/search with ref-based versioning
  • Public, public-master-only and private access modes all supported
  • Optional access token in the URL for private repos
  • Predicate query language (q parameter) for filtering by type, field or date
  • CDN-cached reads via {repo}.cdn.prismic.io for speed
  • Document by UID lookup via the q parameter for deterministic single-doc templates
  • Image fields with url and thumbnail variants bind directly to image blocks
  • Honest about Rich Text: returned as JSON blocks, not HTML
  • Detect Fields walks the response so you can pick paths in the editor
  • 15 second fetch timeout, cached on the block when the API is slow or unreachable

Generate via API

# 1. Create the connection via the dashboard (one-time setup). # 2. Bind a template's Remote Content block to it. # 3. Generate a PDF that pulls live Prismic content: curl -X POST https://quaterio.com/api/v1/generate/template \ -H "Authorization: Bearer q_your_token" \ -H "Content-Type: application/json" \ -d '{ "templateId": "prismic_document_export" }' # → { # "ok": true, # "data": { "downloadUrl": ".../document_en_a7f3b2c1.pdf" } # } # The connector hits /api/v2/documents/search?ref={ref} at generation # time and renders the bound document field into the template block.

Available on Business plan and above.

Prismic and PDF: the real questions

The Prismic preset queries /api/v2/documents/search with a ref query parameter. Refs are how Prismic versions content, every fetch needs the current master ref attached. The sections below explain the two-step ref handshake, the Rich Text gotcha, access modes and how to keep the connector working without daily maintenance.

The ref system, why this is a two-step process

Prismic versions every published change with a ref. The Document API refuses to return content without a ?ref= parameter. To get the current ref you first hit https://{repo}.cdn.prismic.io/api/v2, the response contains a refs array; the master ref is the one with isMasterRef: true.

For static templates you can paste the current master ref into the URL once and it works until the next publish. For long-running connections that should always reflect the latest content, fetch the master ref first via the API endpoint, then build a second Quaterio connection that points at /documents/search?ref={the fresh ref}. This is the main complexity Prismic adds compared to other CMSes.

Three access modes (and which one you have)

Prismic repos can be configured in three modes. Open API: all published content is public, no token needed. Public API for Master only (the default for new repos): master ref is public, releases need a token. Private API: every request needs a token.

For PDF generation against the master ref the default mode works without auth, leave the access_token blank. For private repos or release previews, generate a token (npx prismic token create) and append &access_token={token} to the URL.

Rich Text comes back as JSON blocks, not HTML

Prismic Rich Text fields are returned as arrays of typed blocks. Each block has type ("paragraph", "heading1", "image", etc.), text content and a spans array for inline formatting. The API does not return HTML.

Two workable paths today. First, prefer Key Text fields for prose that does not need formatting, they return as plain strings and bind cleanly. Second, render Rich Text to HTML in your own service using @prismicio/helpers (asHTML) and store the result as a separate field. Native Rich Text JSON to HTML conversion inside the connector is on the roadmap.

Document object structure

Each result in the search response is a document with id, uid (your slug), type (the custom type name), lang and a data object that contains the actual fields. The default Response Field results.0.data picks the first document's data object, useful for inspection. Drill further with results.0.data.{fieldName} for a specific field.

For querying a specific document by UID, switch to the document-by-uid endpoint: /documents/search?ref={ref}&q=[[at(my.{type}.uid, "{uid}")]]. The q parameter uses Prismic's predicate query language. URL-encode it carefully, square brackets, parens and quotes all need escaping.

Predicate queries for filtering

Prismic's predicate syntax lives in the q parameter as an array of expressions. Examples: q=[[at(document.type, "blog_post")]] limits to one type; q=[[at(my.blog_post.category, "news")]] filters by field; q=[[date.after(document.last_publication_date, "2026-01-01")]] filters by date.

The full operator list (at, not, in, fulltext, similar, date.after, number.gt, ...) is in the Prismic docs. Build complex queries in their REST API browser first and copy the URL, saves manual encoding errors.

Image and link resolution

Image fields return as objects with a url field and optional thumbnail variants. Link fields return as objects with id, type, uid, lang and link_type, the URL needs resolution against your route mapping unless it is an external link.

For PDF templates the image url field binds directly to a Quaterio image block. For document links you need to project the destination URL yourself, either via a routing helper in your application or by hardcoding the target slug field in your template.

Rate limits and caching

Prismic does not publish a strict rate limit for the Document API on standard plans. The .cdn.prismic.io host is edge-cached, so cached reads are essentially unlimited. For burst PDF generation the standard Quaterio batch concurrency (5) is well within safe range.

After publishing changes in Prismic the CDN takes a few seconds to invalidate. PDFs generated within that window may show stale content; if exact freshness matters, bypass the cache by using the API host (api.prismic.io rather than cdn.prismic.io).

Pricing and plan tier

CMS connections are part of the Quaterio Business plan and above ($30/mo). Pro plans get the editor and basic templates but not the Remote Content block. Free and Pro users who try to add a Remote Content block see an upgrade prompt.

Prismic has a free Community plan suitable for small projects. Paid plans start at $7/mo per seat (Starter). The Content API is included on every Prismic tier; there is no per-call cost from Quaterio.

Try the Prismic connector free

Set up the connection in two minutes. No credit card required to start.