TagMangoTagMango Docs
Course

Create Chapter

POST
/api/v1/external/modules/{moduleId}/chapters

Create a new chapter inside an existing module.

  • When content and contentType are supplied, content processing (video transcoding / image compression) runs transparently.
  • Chapter name and description are required.
  • Course progress is recalculated automatically after each chapter creation.
AuthorizationBearer <token>

In: header

Path Parameters

moduleId*string

Module object id

Header Parameters

x-whitelabel-host*string

Host name of the dashboard, ex: mydomain.tagmango.com

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api-prod-new.tagmango.com/api/v1/external/modules/66c4964c11e7fef26751f3a7/chapters" \  -H "x-whitelabel-host: string" \  -H "Content-Type: application/json" \  -d '{    "title": "Introduction",    "description": "Chapter description",    "contentType": "video",    "content": "https://example.com/video.mp4"  }'
{
  "_id": "61e97c146cf2b4d8c68f3a40",
  "title": "Introduction to NestJS",
  "description": "Learn the basics of NestJS framework and its core concepts",
  "content": "https://example.com/video.mp4",
  "contentType": "video",
  "contentFileName": "chapter1_video.mp4",
  "contentSize": 1024000,
  "module": "61e97c146cf2b4d8c68f3a41",
  "creator": "61e97c146cf2b4d8c68f3a42",
  "course": "61e97c146cf2b4d8c68f3a44",
  "compressedVideoUrl": "https://example.com/compressed-video.mp4",
  "totalDuration": 1800,
  "assignment": "61e97c146cf2b4d8c68f3a45",
  "customThumbnail": true,
  "embeddedLink": "https://www.youtube.com/embed/dQw4w9WgXcQ",
  "createdAt": "2025-01-23T12:34:56Z",
  "updatedAt": "2025-01-24T12:34:56Z",
  "defaultThumbnail": "https://example.com/thumbnail.jpg",
  "isFree": false,
  "additionalContents": [
    "https://example.com/supplementary-material.pdf"
  ]
}
{
  "code": 400,
  "type": "Bad request",
  "statusMessage": "BAD_REQUEST",
  "message": "Invalid request",
  "success": false
}
{
  "code": 401,
  "type": "Unauthorized",
  "statusMessage": "UNAUTHORIZED",
  "message": "Invalid token",
  "success": false
}

{
  "code": 404,
  "type": "Not Found",
  "statusMessage": "NOT_FOUND",
  "errorCode": "MODULE_NOT_FOUND",
  "message": "The module does not exist or does not belong to this creator.",
  "result": "The module does not exist or does not belong to this creator.",
  "success": false
}