← Home

Develop

Call the engine directly.

Every feature is an HTTP endpoint. Below is the base URL, how to authenticate, and a copy-paste example for each. For an interactive reference you can run in the browser, use /docs.

Base URL & auth

All calls go to https://api.theknighted.com. Authenticated endpoints expect your key in an X-API-Key header. The calendar and change feeds are public (no key).

BASE=https://api.theknighted.com
KEY=your-api-key

Endpoints

EndpointMethodWhat it does
/summarizePOSTPlain-language overview of a regulation
/extractPOSTStructured change-cards from a document
/comparePOSTWhat changed between an old and new version
/jobs/{id}GETPoll a job until status is done
/api/calendarGETCalendar events as JSON (public)
/api/changesGETRecently detected changes as JSON (public)
/marketsGETThe list of tracked markets and their keys

Summarize a regulation

Jobs run in the background: the POST returns a job_id, then you poll /jobs/{id} until it is done.

curl -s -X POST $BASE/summarize \
  -H "X-API-Key: $KEY" \
  -F market=cca \
  -F text="Paste the regulation text here..."
# -> {"job_id":"ab12...","poll":"/jobs/ab12..."}

curl -s $BASE/jobs/ab12... -H "X-API-Key: $KEY"

Upload a file instead of pasting text with -F file=@regulation.pdf.

Extract change-cards

curl -s -X POST $BASE/extract \
  -H "X-API-Key: $KEY" \
  -F market=lcfs \
  -F title="2026 amendments" \
  -F file=@amendments.pdf

Compare two versions

curl -s -X POST $BASE/compare \
  -H "X-API-Key: $KEY" \
  -F market=rggi \
  -F old_file=@model_rule_2017.pdf \
  -F new_file=@model_rule_2023.pdf

Large documents: confirm first

To protect against runaway cost, a job over roughly 60,000 input tokens (about a hundred pages) does not start immediately. Instead it returns an estimate:

{"needs_confirmation": true,
 "estimate": {"est_input_tokens": 75000, "est_cost_usd": 0.47, ...},
 "hint": "Resubmit the same request with confirm=true to run it."}

Resubmit the identical request with one extra field to run it:

  -F confirm=true

Public feeds (no key)

curl -s "$BASE/api/calendar?program=rggi"
curl -s "$BASE/api/changes?limit=20§or=carbon"