<script type="application/ld+json"> tags that you can insert directly into the <head> or <body> of any HTML page. This makes it the right choice for server-side rendering environments where you cannot run JavaScript to inject schemas at runtime.
This endpoint requires no authentication. It is a public CORS-enabled endpoint safe to call from any server environment.
When to use embed vs. inject
Use/api/embed when you are rendering pages on the server and want schemas included in the initial HTML response — for example, in a PHP template, a WordPress theme, a Shopify Liquid file, or an AMP page.
Use /api/inject (or the SchemaGen JavaScript SDK) when you are rendering pages in the browser and can inject schemas dynamically after the page loads.
Endpoint
Query parameters
string
required
The UUID of your client site. You can find your Client ID in Settings → Client in the SchemaGen dashboard.
string
required
The absolute URL of the page you want to fetch schemas for. Must include the protocol (e.g.,
https://example.com/products/widget).Response
A successful request returns200 with a Content-Type of text/html; charset=utf-8. The body is an HTML string containing one <script type="application/ld+json"> tag per published schema. If no schemas are published for the given URL, the body is an empty string.
Example response body
Response headers
Code examples
WordPress usage
Call the embed API in your theme’sfunctions.php and output the result in the <head> using the wp_head action:
Error responses
When the request is invalid or an error occurs, the embed endpoint returns an empty body with the appropriate HTTP status code. It does not return a JSON error body.
All error responses still include the
X-Schemagen-ID header so you can trace the request.