Skip to content

Programs

A program is a course template in a tenant. slug is unique per tenant.

List programs visible to you (RLS: tenant-scoped). Optionally filter by tenant.

Inputs:

ArgTypeNotes
tenant_id?uuidFilter to a single tenant.
limit?intMax rows (1–200, default 100).

Result: { "programs": [ { "id", "tenant_id", "slug", "title_i18n", "created_at" }, … ] }

Fetch one program with its full nested graph: units → lessons → activities, ordered by ordinal. RLS-scoped.

Inputs:

ArgTypeNotes
program_iduuidrequired

Result:

{
"program": {
"id": "…", "tenant_id": "…", "slug": "intro-kafka",
"title_i18n": { "en": "Intro to Kafka" }, "created_at": "…",
"units": [
{
"id": "…", "ordinal": 0, "title_i18n": { "en": "Basics" },
"lessons": [
{
"id": "…", "ordinal": 0, "title_i18n": { "en": "Topics & partitions" },
"activities": [
{ "id": "…", "ordinal": 0, "kind": "concept", "spec": {}, "rubric": {} }
]
}
]
}
]
}
}

Returns an error if the program is not found or not visible to you.

Create a new program (template) in a tenant. Author-role only (RLS enforces author / instructor / tenant_admin / owner on the tenant). slug must be unique within the tenant.

Inputs:

ArgTypeNotes
tenant_iduuidOwning tenant (from list_tenants / whoami).
slugstringURL-safe, unique within the tenant.
title_i18n?string | mapi18n map or a bare string (→ { "en": … }).

Result: { "success": true, "program": { "id", "tenant_id", "slug", "title_i18n", "created_at" } }

create_program → args
{ "tenant_id": "8f3c…", "slug": "intro-kafka", "title_i18n": { "en": "Intro to Kafka", "pt": "Introdução ao Kafka" } }

Update a program’s slug and/or title_i18n. Author-role only. Only provided fields change; passing neither returns "Nothing to update.".

Inputs:

ArgTypeNotes
program_iduuidrequired
slug?stringnew unique slug
title_i18n?string | map

Result: { "success": true, "program": {…} }

Delete a program. Cascades to its units, lessons, and activities. Author-role only. Irreversible.

Inputs:

ArgTypeNotes
program_iduuidrequired

Result: { "success": true, "deleted": "<program_id>" }

Deep-copy an existing program graph (units → lessons → activities) into a new program in the same tenant under a new slug. Author-role only. Returns the new program id.

Inputs:

ArgTypeNotes
source_program_iduuidProgram to copy from.
new_slugstringSlug for the new program (unique per tenant).
new_title_i18n?string | mapDefaults to the source program’s title.

Result: { "success": true, "new_program_id": "<uuid>" }