API.
REFERENCE.
REST API. ASYNC QUEUE. WEBHOOK DELIVERY. ALL ENDPOINTS GATED BY ISSUED API KEY. FULL STRUCTURED JSON ON EVERY RESPONSE.
# 1. Send a curriculum generation request
curl -X POST https://api.mentrast.com/v2/curriculum/generate \
-H "x-api-key: mk_live_7f91a3bc9204ee1d" \
-H "Content-Type: application/json" \
-d '{
"user_id": "usr_7f91a3bc",
"topic": "Advanced Node.js Microservices",
"timeframe": "6 months",
"complexity": "advanced",
"options": {
"diagnostic_first": true,
"webhook_url": "https://your-app.com/hooks/mentrast"
}
}'
# → Returns immediately:
# { "id": "cur_8f92j10x", "job_id": "job_4aa19z02", "status": "queued" }
# 2. Webhook fires ~8s later with full JSON curriculum
# Or poll: GET /v2/curriculum/cur_8f92j10x/status/v2/curriculum/generateGenerate a full structured curriculum. Returns job_id for async polling or webhook.
/v2/curriculum/:id/statusPoll generation progress. Returns current gate stage and completion percentage.
/v2/curriculum/:idRetrieve completed curriculum — full module/lesson JSON with estimates and objectives.
/v2/curriculum/:id/lesson/:lidRewrite any lesson in-place with a natural-language instruction string.
/v2/explainExplain any concept at configurable depth, audience level, and format.
/v2/keysIssue a new API key with quota, rate limit, and role configuration.
/v2/keys/:id/usageRetrieve usage, quota consumed, cache hit rate, and cost breakdown per key.
/v2/webhooksRegister a webhook endpoint to receive curriculum.completed events on generation finish.
Every endpoint requires a valid issued key via the x-api-key header. Keys are scoped per organization, carry quota limits, and can be rotated or revoked without touching your integration.
x-api-key: mk_live_your_key_here
curriculum:generateTrigger curriculum generation jobscurriculum:readRetrieve generated curricula and statuscurriculum:editRewrite lessons via Edit & Explain APIkeys:manageIssue, rotate, and revoke API keyswebhooks:writeRegister and manage webhook endpointsimport MentrastClient from "@mentrast/sdk";
const client = new MentrastClient({
apiKey: process.env.MENTRAST_API_KEY,
});
// Generate a full curriculum — async, non-blocking
const { id, job_id } = await client.curriculum.generate({
topic: "Advanced Node.js Microservices",
timeframe: "6 months",
complexity: "advanced",
options: {
diagnosticFirst: true,
webhookUrl: "https://your-app.com/hooks/mentrast",
},
});
// Poll for completion
const result = await client.curriculum.waitForCompletion(id);
console.log(`Generated ${result.meta.total_lessons} lessons across ${result.meta.total_modules} modules`);
// Edit any lesson with natural language
await client.curriculum.editLesson(id, result.modules[0].lessons[0].index, {
instruction: "Make this lesson more Socratic with embedded questions",
});{
"event": "curriculum.completed",
"curriculum_id": "cur_8f92j10x",
"job_id": "job_4aa19z02",
"timestamp": "2026-05-08T21:04:33Z",
"status": "active",
"generation_ms": 7840,
"cache_hit": false,
"meta": {
"total_modules": 10,
"total_lessons": 47,
"estimated_hours": 186
},
"retrieve": "GET https://api.mentrast.com/v2/curriculum/cur_8f92j10x"
}Invalid parameters or malformed JSON
Missing or invalid x-api-key header
Key lacks required scope for endpoint
Curriculum or resource ID doesn't exist
Quota exhausted — check Retry-After header
Include x-request-id when contacting support
