Skip to content

34. Schema Export API

Klariton generates Schema.org markup (JSON-LD) from your scanned content. The Schema Export API lets your website fetch that markup server-side and render it into your own pages. The result: structured data in your HTML source, visible to AI crawlers such as GPTBot, ClaudeBot and PerplexityBot, which do not execute JavaScript.

Do not inject this markup with a tag manager or any client-side script. Crawlers without JavaScript will never see it.

EndpointReturns
GET https://worker.klariton.com/v1/schema/{org-slug}Index: all available pages with their schema URLs
GET https://worker.klariton.com/v1/schema/{org-slug}/{page-slug}One ready-to-embed JSON-LD document (application/ld+json)

No authentication, no API key. Responses are cacheable (Cache-Control: max-age=300) and carry a strong ETag; conditional requests with If-None-Match return 304.

A single @graph with:

NodeNotes
OrganizationYour organization name and production domain
BreadcrumbListHome → page, using your page URLs
Service or ProductDerived from your industry setting in Klariton (consulting/services orgs get Service semantics without SKU or stock status)
FAQPageOnly if your org publishes FAQ schema and the page has published Q&As

The document is final. Embed it as-is — do not modify, merge or re-build it client-side.

// In a Server Component, e.g. app/services/[slug]/page.tsx
async function fetchSchema(slug: string): Promise<object | null> {
try {
const res = await fetch(
`https://worker.klariton.com/v1/schema/YOUR_ORG_SLUG/${slug}`,
{ next: { revalidate: 300 }, signal: AbortSignal.timeout(2000) },
);
return res.ok ? await res.json() : null;
} catch {
return null; // fail open — the page must never depend on the schema
}
}
// In the JSX, only when jsonLd is not null:
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>

The same pattern works in any server-rendered stack: fetch during rendering or build, cache for a few minutes, embed on success, skip silently on failure.

Prefer the SDK helper. Since @klariton/beacon 0.3.0 the same fetch is packaged as fetchKlaritonSchema(org, product) (fail-open, framework-agnostic) — see the Reach Beacon SDK. Either way, render server-side: AI crawlers do not run JavaScript, so client-injected JSON-LD is invisible to them.

SituationWhat to do
API slow or unreachableTimeout (1–2 s) + catch → render the page without schema
404 (Klariton does not know the page)Render without schema. No error, no log spam
5xxSame as above

The schema is progressive enhancement. It must never block or delay your page.

Call the index endpoint once — it lists every page Klariton knows, including its schemaUrl and last update. Map your routes against it (each document also carries the original page URL inside the markup). Pages missing from the index have not been scanned yet.

Content edits in Klariton Studio propagate to the API within minutes (edge cache plus automatic invalidation on product updates). New or renamed pages on your website appear after the next material scan of your site in Klariton Studio.

  • Crawlable sitemap surface: Klariton also serves your pages as crawlable HTML with the same markup on your dedicated subdomain (for example agents.your-domain.com), referenced from your robots.txt via a Sitemap: line. This works without any code change on your site — the Schema Export API is the additional step that puts the markup on your main domain.
  • See “14. Developers” for widget embedding and the read API.