AILI public API
JSON access to the Alberta K-12 curriculum as indexed by AILI (AI Learning Interface): subjects, curricula, trees, nodes, resources, hybrid search and cited answers. Every response is an object with `data` and optional `meta`, or `error` with `code` and `message`. Open access, rate limited per IP; send an `X-API-Key` header to raise the limit. Version 1.0.0. Machine readable: YAML · JSON.
/api/v1/subjectscurriculumList subject areas with curriculum, course and outcome counts.
| Parameter | In | Type | Description |
|---|---|---|---|
include_archived | query | boolean | Include curricula withdrawn upstream and kept for reference (fetch_status archived-p2). Hidden by default; archived rows carry archived: true and archived_reason. |
Responses: 200 Subject list.
/api/v1/subjects/{code}curriculumOne subject area with its child subjects, curricula and courses.
| Parameter | In | Type | Description |
|---|---|---|---|
code required | path | string | Subject area code, for example MAT. |
Responses: 200 Subject detail. · 404 Unknown subject.
/api/v1/curriculacurriculumList curricula, optionally filtered by subject or framework.
| Parameter | In | Type | Description |
|---|---|---|---|
subject | query | string | Subject area code. |
framework | query | string (GFC | POS | LDC | EXT) | Curriculum framework. |
include_archived | query | boolean | Include curricula withdrawn upstream and kept for reference (fetch_status archived-p2). Hidden by default; archived rows carry archived: true and archived_reason. |
Responses: 200 Curriculum list.
/api/v1/curricula/{code}curriculumOne curriculum with its courses and grades.
| Parameter | In | Type | Description |
|---|---|---|---|
code required | path | string |
Responses: 200 Curriculum detail. · 404 Unknown curriculum.
/api/v1/curricula/{code}/treecurriculumFlat node rows for the explorer, each with parent_id and children_count. Pruned to level_index <= 5 by default so the tree loads in one request; pass depth=all for every knowledge, understanding and skills leaf. Clients build Map<parent_id, children[]> and treat rows whose parent is missing as roots.
| Parameter | In | Type | Description |
|---|---|---|---|
code required | path | string | |
depth | query | string | Maximum level_index (1 to 12) or `all`. Default 5. |
course | query | string | Restrict to one course code. |
Responses: 200 Tree rows. · 404 Unknown curriculum.
/api/v1/coursescurriculumList courses (catalogue records plus uncatalogued K to 6 course nodes), ordered by id and cursor paged.
| Parameter | In | Type | Description |
|---|---|---|---|
subject | query | string | |
grade | query | string | Grade code, for example 5 or K. |
framework | query | string | |
curriculum | query | string | |
limit | query | integer | |
cursor | query | string | Last id of the previous page; meta carries total and next_cursor. |
include_archived | query | boolean | Include curricula withdrawn upstream and kept for reference (fetch_status archived-p2). Hidden by default; archived rows carry archived: true and archived_reason. |
Responses: 200 Course list with meta {count, total, limit, next_cursor}.
/api/v1/gradescurriculumList grade codes.
Responses: 200 Grade list.
/api/v1/nodes/{id}nodesOne curriculum node with its ancestors and AI enrichment.
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | string | Numeric id, or `curriculum_code|path`. |
Responses: 200 Node detail. · 404 Unknown node.
/api/v1/nodes/{id}/childrennodesDirect children of a node (used to load K/U/SP leaves on demand).
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | string |
Responses: 200 Child rows.
/api/v1/nodes/{id}/ancestorsnodesAncestors from the curriculum root down to the parent.
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | string |
Responses: 200 Ancestor rows.
/api/v1/nodes/{id}/resourcesnodesResources linked to a node.
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | string |
Responses: 200 Resource rows.
/api/v1/code/{code}nodesExact lookup by curriculum, course or outcome code (for example MAT5-OI2-GQ1-LO1).
| Parameter | In | Type | Description |
|---|---|---|---|
code required | path | string | |
include_archived | query | boolean | Include curricula withdrawn upstream and kept for reference (fetch_status archived-p2). Hidden by default; archived rows carry archived: true and archived_reason. |
Responses: 200 Matching nodes, curriculum and course. · 404 Nothing carries that code.
/api/v1/searchsearchHybrid search across curriculum nodes, PDF pages, resources and overviews. mode=hybrid fuses vector similarity and full-text search; lexical uses full-text only; vector uses embeddings only. When embeddings are not yet available the server falls back to lexical and says so in meta.mode.
| Parameter | In | Type | Description |
|---|---|---|---|
q required | query | string | |
lang | query | string (en | fr) | |
subject | query | string | |
course | query | string | |
grade | query | string | |
framework | query | string | |
type | query | string | Node type such as LO, OI, GQ, K, U, SP. |
kind | query | string (node | pdf_page | resource | overview) | |
curriculum | query | string | |
limit | query | integer | |
mode | query | string (hybrid | lexical | vector) | |
include_archived | query | boolean | Include curricula withdrawn upstream and kept for reference (fetch_status archived-p2). Hidden by default; archived rows carry archived: true and archived_reason. |
Responses: 200 Ranked results. · 400 q too short.
/api/v1/asksearchCited answer as one JSON document (not streamed).
Body application/json: ["question","lang","filters"]
Responses: 200 Answer with sources, verification and trace id. · 400 Missing question. · 503 Answer pipeline not available.
/api/v1/findsearchStaged selection without generation. Reads intent, resolves curriculum sets and proposes a selection (stages 0 to 2 of docs/SELECTION-PIPELINE.md). Cheap (about $0.002) and cached ten minutes by normalized query and filters. Returns 503 while the selection module is unavailable. `filters` can override parts of the intent (grades, subjects, audience, scope, deliverable).
Body application/json: ["q","filters","language","deliverable"]
Responses: 200 Intent, sets and proposed selection. · 400 q missing. · 503 Selection module not available yet.
/api/v1/courses/{code}/outcomescurriculumWhole-course dataset in curriculum order, as JSON or an indented outline.
| Parameter | In | Type | Description |
|---|---|---|---|
code required | path | string | Course code, for example MAT3 or ELA9. |
depth | query | string (lo | kusp) | lo stops at learning outcomes; kusp includes knowledge, understanding, skills and procedures. |
format | query | string (json | outline) | |
download | query | string (1) | Send as an attachment (Content-Disposition). |
Responses: 200 Course dataset. JSON carries `data.set`, `data.nodes` (flat, with parent_id) and `data.tree` (nested); outline is text/markdown. · 404 Unknown course.
/api/v1/resources/{id}libraryOne resource with linked outcomes and stored assets.
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | string |
Responses: 200 Resource detail. · 404 Unknown resource.
/api/v1/assets/{id}libraryRaw bytes of a stored asset (PDF, image) with ETag; add ?meta=1 for metadata only.
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | integer | |
meta | query | string (1) | Return metadata JSON instead of bytes. |
Responses: 200 Bytes or metadata. · 304 Not modified. · 404 Asset not stored.
/api/v1/assets/{id}/pages/{n}libraryExtracted text of one PDF page.
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | integer | |
n required | path | integer |
Responses: 200 Page text. · 404 Page not extracted.
/api/v1/statusplatformCorpus counts, last harvest and index run, job queue, embedding coverage, loaded modules.
Responses: 200 Status.
/api/v1/registerplatformData register. What the API holds, computed live from the database and cached ten minutes.
Responses: 200 Register.
/api/v1/costs/summaryplatformPlatform AI cost by day, purpose, model and artifact kind.
| Parameter | In | Type | Description |
|---|---|---|---|
days | query | integer |
Responses: 200 Cost summary.
/api/v1/costs/mineplatformCost attributed to the calling session or account.
| Parameter | In | Type | Description |
|---|---|---|---|
days | query | integer |
Responses: 200 Personal usage.
/api/askstreamingServer-sent events. Emits stage, sources, chunk, verification, done and error events.
| Parameter | In | Type | Description |
|---|---|---|---|
q required | query | string | |
lang | query | string (en | fr) | |
curriculum | query | string | |
course | query | string | |
grade | query | string |
Responses: 200 text/event-stream.
/api/askstreamingSame pipeline as GET, returned as one JSON object (answer, sources, verification, traceId, costUsd).
Responses: 200 Answer JSON.
/api/ask/trace/{id}streamingStored trace for one answer (plan, angles, candidates, selected passages, verification, usage).
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | string |
Responses: 200 Trace. · 404 Unknown trace.
/api/generate/toolsstreamingGeneration tools with parameter descriptions, default tier and image support.
Responses: 200 Tool list.
/api/generate/startstreamingServer-sent events. Emits stage, rag, chunk, image, validation, done and error while an artifact is generated.
Body application/json: ["kind","tier","params","nodeIds","question","language","persona"]
Responses: 200 text/event-stream.
/api/generate/{id}streamingOne generated artifact (markdown body, sources, assets, validation).
| Parameter | In | Type | Description |
|---|---|---|---|
id required | path | string |
Responses: 200 Artifact. · 404 Unknown artifact.
/api/v1/exportexportThe exportable tables with their key, since column, filters and page size.
Responses: 200 List of exports.
/api/v1/export/{table}exportOne page of a table. Page with cursor (the last row key) until next_cursor is null. Totals ignore the cursor; total_estimated is set when the count came from the planner.
| Parameter | In | Type | Description |
|---|---|---|---|
table required | path | string (curricula | catalogue_courses | subject_areas | grades | collections | nodes | enrichment | resources | node_resource_refs | assets | asset_refs | pdf_documents | pdf_pages | chunks | audit_results | change_log | pipeline_runs) | |
limit | query | integer | Up to 1000; 200 when with_embeddings=1. |
cursor | query | string | The next_cursor value from the previous page: the last key for single-key tables, an encoded key tuple for pdf_pages, node_resource_refs and asset_refs. |
since | query | string | Only rows changed after this time (updated_at; last_seen_at for curricula, created_at for enrichment). |
curriculum | query | string | nodes, chunks: curriculum code. |
course | query | string | nodes, chunks: course code. |
node_type | query | string | nodes. |
framework | query | string | curricula: GFC | POS | LDC | EXT. |
published | query | boolean | curricula: content_published. |
language | query | string | chunks: en | fr. |
source_kind | query | string | chunks. |
fetch_status | query | string | assets: downloaded | gated | external_large | external_link | external_unavailable. |
with_embeddings | query | boolean | chunks: include the embedding vector as an array of numbers (limit capped at 200). |
Responses: 200 One page. · 404 Unknown table. · 429 Rate limited.
Schemas
Intent
Stage 0 reading of the request.
| Field | Type | Description |
|---|---|---|
audience | string, nullable | parent | teacher | student | developer | unknown |
grades | array | |
subjects | array | |
courses | array | |
topics | array | |
scope | string | whole-course | topic | outcome | question |
deliverable | string | overview | lesson | quiz | homework | presentation | answer | unknown |
language | string |
CurriculumSet
One resolved course (stage 1).
| Field | Type | Description |
|---|---|---|
course_code | string, nullable | |
curriculum_code | string, nullable | |
grade | string, nullable | |
name | string, nullable | |
framework | string, nullable | |
counts | object | |
root_node_id | integer, nullable | |
tree_url | string, nullable | |
empty | boolean | True when the subject has no course for the grade. |
reason | string, nullable |
Selection
Stage 2 proposal as returned by find(). Nodes live in `selected`, grouped by `set_index`; `budget` is the token limit for the deliverable.
| Field | Type | Description |
|---|---|---|
scope | string, nullable | |
deliverable | string, nullable | |
mode | string, nullable | full | fragment | outcome | question |
omitted_count | integer, nullable | |
tokens | integer, nullable | |
budget | integer, nullable | Token budget for the deliverable. |
merged_from_sets | integer, nullable | |
by_set | array, nullable | |
selected | array, nullable | |
resources | array, nullable | |
usage | object, nullable |
FindResult
| Field | Type | Description |
|---|---|---|
intent | Intent | |
sets | array | |
selection | Selection |
Register
Counts of what is available through the API.
| Field | Type | Description |
|---|---|---|
computed_at | string | |
curricula | object | |
courses | object | |
elements | object | |
resources | object | |
documents | object | |
chunks | object | |
enrichment | object | |
last_harvest | object, nullable | |
last_audit | object, nullable | |
content_licence | object |
OutlineNode
| Field | Type | Description |
|---|---|---|
id | integer | |
parent_id | integer, nullable | |
node_code | string | |
node_type | string | |
level_index | integer | |
label | string, nullable | |
text | string, nullable | |
url | string | |
children | array | Present in `tree` only. |
TreeNode
One row of a curriculum tree.
| Field | Type | Description |
|---|---|---|
id | integer | |
parent_id | integer, nullable | Null for roots or when the parent was pruned. |
node_code | string | |
node_type | string | COURSE, OI, GQ, LO, KUSP, K, U, SP, TOPIC, GENERAL_OUTCOME, SPECIFIC_OUTCOME, OVERVIEW and others. |
level_index | integer | Portable depth, 1 course to 7 K/U/SP leaf. |
label | string, nullable | Title (English, French fallback). |
heading | string, nullable | First 160 characters of the content. |
breadcrumb | string | Ancestor labels joined by a right-pointing chevron. |
grade_codes | array, nullable | |
course_code | string, nullable | |
children_count | integer | |
has_content | boolean |
Node
A curriculum element with bilingual text.
| Field | Type | Description |
|---|---|---|
id | integer | |
curriculum_code | string | |
framework | string | |
node_code | string | |
node_type | string | |
level_index | integer | |
path | string | Ancestor codes joined by `>`. |
course_code | string, nullable | |
grade_codes | array, nullable | |
title_en | string, nullable | |
title_fr | string, nullable | |
content_en | string, nullable | |
content_fr | string, nullable | |
content_en_md | string, nullable | Normalised markdown. |
image_urls | array, nullable | |
ancestors | array | |
enrichment | object, nullable | AI summary, plain-language gloss, keywords, topics. |
descendant_count | integer |
SearchResult
| Field | Type | Description |
|---|---|---|
chunk_id | integer, nullable | |
node_id | integer, nullable | |
asset_id | integer, nullable | |
page_num | integer, nullable | |
kind | string | node, pdf_page, resource or overview. |
node_type | string, nullable | |
heading | string, nullable | |
breadcrumb | string, nullable | |
snippet | string, nullable | Matching text with <mark> around hits. |
score | number, nullable | |
url | string, nullable | In-app link (/explore/node/:id or /library/pdf/:id?page=n). |
Answer
| Field | Type | Description |
|---|---|---|
answer | string | Markdown with [S#] citations. |
sources | array | |
verification | array | Per-claim supported, partial or unsupported verdicts. |
traceId | string, nullable | |
costUsd | number, nullable |
Status
| Field | Type | Description |
|---|---|---|
counts | object | subjects, curricula, courses, nodes, outcomes, assets, pdf_pages, chunks, chunks_embedded, embedding_coverage_pct and more. |
last_harvest | object, nullable | |
last_index | object, nullable | |
index_jobs | array | |
audits | array | |
modules | object | Which optional modules are loaded. |