Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.schemagen.io/llms.txt

Use this file to discover all available pages before exploring further.

The SchemaGen SDK is a lightweight JavaScript snippet that connects your website to the Schema Delivery Network. When a visitor loads a page, the SDK reads the current URL, fetches any published schemas that match that page from SchemaGen’s edge network, and injects them into the DOM as <script type="application/ld+json"> tags — automatically, with no further action required from you. You install the SDK once. Every schema you publish, update, or pause from the dashboard takes effect immediately across all matching pages on your site.
The SDK is lightweight and edge-optimized. It loads asynchronously so it never blocks page rendering, and schema delivery is served from edge locations worldwide to minimize latency.

Find your Client ID

Before you install the SDK, locate your Client ID. This unique identifier tells the SDK which schemas to fetch for your site. To find it: in the SchemaGen dashboard, go to Settings → Client. Your Client ID is displayed there. Copy it — you’ll paste it into the SDK snippet below.

Install the SDK

Choose the installation method that matches your site setup.
Add the following snippet inside the <head> tag of every page on your site. If you use a shared layout or template file, add it there so it appears on all pages automatically.Replace YOUR_CLIENT_ID with the Client ID from your dashboard.
HTML
<script async
  src="https://schemagen.io/sdk.js"
  data-client-id="YOUR_CLIENT_ID">
</script>
Place the tag as early in the <head> as possible to give the SDK time to fetch schemas before the page finishes rendering.

How the SDK works

When the SDK loads on a page, it:
  1. Reads the current page URL from the browser.
  2. Sends a request to the SchemaGen inject API: GET /api/inject?clientId={clientId}&url={pageUrl}.
  3. Receives a list of published schemas matching that URL.
  4. Injects each schema as a <script type="application/ld+json"> tag into the page DOM.
Schemas are only delivered if they match the target URL you configured in the dashboard and have a Published status. Drafts and paused schemas are never delivered to the browser.

Verify the SDK is working

After installing the SDK, confirm it’s injecting schemas correctly.
1

Open DevTools

Navigate to a page where you have a published schema. Open your browser’s developer tools (press F12 or right-click → Inspect).
2

Check the Elements panel

In the Elements tab, search for application/ld+json (use Ctrl+F or Cmd+F to search within the DOM). You should see one or more <script type="application/ld+json"> tags containing your schema JSON.
3

Check the Network panel

In the Network tab, filter by Fetch/XHR and reload the page. Look for a request to schemagen.io/api/inject — this confirms the SDK is running and communicating with the SchemaGen edge network.
If you don’t see schemas being injected, double-check that the data-client-id attribute contains your correct Client ID, that the target URL in your dashboard exactly matches the page URL (including protocol and path), and that the schema has a Published status — not Draft or Paused.

Next steps

Quick start guide

Walk through creating and publishing your first schema end to end.

SDN overview

Learn how the Schema Delivery Network routes and caches schema delivery.

Publishing and lifecycle

Understand how Draft, Published, and Paused states affect schema delivery.

Domain locking

Restrict your Client ID to specific domains to prevent unauthorized use.