> ## 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.

# Validate API: check JSON-LD against Schema.org and Google

> Check existing JSON-LD against Schema.org and Google Rich Result guidelines. Returns issues, warnings, SEO recommendations, and an auto-corrected schema.

The validate endpoint analyzes a JSON-LD object you already have and tells you whether it is valid, what types it detected, and what issues or improvements it found. It checks against the Schema.org specification, Google Rich Result eligibility guidelines, and general SEO recommendations. It also returns a corrected version of your schema when it can infer the right fix.

This endpoint is useful for auditing JSON-LD you sourced from third-party tools, validating schemas before publishing them to your SDN, or building validation into your own content pipeline.

## Endpoint

```
POST https://schemagen.io/api/validate
```

<Note>
  This endpoint does not require authentication. It is rate-limited per IP address using a separate limit from the generate endpoints.
</Note>

## Request body

<ParamField body="jsonString" type="string" required>
  A JSON string representation of the JSON-LD object you want to validate. You must serialize your JSON-LD to a string before sending it. Pass the raw serialized string, not a nested JSON object.
</ParamField>

## Response

<ResponseField name="isValid" type="boolean">
  `true` if the JSON-LD passes all Schema.org and Google Rich Result checks with no blocking issues. `false` if one or more errors were found.
</ResponseField>

<ResponseField name="detectedTypes" type="string[]">
  An array of Schema.org type names detected in the JSON-LD (e.g., `["Article"]`, `["Product", "Offer"]`). Useful for confirming the validator interpreted your schema as intended.
</ResponseField>

<ResponseField name="issues" type="string[]">
  Blocking errors that make the schema invalid. Fix all items in this array before publishing. An empty array means no blocking errors were found.
</ResponseField>

<ResponseField name="warnings" type="string[]">
  Non-blocking issues that do not invalidate the schema but may affect rich result eligibility or data quality. Review these and address where possible.
</ResponseField>

<ResponseField name="schemaOrgIssues" type="string[]">
  Issues specific to the Schema.org specification, such as unrecognized properties or incorrect value types for the detected schema type. May be `undefined` if no Schema.org-specific issues were found.
</ResponseField>

<ResponseField name="googleRichResultWarnings" type="string[]">
  Warnings from Google Rich Result guidelines — for example, missing fields that Google requires for a schema type to qualify for rich results in Search. May be `undefined` if not applicable.
</ResponseField>

<ResponseField name="seoRecommendations" type="string[]">
  Optional best-practice suggestions for improving the schema's SEO value beyond minimum validity requirements. May be `undefined` if no recommendations apply.
</ResponseField>

<ResponseField name="correctedSchema" type="object | null">
  A corrected version of your JSON-LD with known fixable issues resolved, or `null` if no corrections could be inferred or the schema is already valid.
</ResponseField>

## Code examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://schemagen.io/api/validate" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonString": "{\"@context\":\"https://schema.org\",\"@type\":\"Article\",\"headline\":\"How structured data improves SEO\",\"author\":{\"@type\":\"Person\",\"name\":\"Jane Smith\"},\"datePublished\":\"2026-05-08\"}"
    }'
  ```

  ```javascript JavaScript (fetch) theme={null}
  const jsonLd = {
    '@context': 'https://schema.org',
    '@type': 'Article',
    headline: 'How structured data improves SEO',
    author: {
      '@type': 'Person',
      name: 'Jane Smith',
    },
    datePublished: '2026-05-08',
  };

  const response = await fetch('https://schemagen.io/api/validate', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ jsonString: JSON.stringify(jsonLd) }),
  });

  const result = await response.json();
  console.log(result.isValid);        // true or false
  console.log(result.issues);         // blocking errors
  console.log(result.correctedSchema); // fixed schema or null
  ```
</CodeGroup>

## Example response

```json theme={null}
{
  "isValid": false,
  "detectedTypes": ["Article"],
  "issues": [],
  "warnings": [
    "The 'image' property is missing. Google recommends including an image for Article rich results."
  ],
  "schemaOrgIssues": [],
  "googleRichResultWarnings": [
    "Missing recommended property: image"
  ],
  "seoRecommendations": [
    "Add a 'description' property to improve snippet quality in search results.",
    "Include 'publisher' with an Organization and logo for full Article rich result eligibility."
  ],
  "correctedSchema": {
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": "How structured data improves SEO",
    "author": {
      "@type": "Person",
      "name": "Jane Smith"
    },
    "datePublished": "2026-05-08"
  }
}
```

## Error responses

### 400 — invalid request body

If `jsonString` is missing or the request body itself cannot be parsed, the API returns `400`:

```json theme={null}
{
  "error": "Validation failed",
  "details": {
    "jsonString": {
      "_errors": ["Required"]
    }
  }
}
```

### 429 — rate limit exceeded

```json theme={null}
{
  "error": "Too many requests. Please try again later."
}
```

<Tip>
  Pass the `correctedSchema` value back to `/api/validate` to confirm the corrections resolved all issues before you publish the schema to your site.
</Tip>
