The Fontdue GraphQL API is the public read interface to your store. Every font, license, content page, article, and customer-facing setting your site can show is queryable through it, and a single request returns data shaped exactly the way you asked for it. Your site reads from it to render the catalog into your own HTML – the example template fetches every page’s data this way.
Your public endpoint is your site URL with /graphql appended:
The viewer root
Queries start from viewer, your store’s public context. The catalog hangs off it – fontCollections, pages, articles, licenses, settings, and a slug lookup for resolving a single collection by its slug. A query names the fields it wants and gets back those and nothing else:
query {
viewer {
fontCollections(first: 10) {
edges {
node {
name
fontStyles {
name
sku {
price {
amount
currency
}
}
}
}
}
}
}
}
This descends from the store, into its collections, into each collection’s styles, down to the price on each style’s SKU – and returns only those fields. If you need a collection’s description and images instead, you ask for those; the request shape and the response shape match. The GraphQL docs cover the query language itself.
Connections and arrays
Some fields, like fontCollections, resolve to a Connection – the edges → node wrapper in the query above. Connections support pagination, which a catalog needs once it grows past a single page: you request a page with arguments like first: 10 and read each item as edge.node.
Other lists resolve to a plain array rather than a connection – viewer.licenses, or a collection’s fontStyles – for lists that aren’t expected to need paging. Those you read directly, with no edges/node indirection. Which fields are connections and which are arrays is visible in the schema.
Previewing hidden content
By default the endpoint returns only what the public can see – a hidden collection is dropped from fontCollections, and fetching its slug resolves to nothing. A request authenticated as an admin can reveal hidden collections too, gated by the fontdue-preview request header:
fontdue-preview |
Effect on an admin request |
|---|---|
true |
Reveal hidden collections – explicit preview. |
false |
Keep them hidden – the same view the public gets. |
| (omitted) | Reveal hidden collections (legacy default). |
The header only matters in combination with an authenticated admin; an anonymous or customer request stays on the public view no matter what it sends.11The omitted-header default reveals hidden content to a signed-in admin, which is why the GraphQL Playground – and older clients and the script-tag embed, none of which send the header – surface hidden collections to an admin with no extra wiring. A server-rendered build that wants the strict public view on its cacheable pages sends fontdue-preview: false explicitly. Setting it by hand is rarely necessary: Admin preview wires the header and the admin token into a server-rendered site’s fetches for you.
Exploring the schema
The fastest way to see what’s queryable is the GraphQL Playground built into the admin – an interactive editor running against your own store, with the full schema browsable alongside. Draft and verify a query there, then wire it into your site with typed fetching.
fontdue-preview: false explicitly. ↩