Create a lesson in a course chapter.

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Creates an on-demand (deliveryMode 4), live session (3) or assignment (7) lesson in a chapter of a course. New lessons are drafts until published with Update Course Lesson.

Endpoint

post https://{TrainerCentral-API-Domain}/tc/api/v1/trainer/sessions.json

OAuth Scope

TrainerCentral.sessionapi.CREATECopied!

Headers

tc-orgIdstring(Required)

ID of the academy (orgId).

Example
51517414

Request Body

application/json
sessionJSON Object(Required)

The lesson to create.

Hide Sub-Attributes
namestring(Optional)

Name of the lesson. Max 255 characters.

descriptionstring(Optional)

Description of the lesson. Supports rich text.

scheduledTimelong(Optional)

Live lessons only. Start time in epoch milliseconds, within 2 years. Default: now.

scheduledEndTimelong(Optional)

Live lessons only. End time in epoch milliseconds.

durationTimelong(Optional)

Live lessons only. Length in milliseconds, for example 3600000 for 1 hour.

timezonestring(Optional)

Live lessons only. IANA time zone of the schedule, for example Asia/Kolkata.

sessionSettingsJSON Object(Optional)

Settings of a live lesson.

Show Sub-Attributes
registrationRequiredboolean(Optional)

true makes learners register before they can join the live lesson.

recurringTypeinteger(Optional)

Schedule pattern. Must be 0 (One-time).

enableClientLoginboolean(Optional)

true lets only signed-in users join the live lesson.

courseIdlong(Optional)

ID of the course.

sectionIdlong(Optional)

ID of the chapter (section) to add the lesson to.

sessionIndexinteger(Optional)

Zero-based position of the lesson in the chapter. Default 0.

deliveryModestring(Optional)

Lesson type. Allowed: 3=Live session, 4=On-demand lesson, 7=Assignment.

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request POST \
  --url https://trainercentral.zoho.com/tc/api/v1/trainer/sessions.json \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: application/json' \
  --header 'tc-orgId: 51517414' \
  --data '{"session":{"name":"Python Basics - Variables","courseId":3000000000022,"sectionId":3000000000026,"sessionIndex":0,"deliveryMode":4}}'

Body Parameters

Create an on-demand lesson.

Create an on-demand lesson.

Create a live lesson.

Create an assignment lesson.

Copied!
  {
    "session": {
      "name": "Python Basics - Variables",
      "courseId": 3000000000022,
      "sectionId": 3000000000026,
      "sessionIndex": 0,
      "deliveryMode": 4
    }
  }
                
  {
    "session": {
      "name": "Live Doubt Clearing",
      "courseId": 3000000000022,
      "sectionId": 3000000000026,
      "sessionIndex": 1,
      "deliveryMode": 3,
      "scheduledTime": 1800419400000,
      "scheduledEndTime": 1800423000000,
      "durationTime": 3600000,
      "timezone": "Asia/Kolkata",
      "sessionSettings": {
        "recurringType": 0,
        "enableClientLogin": true,
        "registrationRequired": false
      }
    }
  }
                
  {
    "session": {
      "name": "Assignment - Loops",
      "courseId": 3000000000022,
      "sectionId": 3000000000026,
      "sessionIndex": 2,
      "deliveryMode": 7
    }
  }
                
▼ Show full

Response Parameters

sessionJSON Object

The new lesson, created as a draft.

Hide Sub-Attributes
sessionIdstring

ID of the lesson (sessionId).

idstring

Same as sessionId.

namestring

Name of the lesson.

descriptionstring

Description of the lesson. Supports rich text.

deliveryModestring

Lesson type. Allowed: 3=Live session, 4=On-demand lesson, 7=Assignment.

sessionIndexstring

Zero-based position of the lesson in its chapter.

sectionIdstring

ID of the chapter (section) that holds the lesson.

courseIdstring

ID of the course the lesson belongs to.

orgIdstring

ID of the academy (orgId).

enableDraftstring

true when the lesson is a draft, hidden from learners.

enablePrerequisitestring

true when learners must complete this lesson before later lessons.

publishStatusstring

Publish status of the lesson. Allowed: 0=Unpublished, 1=Published.

scheduledTimestring

Live lessons only. Start time in epoch milliseconds.

scheduledEndTimestring

Live lessons only. End time in epoch milliseconds.

timezonestring

Live lessons only. IANA time zone, for example Asia/Kolkata.

scheduleTypestring

Schedule type. Allowed: 0=One-time, 1=Recurring. Always 0 for lessons.

kindstring

Visibility. Allowed: 0=Default, 1=Featured.

scheduledBystring

User ID of the trainer who created the lesson.

coursestring

Same as courseId.

createdTimestring

Creation time in epoch milliseconds.

sessionMembersJSON Array

Trainers of the lesson; the creator is the primary trainer (role 1).

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
sessionMemberIdstring

