← Schema Markup Generator
Your token

Schema Markup Generator API

Reading a page, picking the Schema.org type, writing the JSON-LD and checking it all run free in the browser and need no API. The API is for the one metered step: send the page's text, its type and the fields that are still empty, and get back, as JSON, a value for each field the page states together with the exact words it was read from. The page finds every quote in your text, checks that the value says the same thing (same date, number, hours, currency) and refuses anything it cannot check.

Base URL: https://api.skillsafe.ai/v1/app-api. Every response is {"data": ...} or {"error": {"code", "message"}}; read error.code and error.message rather than the HTTP status alone.

The task field

This app has one task. Always send "task": "fill".

taskWhat it doesReply
fillFills empty Schema.org fields from what the page text states, each with the quoted words it came from. It never invents a value.One JSON object

Input fields

All values are strings. task, type and page are required.

FieldMeaning
task"fill"
typeThe Schema.org type, such as Product, Bakery, BlogPosting, Event, JobPosting.
pageThe page as text: its visible text, then any JSON-LD it holds (or the details you typed). At most 12,000 characters; the page cuts the middle of longer pages and says so in page_note.
fieldsJSON text: the empty fields, each {key, label, kind} plus allowed for a fixed list. Kinds: text, long, url, urls, email, tel, date, datetime, year, number, int, price, currency, enum, hours, country.
haveJSON text: the fields that already have a value, {key: value}, for context.
page_noteEmpty, or a sentence saying what was cut.

The reply

job.output.output is text holding one JSON object (sometimes inside a ```json fence) with two keys: fields, a list of {key, value, quote} where quote is copied from page; and not_found, the keys the page does not state. Values follow the kind: dates YYYY-MM-DD or YYYY-MM-DDTHH:MM, prices as plain numbers, currencies and countries as codes, hours like Mo-Fr 09:00-17:00. Before using a value, check that its quote is in your page and says the same thing; the page does this and lists what it refused. If the balance ran low, truncated is true and the object may stop early; the page keeps every entry that arrived whole.

Worked example

Input (input.json), the product page (HTML) sample on the page:

{
  "task": "fill",
  "type": "Product",
  "page": "Home / Bottles\nTrailhead 2 Insulated Bottle, 750 ml\nBy Northpine\n$34.00\nIn stock – ships in 1–2 business days\nRated 4.7 out of 5 from 318 reviews\nKeeps drinks cold for 24 hours and hot for 12. The lid seals with a quarter turn, and the 7 cm base fits most car cup holders.\nColour: Sage\nCapacity: 750 ml\nSKU: NP-TH2-750-SG",
  "fields": "[{\"key\":\"brand\",\"label\":\"Brand\",\"kind\":\"text\"},{\"key\":\"availability\",\"label\":\"Availability\",\"kind\":\"enum\",\"allowed\":[\"InStock\",\"OutOfStock\",\"PreOrder\",\"BackOrder\",\"LimitedAvailability\",\"SoldOut\",\"OnlineOnly\",\"InStoreOnly\",\"Discontinued\"]},{\"key\":\"offerUrl\",\"label\":\"Buy or ticket link\",\"kind\":\"url\"},{\"key\":\"sku\",\"label\":\"SKU\",\"kind\":\"text\"},{\"key\":\"gtin\",\"label\":\"GTIN / barcode\",\"kind\":\"text\"},{\"key\":\"ratingValue\",\"label\":\"Average rating (out of 5)\",\"kind\":\"number\"},{\"key\":\"reviewCount\",\"label\":\"Number of reviews\",\"kind\":\"int\"}]",
  "have": "{\"name\":\"Trailhead 2 Insulated Bottle, 750 ml\",\"image\":\"https://shop.example.com/img/trailhead-2-sage.jpg\",\"description\":\"Double-wall steel bottle that keeps drinks cold for 24 hours. Leak-proof lid, fits car cup holders.\",\"price\":\"34.00\",\"currency\":\"USD\"}",
  "page_note": ""
}

Reply:

{"fields":[{"key":"brand","value":"Northpine","quote":"By Northpine"},{"key":"availability","value":"InStock","quote":"In stock"},{"key":"sku","value":"NP-TH2-750-SG","quote":"SKU: NP-TH2-750-SG"},{"key":"ratingValue","value":"4.7","quote":"Rated 4.7 out of 5 from 318 reviews"},{"key":"reviewCount","value":"318","quote":"Rated 4.7 out of 5 from 318 reviews"}],"not_found":["offerUrl","gtin"]}

On the page, each value is found in the product page's own text and added to the Product JSON-LD: the brand, stock, SKU, rating and review count.

Errors

HTTPWhat to do
401The token is missing, expired or a guest token on a run. Get a personal token on the token page.
402The balance is below what the run reserves. Top up at skillsafe.ai/account/billing.
400The body is not a JSON object of the fields above.
429Wait and retry with the same Idempotency-Key.

Step 1 — a tiny client helper

One function that sends JSON and unwraps the {data, error} envelope.

BASE="https://api.skillsafe.ai/v1/app-api"
TOKEN="paste-your-token-here"   # from https://schema-markup-generator.skillsafe.ai/tokens.html
api() { # api METHOD PATH [JSON-BODY]
  curl -s -X "$1" "$BASE$2" -H "Content-Type: application/json" \
    ${TOKEN:+-H "Authorization: Bearer $TOKEN"} ${3:+--data "$3"}
}

Step 2 — a token

A guest token is enough for /me and /estimate. A run is metered, so it needs your personal token: sign in on the token page and copy it.

# a guest token (enough for /me and /estimate); a run needs your personal token from /tokens.html
TOKEN=$(curl -s -X POST "$BASE/guest" -H "Content-Type: application/json" -d '{"slug":"schema-markup-generator"}' | jq -r '.data.token')

Step 3 — who am I, and my balance

subject_type is guest or user; credits is the balance (1 credit = $0.0001).

api GET /me | jq '.data | {subject_type, credits}' 

Step 4 — price a run for free

/estimate charges nothing and starts no job. hold_credits is the amount reserved while a run is in flight, not the price; the run is charged what it uses.

# input.json: the run input object - {"task": "fill", "type": "Product", "page": "...", "fields": "[...]", "have": "{...}", "page_note": ""}
api POST /estimate "$(cat input.json)" | jq '.data | {hold_credits, min_credits, model, model_alias, markup_bps, warnings}' 

Step 5 — run it and wait for the job

Send an Idempotency-Key derived from the input: a retry with the same key is never billed twice.

KEY="schema-markup-generator:fill:$(shasum -a 256 input.json | cut -c1-16):a1"
JOB=$(curl -s -X POST "$BASE/run" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: $KEY" --data @input.json | jq -r '.data.job_id')
while :; do
  J=$(api GET "/jobs/$JOB"); S=$(echo "$J" | jq -r '.data.status')
  case "$S" in succeeded|failed|cancelled) break;; esac; sleep 2
done
echo "$J" | jq -r '.data.output.output' > reply.json   # one JSON object: fields, not_found
echo "$J" | jq '.data | {charged_credits, truncated}' 

Step 6 — or stream it

/run-stream sends Server-Sent Events while the job runs and the finished job at the end.

# Server-Sent Events: tick/delta events while the job runs, then a final event with the job
curl -N -s -X POST "$BASE/run-stream" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: schema-markup-generator:fill:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json