Validating schema.org markup through an API

Neither Google's Rich Results Test nor the Schema Markup Validator at validator.schema.org offers a public API, so checking structured data from code means extracting the JSON-LD yourself and testing the fields Google needs. Search Console's URL Inspection API includes rich result findings, but only for sites in your own Search Console account. Our Structured Data API reads any public page and returns every JSON-LD block parsed, the schema.org types found and warnings for missing required fields for $0.003.

Try it free Structured Data API — JSON-LD, schema.org checks, $0.003 · $0.003 / call

Your options

OptionAPIAny siteGoogle rules
Rich Results TestNoYes, in a browserYes
Schema Markup ValidatorNoYes, in a browserNo, schema.org only
Search Console URL Inspection APIYesOnly your own propertiesYes
Your own scriptYou write itYesOnly the rules you code
Structured Data API (iamai.markets)Yes, $0.003Any public pageCommon types

Extracting JSON-LD yourself

That gets you the types. Checking that a Product has offers with price and priceCurrency, or that each FAQ question has an accepted answer, is the part that grows into a project.

import json, requests
from bs4 import BeautifulSoup

html = requests.get("https://example.com/product", timeout=15).text
soup = BeautifulSoup(html, "html.parser")
for i, tag in enumerate(soup.find_all("script", type="application/ld+json"), 1):
    try:
        data = json.loads(tag.string or "")
    except json.JSONDecodeError as e:
        print(f"block {i}: invalid JSON: {e}")
        continue
    items = data.get("@graph", [data]) if isinstance(data, dict) else data
    for item in items:
        print(i, item.get("@type"))

What the API checks

It parses every JSON-LD block, including nested items and @graph, counts each schema.org type, and notes microdata item types and RDFa. Warnings cover broken JSON, a @context that isn't schema.org, and required or recommended fields missing for Product and Offer, Article types, Organization, LocalBusiness, BreadcrumbList, FAQPage, Event, Recipe, JobPosting, VideoObject, Review and AggregateRating. Blocks over 50 KB are listed without their data.

curl -i -X POST https://iamai.markets/api/x402/services/U1omvLPF2yEl \
  -H "Content-Type: application/json" \
  -d '{"url": "https://en.wikipedia.org/wiki/Cloudflare"}'

# $0.003 via x402 (USDC on Base). result.json_ld.blocks[], result.schema_types{}, result.warnings[]

Honest limits

The product

Questions

Does Google have a Rich Results Test API?

No public one. The URL Inspection API in Search Console reports rich results only for URLs on properties you have access to.

Is JSON-LD better than microdata?

Google recommends JSON-LD because it sits in one script block and is easier to maintain. Both are supported.

Can I validate a JSON-LD snippet without a URL?

Not with our API, which reads a live page. The Rich Results Test and Schema Markup Validator accept pasted code.

Related

Updated 2026-12-02