ID of the session member (registration).

emailIdstring

Email address of the member.

namestring

Name of the member.

userIdstring

User ID of the member.

sessionIdstring

ID of the session.

orgIdstring

ID of the academy (orgId).

rolestring

Role in the session. Allowed: 1=Trainer, 2=Co-trainer, 3=Learner, 4=Guest presenter.

idstring

Same as sessionMemberId.

statusstring

Registration status. Allowed: 1=Registered, 0=Invited, -1=Waiting for approval, -2=Denied, -3=Cancelled by learner, -4=Invitation cancelled.

registerstring

true when the learner has registered.

sourcestring

How the member was added. Allowed: 1=Invited, 2=Self registration, 3=CRM, 4=Zapier invite, 5=Zapier registration, 6=Zoho Flow invite, 7=Zoho Flow registration.

paymentStatusstring

Allowed: 0=Yet to pay, 1=Paid, 2=Failed, 3=Cancelled, 4=Refunded, 5=Unpaid (inactive), 6=Unpaid, -2=Pending.

orgMemberIdstring

Academy member ID.

createdTimestring

Added time in epoch milliseconds.

lastUpdatedTimestring

Last updated time in epoch milliseconds.

mailStatusstring

Invite mail status. Allowed: 0=Not sent, 1=Sent, 2=Failed.

sessionCategoriesJSON Array

Categories of the lesson.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
categoryNamestring

Name of the category.

categoryIdstring

ID of the category.

talksJSON Array

Occurrence record of the lesson; for a live lesson, talkId is the occurrence.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
talkIdstring

ID of the occurrence (talkId).

namestring

Name of the occurrence.

sessionIdstring

ID of the live session.

orgIdstring

ID of the academy (orgId).

statusstring

Status of the occurrence. Allowed: 0=Yet to start, 1=Scheduled, 2=Projected, 3=Started, 4=Suspended, 5=Completed, 6=Orphaned, 7=Cancelled.

registeredCountstring

Number of registered learners.

scheduledTimestring

Start time in epoch milliseconds.

scheduledEndTimestring

End time in epoch milliseconds.

deliveryModestring

Delivery mode. Allowed: 3=Live session, 4=On-demand, 7=Assignment.

idstring

Same as talkId.

ownerstring

User ID of the trainer who owns the occurrence.

errorJSON Object

Error details.

Hide Sub-Attributes
codestring

Deprecated numeric error code (for example ST_202). Prefer codeStr; omitted from doc samples.

codeStrstring

Error code name (ShowtimeErrorCode / err_code_str), for example MISSING_PARAMETER.

messagestring

Error message.

Possible Error Codes

HTTP CodeError CodeDescription
500ST_94

INVALID_COURSE - The courseId does not match a course in this academy. Pass a valid courseId. Do not retry unchanged.

ST_406

FEATURE_NOT_AVAILABLE - Live lessons (3) or assignments (7) are not on the academy plan. Upgrade the plan or send deliveryMode 4. Do not retry unchanged.

ST_100

SESSION_DATE_LIMIT_EXCEED - scheduledTime is more than 2 years from now. Send a date within 2 years. Do not retry unchanged.

ST_102

UNAUTHORISED_ACCESS - The user is not an academy owner or admin or a course admin or trainer, or the course lets only its admins schedule sessions. Call with a permitted user; do not retry unchanged.

ST_76

SCHEDULE_SESSION_FAILED - The lesson could not be created, for example name or deliveryMode is missing or a value has the wrong type. Fix the body and send it again.

Response Example

Response after creating an on-demand lesson.

200
200
400
500
Copied!
  {
    "session": {
      "sessionId": "3000000000040",
      "id": "3000000000040",
      "name": "Python Basics - Variables",
      "deliveryMode": "4",
      "scheduleType": "0",
      "sessionIndex": "0",
      "publishStatus": "0",
      "kind": "0",
      "orgId": "51517414",
      "scheduledBy": "51456901",
      "createdTime": "1782727568966",
      "courseId": "3000000000022",
      "course": "3000000000022"
    },
    "sessionMembers": [
      {
        "sessionMemberId": "3000000000060",
        "id": "3000000000060",
        "sessionId": "3000000000040",
        "userId": "51456901",
        "name": "Priya Raman",
        "emailId": "priya.raman@example.com",
        "role": "1",
        "status": "1",
        "source": "1",
        "orgId": "51517414"
      }
    ],
    "talks": [
      {
        "talkId": "3000000000042",
        "id": "3000000000042",
        "sessionId": "3000000000040",
        "name": "Python Basics - Variables",
        "deliveryMode": "4",
        "orgId": "51517414"
      }
    ],
    "sessionCategories": []
  }
                
  {
    "error": {
      "code": "string",
      "codeStr": "string",
      "message": "string"
    }
  }
                
500 Request failed; see the error code.
▼ Show full