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 generate endpoint builds a valid JSON-LD object from a Schema.org type name and a set of field values you provide. You can call it without authentication as a guest, or as an authenticated user to apply generation against your account’s usage quota and benefit from higher rate limits. This endpoint is useful when you want to programmatically generate structured data — for example, as part of a content publishing pipeline or a custom schema tooling workflow.

Endpoint

POST https://schemagen.io/api/generate

Request body

type
string
required
The Schema.org type name to generate (e.g., Article, Product, LocalBusiness, FAQPage). The value must match a type supported by SchemaGen. If the type is unrecognized, the API returns 400 with a list of supported types.
data
object
required
An object containing the field values for the schema. The accepted fields depend on the type you specify. Required fields for the given type must be present or the API returns a validation error.

Response

jsonLd
object
The generated JSON-LD object, ready to embed in a <script type="application/ld+json"> tag. Includes @context set to https://schema.org and @type matching the requested type.

Code examples

curl -X POST "https://schemagen.io/api/generate" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "Article",
    "data": {
      "headline": "How structured data improves SEO",
      "author": "Jane Smith",
      "datePublished": "2026-05-08",
      "url": "https://example.com/blog/structured-data-seo"
    }
  }'

Example response

{
  "jsonLd": {
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": "How structured data improves SEO",
    "author": {
      "@type": "Person",
      "name": "Jane Smith"
    },
    "datePublished": "2026-05-08",
    "url": "https://example.com/blog/structured-data-seo"
  }
}

Error responses

400 — invalid type

If you pass an unsupported type, the API returns 400 with a message listing valid types:
{
  "error": "Invalid or missing schema type. Supported types: Article, Product, LocalBusiness, ..."
}

400 — validation failed

If your data object is missing required fields or contains invalid values for the given type, the API returns 400 with a structured breakdown:
{
  "error": "Validation failed",
  "details": {
    "headline": {
      "_errors": ["Required"]
    }
  }
}

429 — rate limit exceeded

{
  "error": "Too many requests. Please wait a moment."
}

403 — usage limit reached

Authenticated users whose plan quota is exhausted receive a 403 with error code limit_reached:
{
  "error": "limit_reached"
}
Guest (unauthenticated) callers are not subject to usage quotas — only IP-based rate limits. If you need to call this endpoint at high volume from a server, authenticate your requests to get a per-user rate limit and quota tracking against your plan.
Usage is incremented only after a successful generation. Failed requests (400, 429, 403) do not count against your plan quota.