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 inject endpoint returns all published schemas for a given page as a structured JSON response. The SchemaGen JavaScript SDK calls this endpoint automatically when it loads on your site, but you can also call it directly if you want to build a custom schema delivery layer or inspect what schemas are active for a specific URL.
This endpoint requires no authentication. It is a public CORS-enabled endpoint safe to call from browser JavaScript or any server environment.

Endpoint

GET https://schemagen.io/api/inject

Query parameters

clientId
string
required
The UUID of your client site. You can find your Client ID in Settings → Client in the SchemaGen dashboard.
url
string
required
The absolute URL of the page you want to fetch schemas for. Must include the protocol (e.g., https://example.com/blog/my-post). SchemaGen uses this to match published schemas scoped to that specific page.

Response

A successful request returns 200 with a JSON body containing the schemas for the given page.
schemas
object[]
An array of raw JSON-LD objects — one for each published schema matching the requested URL. These are the objects you can embed directly in <script type="application/ld+json"> tags.
items
object[]
An array of full schema delivery records. Each item includes the JSON-LD object along with metadata such as the schema name, type, and status.
meta
object

Response headers

HeaderDescription
X-Schemagen-DurationServer-side processing time in milliseconds (e.g., 42ms).
X-Schemagen-IDThe unique request ID, matching meta.requestId in the response body.
Cache-ControlAlways no-store, max-age=0. Responses are never cached to ensure schemas reflect the latest published state.

Code examples

curl -G "https://schemagen.io/api/inject" \
  --data-urlencode "clientId=your-client-uuid" \
  --data-urlencode "url=https://example.com/blog/my-post"

Example response

{
  "schemas": [
    {
      "@context": "https://schema.org",
      "@type": "Article",
      "headline": "How to use structured data for SEO",
      "author": {
        "@type": "Person",
        "name": "Jane Smith"
      },
      "datePublished": "2026-01-15"
    }
  ],
  "items": [
    {
      "id": "sch_01abc123",
      "name": "Blog post schema",
      "schemaType": "Article",
      "pageUrl": "https://example.com/blog/my-post",
      "status": "published",
      "jsonLd": {
        "@context": "https://schema.org",
        "@type": "Article",
        "headline": "How to use structured data for SEO",
        "author": {
          "@type": "Person",
          "name": "Jane Smith"
        },
        "datePublished": "2026-01-15"
      }
    }
  ],
  "meta": {
    "version": "1.2.0",
    "requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "serverTime": "2026-05-08T10:30:00.000Z"
  }
}

Error responses

StatusCauseResponse body
400clientId or url is missing or invalid.{ "error": "Validation failed", "details": {} }
500An unexpected server error occurred.{ "error": "Internal Server Error" }
If clientId is not a valid UUID or url is not an absolute URL, the API returns 400 immediately without attempting schema lookup. Double-check both values in your request.