Skip to main content
The SchemaGen Embed API is an alternative schema delivery method for environments where the JavaScript SDK is not suitable. Instead of loading a client-side script, your CMS template or server fetches a URL from SchemaGen at request time and injects the returned HTML — a <script type="application/ld+json"> tag containing your deployed schema — directly into the page <head> before it reaches the browser. This approach avoids any JavaScript dependency for schema delivery, which benefits server-rendered CMS platforms, AMP pages, and sites where minimizing JavaScript execution is a priority for Core Web Vitals.

JS SDK vs Embed API

Use this table to decide which delivery method fits your setup:
The Embed API response is cached by SchemaGen’s edge infrastructure using standard HTTP cache headers. Fetching it server-side on every page request is fast and will not add meaningful latency to your page load times.

The embed endpoint

Parameters: Response: Plain HTML containing one or more <script type="application/ld+json"> tags for every schema you have published for that URL. If no schemas are deployed for that URL, the response is empty — your page renders normally with no errors.

Code examples

Add this snippet to your theme’s functions.php or directly in the <head> section of header.php. It uses WordPress’s built-in HTTP API to fetch the schema and echoes the result into the page head.
header.php
Place this call inside <head>...</head> so the structured data is included in the initial HTML document.

How to find your client ID

Your client ID is a UUID assigned to your SchemaGen account. Find it in Dashboard → Settings → Client ID. It is the same identifier used in the JS SDK’s data-client-id attribute:
Both the SDK and the Embed API use the same client ID — if you are migrating from one delivery method to the other, no changes are needed to your schema configurations in the dashboard.

How schema matching works

When the Embed API receives a request, it looks up all schemas you have published for the exact URL provided in the url parameter. Make sure the URL you pass matches the canonical URL of the page as you have configured it in the SchemaGen dashboard. Including or excluding trailing slashes, query strings, or www inconsistently will result in no schemas being returned.
Always pass the canonical URL of the page — the same URL you used when deploying the schema in the dashboard. For WordPress, this is get_permalink(). For Shopify, use the canonical_url variable as shown in the Liquid example.