Develop
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.
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
| Endpoint | Method | What it does |
|---|---|---|
| /summarize | POST | Plain-language overview of a regulation |
| /extract | POST | Structured change-cards from a document |
| /compare | POST | What changed between an old and new version |
| /jobs/{id} | GET | Poll a job until status is done |
| /api/calendar | GET | Calendar events as JSON (public) |
| /api/changes | GET | Recently detected changes as JSON (public) |
| /markets | GET | The list of tracked markets and their keys |
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.
curl -s -X POST $BASE/extract \
-H "X-API-Key: $KEY" \
-F market=lcfs \
-F title="2026 amendments" \
-F file=@amendments.pdf
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
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
curl -s "$BASE/api/calendar?program=rggi"
curl -s "$BASE/api/changes?limit=20§or=carbon"