← Glossary Generator
Your token

Glossary Generator API

Reading the terms, checking them and writing the glossary HTML, the CSS, the search script and the DefinedTermSet schema all run free in the browser and need no API. The API is for the one metered step: send your terms with each definition split into numbered parts, and get back, as JSON, the part ids to keep in order (the sentence that says what the term is first, long definitions trimmed), up to three See also term ids per term, categories for a glossary of 12 or more terms, and pairs of entries that name the same thing. The model never writes definition text; the page rebuilds each definition from your own sentences and refuses any change 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": "tidy".

taskWhat it doesReply
tidyPicks and orders the definition parts to keep, suggests See also links between terms, sorts 12 or more terms into categories, and names duplicate entries. It never writes definition text.One JSON object

Input fields

All values are strings. task and items are required.

FieldMeaning
task"tidy"
categories"given" when your terms already carry categories (then none are returned), otherwise "none".
itemsJSON text: a list of terms in page order, each {id, term, words, parts} plus optional also (other names) and category, where parts is the definition as [{id, text, list?, link?}], one sentence or list item each, ids like t3.2. At most 80 terms and 20 parts per definition.
items_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 three keys: items, one {id, keep, related} per term in input order (keep is the list of part ids to show, in order; related is 0 to 3 other term ids); groups, a list of {name, ids} or []; and same, a list of id pairs or []. Before using it, check that every id is one you sent, that no sentence was dropped from a definition of 60 words or fewer, that no sentence with a link was dropped, and that a related term is not the term itself; the page does all of 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 old glossary (HTML) sample on the page (10 terms):

{
  "task": "tidy",
  "categories": "none",
  "items": "[{\"id\":\"t1\",\"term\":\"Workspace\",\"words\":19,\"parts\":[{\"id\":\"t1.1\",\"text\":\"The shared space where your team's projects, files and members live.\"},{\"id\":\"t1.2\",\"text\":\"Each workspace has its own billing and settings.\"}]},{\"id\":\"t2\",\"term\":\"Member\",\"words\":18,\"parts\":[{\"id\":\"t2.1\",\"text\":\"A person who has joined a workspace.\"},{\"id\":\"t2.2\",\"text\":\"Members can be given the admin role or the guest role.\"}]},{\"id\":\"t3\",\"term\":\"Admin\",\"words\":14,\"parts\":[{\"id\":\"t3.1\",\"text\":\"A member who can change workspace settings, invite or remove members and manage billing.\"}]},{\"id\":\"t4\",\"term\":\"Guest\",\"words\":15,\"parts\":[{\"id\":\"t4.1\",\"text\":\"Someone from outside your team who can see only the projects they are invited to.\"}]},{\"id\":\"t5\",\"term\":\"Project\",\"words\":17,\"parts\":[{\"id\":\"t5.1\",\"text\":\"A set of tasks, files and discussions about one piece of work.\"},{\"id\":\"t5.2\",\"text\":\"Click here to learn more.\",\"link\":true}]},{\"id\":\"t6\",\"term\":\"API key\",\"words\":25,\"parts\":[{\"id\":\"t6.1\",\"text\":\"A secret code that lets another program use your workspace through our API.\"},{\"id\":\"t6.2\",\"text\":\"Treat it like a password and never paste it into public places.\"}]},{\"id\":\"t7\",\"term\":\"Webhook\",\"words\":22,\"parts\":[{\"id\":\"t7.1\",\"text\":\"A message our servers send to an address you choose when something happens in your workspace, such as a task being finished.\"}]},{\"id\":\"t8\",\"term\":\"Integration\",\"words\":18,\"parts\":[{\"id\":\"t8.1\",\"text\":\"A connection to another app, such as a calendar or chat tool, set up from the workspace settings.\"}]},{\"id\":\"t9\",\"term\":\"Two-factor authentication\",\"words\":16,\"parts\":[{\"id\":\"t9.1\",\"text\":\"A sign-in check that asks for a code from your phone as well as your password.\"}]},{\"id\":\"t10\",\"term\":\"SSO\",\"words\":15,\"parts\":[{\"id\":\"t10.1\",\"text\":\"Single sign-on: members sign in with your company's identity provider instead of a separate password.\"}]}]",
  "items_note": ""
}

Reply:

{
  "items": [
    {"id": "t1", "keep": ["t1.1", "t1.2"], "related": ["t3", "t8"]},
    {"id": "t2", "keep": ["t2.1", "t2.2"], "related": ["t10"]},
    {"id": "t3", "keep": ["t3.1"], "related": ["t4", "t10"]},
    {"id": "t4", "keep": ["t4.1"], "related": ["t2", "t3"]},
    {"id": "t5", "keep": ["t5.1", "t5.2"], "related": ["t1", "t4"]},
    {"id": "t6", "keep": ["t6.1", "t6.2"], "related": ["t7", "t8"]},
    {"id": "t7", "keep": ["t7.1"], "related": ["t6", "t8"]},
    {"id": "t8", "keep": ["t8.1"], "related": ["t6", "t7"]},
    {"id": "t9", "keep": ["t9.1"], "related": ["t10"]},
    {"id": "t10", "keep": ["t10.1"], "related": ["t9"]}
  ],
  "groups": [],
  "same": []
}

On the page, every definition stays as written (all are under 60 words) and each term gains See also links, such as Webhook to API key and Integration, and SSO to Two-factor authentication.

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://glossary-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":"glossary-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": "tidy", "categories": "none", "items": "[...]", "items_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="glossary-generator:tidy:$(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: items, groups, same
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: glossary-generator:tidy:$(shasum -a 256 input.json | cut -c1-16):a1" --data @input.json