POST /v1/platform/modules
Creates a single module. A platform module is the same content shape as a
classroom module: one standalone lesson with lecture HTML, optional interactive
content, optional quizzes, metadata, slug, publish flag, and S3-backed lecture
storage. The ownership fields are platform-specific (platformWorkspaceId and
platformApiKeyId) instead of classroom/user fields.
Pricing
The Module API is billed as one generated lesson. It uses the same per-lesson price as one Course API lesson.
| Unit | Price |
|---|---|
| Per lesson | $0.05 |
The response includes a priceSnapshot with the exact billable amount.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes, unless topic is provided | Prompt describing the module to generate |
topic | string | Yes, unless prompt is provided | Classroom-compatible alias for prompt |
title | string | No | Override title |
description | string | No | Override description |
target | string | No | Additional target learner/context |
type | string | No | Lesson type. If omitted, TutorFlow infers one |
language | string | No | Content language, default en |
locale | string | No | UI/user locale, default en |
slug | string | No | URL-friendly slug |
isPublic | boolean | No | Whether the share-token endpoint can render it, default true |
hasQuiz | boolean | No | Whether to include generated quiz items, default true |
idempotencyKey | string | No | Prevents duplicate processing. Can also be sent via Idempotency-Key |
Example Request
curl -X POST https://api.tutorflow.io/v1/platform/modules \
-H "Authorization: Bearer tf_platform_..." \
-H "Content-Type: application/json" \
-d '{
"prompt": "Create a short beginner lesson about Python variables with a quick practice quiz",
"language": "en"
}'Example Response
{
"id": "4d3b7f2a-7b8f-497c-a1d9-58b7f2e0c111",
"title": "Python Variables",
"description": "Create a lesson about Python variables.",
"type": "markdown",
"isPublic": true,
"content": null,
"lectureKey": "platform/workspaces/.../modules/.../lecture/1.txt",
"lecture": "<h1>Python Variables</h1><p>...</p>",
"lectureVersion": 1,
"status": "completed",
"metadata": { "locale": "en", "language": "en" },
"slug": "python-variables-a1b2c3",
"shareToken": "b018172542f9a3c4d5e6f7890abcdef12345678",
"publicUrl": "https://tutorflow.io/en/platform/modules/b018172542f9...",
"platformWorkspaceId": "workspace-uuid",
"platformApiKeyId": "api-key-uuid",
"idempotencyKey": null,
"priceSnapshot": {
"category": "module",
"catalogKey": "module.default",
"tier": "default",
"unit": "lesson",
"unitPrice": 0.05,
"units": 1,
"amountUsd": 0.05,
"currency": "USD",
"source": "platform_pricing_catalog_v2"
},
"quizzes": [],
"createdAt": "2026-04-27T10:00:00.000Z",
"updatedAt": "2026-04-27T10:00:12.000Z",
"completedAt": "2026-04-27T10:00:12.000Z"
}Response Fields
ModuleResDto includes the generated lesson body and ownership metadata:
| Field | Type | Description |
|---|---|---|
id | string | Platform module ID. Use this for get, update, delete, and list reconciliation. |
title | string | null | Generated or overridden module title. |
description | string | null | Generated or overridden module description. |
type | string | Lesson type inferred by TutorFlow or supplied in the request. |
isPublic | boolean | Whether the share-token public endpoint can render the module. |
videoUrl | string | null | Optional source video URL for video-backed modules. |
pdfKey | string | null | Optional S3 key for PDF-backed modules. |
content | string | null | Classroom-compatible structured lesson content when generated. |
lectureKey | string | null | S3 key for the generated lecture HTML. |
lecture | string | null | Generated lecture HTML loaded from S3. |
lectureVersion | number | Lecture content version. Increments when lecture is updated. |
status | string | null | processing, completed, or failed. |
lectureImagePrompt | string | null | Optional prompt used for lecture imagery. |
metadata | object | null | Locale, language, original prompt, and any extra metadata. |
slug | string | URL-friendly module slug. |
deletedAt | string | null | ISO 8601 timestamp when soft-deleted, otherwise null. |
shareToken | string | Token used by public module routes. |
publicUrl | string | null | Public learner-facing module URL using the module locale. |
platformWorkspaceId | string | Owning platform workspace ID. |
platformApiKeyId | string | API key ID that created the module. |
idempotencyKey | string | null | Idempotency key used for creation, if any. |
priceSnapshot | object | null | Per-unit billing snapshot for this module. |
quizzes | array | Generated quiz items when hasQuiz is true. |
createdAt, updatedAt, completedAt | string | ISO 8601 timestamps. |
Public URL
publicUrl opens a learner-facing module page at:
/{locale}/platform/modules/{shareToken}