Add or update a rich-text lesson material.
Creates a rich-text material in a lesson or live session, or overwrites an existing one when materialId is sent. For assignment instructions send viewType 4.
Endpoint
post https://{TrainerCentral-API-Domain}/tc/api/v1/trainer/session/{sessionId}/createTextFile.json
OAuth Scope
Headers
ID of the academy (orgId).
Path Parameters
ID of the session (sessionId): a course lesson or a live workshop.
Request Body
application/jsonContent of the text material. Supports rich text.
Display name of the text material. Max 100 characters.
ID of an existing text material of this session to overwrite. Omit it to create a new one.
Placement of a new text material. Allowed: 0=Session content (default), 4=Instruction (assignment lessons; required there).
curl --request POST \
--url https://trainercentral.zoho.com/tc/api/v1/trainer/session/{sessionId}/createTextFile.json \
--header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
--header 'content-type: application/json' \
--header 'tc-orgId: 51517414' \
--data '{"richTextContent":"<p>Course Introduction</p><p>This course covers the basics of Python.</p>","filename":"Introduction","viewType":0}' {
"richTextContent": "<p>Course Introduction</p><p>This course covers the basics of Python.</p>",
"filename": "Introduction",
"viewType": 0
}
{
"richTextContent": "<p>Assignment Instructions</p><p>Write a script that prints the first 10 primes.</p>",
"filename": "Assignment Instructions",
"viewType": 4
}
{
"richTextContent": "<p>Course Introduction</p><p>This course now also covers functions.</p>",
"filename": "Introduction",
"materialId": 3000000000120
}
Response Parameters
One attachment. Returned for a get, a link or embed update, or a text material update.
Hide Sub-Attributes
ID of the attachment (sessionMaterialId).
Same as sessionMaterialId.
ID of the lesson or live session.
Same as sessionId.
ID of the file record (materials[].id). Absent for links and embeds.
Same as materialId.
ID of the stored file or, for a test (resourceType 20), the test form UUID.
Type of the material. Live sessions use presentation, video and PDF only; on-demand lessons may also use link, embed, image, document, spreadsheet, zip, audio, rich text, recorded video and test. Allowed: 1=Presentation, 5=PDF, 6=Video, 7=Link, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Embed (iframe), 20=Test.
Placement of the material. Allowed: 0=Session content, 1=Handout, 2=Assessment (tests), 4=Instruction (assignment lessons).
Zero-based position of the material in the session.
Display name of the material: the file name or the link title.
URL to view a file-based material. Absent for links and embeds.
Title of a link (resourceType 7) or embed (resourceType 15).
URL of a link material (resourceType 7).
Iframe HTML of an embed material (resourceType 15).
true when the file was deleted from the library.
Time attached, in epoch milliseconds.
File record of sessionMaterial. Absent for links and embeds.
Hide Sub-Attributes
ID of the file record.
File name of the material.
Type of the file. Allowed: 1=Presentation, 5=PDF, 6=Video, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Subtitle.
File size in bytes.
Processing status. Allowed: -1=Scheduled, 0=Processing, 1=Uploaded, 2=Failed, 3=Converting, 4=Ready, 5=No preview.
URL to view the file.
Internal rendering service code.
Internal storage service code.
Attachments of the session. Returned after an add, a reorder or a new text material.
Hide Sub-Attributes
Show Sub-Attributes
ID of the attachment (sessionMaterialId).
Same as sessionMaterialId.
ID of the lesson or live session.
Same as sessionId.
ID of the file record (materials[].id). Absent for links and embeds.
Same as materialId.
ID of the stored file or, for a test (resourceType 20), the test form UUID.
Type of the material. Live sessions use presentation, video and PDF only; on-demand lessons may also use link, embed, image, document, spreadsheet, zip, audio, rich text, recorded video and test. Allowed: 1=Presentation, 5=PDF, 6=Video, 7=Link, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Embed (iframe), 20=Test.
Placement of the material. Allowed: 0=Session content, 1=Handout, 2=Assessment (tests), 4=Instruction (assignment lessons).
Zero-based position of the material in the session.
Display name of the material: the file name or the link title.
URL to view a file-based material. Absent for links and embeds.
Title of a link (resourceType 7) or embed (resourceType 15).
URL of a link material (resourceType 7).
Iframe HTML of an embed material (resourceType 15).
true when the file was deleted from the library.
Time attached, in epoch milliseconds.
File records of the file-based entries.
Hide Sub-Attributes
Show Sub-Attributes
ID of the file record.
File name of the material.
Type of the file. Allowed: 1=Presentation, 5=PDF, 6=Video, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Subtitle.
File size in bytes.
Processing status. Allowed: -1=Scheduled, 0=Processing, 1=Uploaded, 2=Failed, 3=Converting, 4=Ready, 5=No preview.
URL to view the file.
Internal rendering service code.
Internal storage service code.
Error details.
Hide Sub-Attributes
Deprecated numeric error code (for example ST_202). Prefer codeStr; omitted from doc samples.
Error code name (ShowtimeErrorCode / err_code_str), for example MISSING_PARAMETER.
Error message.
Possible Error Codes
| HTTP Code | Error Code | Description |
|---|---|---|
| 500 | ST_79 | INVALID_SESSION - The sessionId does not match a session in this academy. Pass a valid sessionId. Do not retry unchanged. |
| ST_401 | SESSION_DELETED - The session was deleted. Use a session that is not deleted. Do not retry unchanged. | |
| ST_102 | UNAUTHORISED_ACCESS - The user lacks a required role, or the assignment already has an instruction text. Use an owner, admin or trainer of the session or course, or send the existing materialId. Do not retry unchanged. | |
| ST_84 | INVALID_ACTION - materialId is not a material of this session. Pass a materialId of this session, or leave it out to create one. Do not retry unchanged. |
{
"sessionMaterials": [
{
"sessionMaterialId": "3000000000110",
"id": "3000000000110",
"sessionId": "3000000000040",
"materialId": "3000000000120",
"resourceType": "10",
"viewType": "0",
"sessionMaterialIndex": "0",
"topic": "Introduction",
"time": "1782727715513"
}
],
"materials": [
{
"id": "3000000000120",
"name": "Introduction",
"materialType": "10",
"size": "256",
"status": "1"
}
]
}
{
"sessionMaterial": {
"sessionMaterialId": "3000000000110",
"id": "3000000000110",
"sessionId": "3000000000040",
"materialId": "3000000000120",
"resourceType": "10",
"viewType": "0",
"sessionMaterialIndex": "0",
"topic": "Introduction"
},
"material": {
"id": "3000000000120",
"name": "Introduction",
"materialType": "10",
"size": "312",
"status": "1"
}
}
{
"error": {
"code": "string",
"codeStr": "string",
"message": "string"
}
}
500 Request failed; see the error code.Rate Limits
Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.
© 2026, Zoho Corporation Pvt. Ltd. All Rights Reserved.