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 — aDocumentation Index
Fetch the complete documentation index at: https://docs.schemagen.io/llms.txt
Use this file to discover all available pages before exploring further.
<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:| JS SDK | Embed API | |
|---|---|---|
| Setup | Add one <script> tag to <head> | Fetch a URL from your template or server |
| Rendering | Client-side, after page load | Server-side, in the initial HTML response |
| Best for | SPAs, headless frontends, any HTML site | WordPress, Shopify, PHP, AMP |
| Core Web Vitals | No impact on LCP/CLS, async loaded | Schema in initial HTML, zero JS overhead |
| Caching | CDN-cached SDK | Response cached with standard cache headers |
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
| Parameter | Required | Description |
|---|---|---|
clientId | Yes | Your SchemaGen client ID, found in Dashboard → Settings → Client ID |
url | Yes | The absolute URL of the page being rendered, URL-encoded |
<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
- WordPress PHP
- Shopify Liquid
- Generic PHP
- JavaScript fetch
Add this snippet to your theme’s Place this call inside
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
<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’sdata-client-id attribute:
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 theurl 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.