LectureAttachment
Defined in: v1/schemas.ts:424
An attachment on a lecture. The shape varies depending on the kind field.
Remarks
Section titled “Remarks”kind values and their behaviour:
| Kind | name |
url |
text |
file_size |
quiz |
|---|---|---|---|---|---|
text |
null |
null |
HTML string | null |
null |
code_display |
null |
null |
HTML string | null |
null |
code_embed |
null |
null |
HTML string | null |
null |
native_comments |
null |
null |
null |
null |
null |
upsell |
null |
null |
null |
null |
null |
video |
filename | CDN URL | null |
bytes | null |
audio |
filename | CDN URL | null |
bytes | null |
image |
filename | CDN URL | null |
bytes | null |
pdf |
filename | CDN URL | null |
bytes | null |
pdf_embed |
filename | CDN URL | null |
0 |
null |
embed |
source URL | embed URL | null |
absent | null |
quiz |
null |
null |
null |
null |
quiz object |
kind is an open string. The table above covers the kinds observed in
live responses, but Teachable documents kind as an unconstrained string and
ships new values without notice. Never assume the list is complete — see
KNOWN_LECTURE_ATTACHMENT_KINDS and isKnownAttachmentKind.
pdf vs pdf_embed — both are PDF attachments backed by a CDN URL.
pdf_embed is returned when the PDF is rendered inline in the lecture player
rather than offered as a download. Observed returning file_size: 0 and
file_extension: "pdf". Treat the two kinds identically for content purposes.
embed — third-party embedded content such as a YouTube video. Departs
from the documented name behaviour: rather than being null for a non-file
kind, name holds the original source URL the author pasted in, while url
holds the provider’s embeddable equivalent. file_size and file_extension
are omitted from the response entirely rather than returned as null.
text — contains raw HTML for text, code_display, and code_embed kinds.
Sanitise before rendering directly in a browser context.
position — documented as required but may be null in some responses.
url for video kind — points to the original upload URL, not a
streamable URL. Use CoursesAPI.getVideo with the attachment id
to retrieve a playable HLS stream URL.
file_size — documented as file size in bytes for video, audio, image,
and PDF attachments, but observed returning 0 for video files in live
API responses. Do not rely on this value for video attachments.
Extends
Section titled “Extends”output<typeofLectureAttachmentSchema>
Properties
Section titled “Properties”file_extension?
Section titled “file_extension?”
optionalfile_extension?:string|null
Defined in: v1/schemas.ts:367
Inherited from
Section titled “Inherited from”z.infer.file_extension
file_size?
Section titled “file_size?”
optionalfile_size?:number|null
Defined in: v1/schemas.ts:366
Inherited from
Section titled “Inherited from”z.infer.file_size
id:
number
Defined in: v1/schemas.ts:360
Inherited from
Section titled “Inherited from”z.infer.id
kind:
LectureAttachmentKind
Defined in: v1/schemas.ts:362
Inherited from
Section titled “Inherited from”z.infer.kind
name:
string|null
Defined in: v1/schemas.ts:361
Inherited from
Section titled “Inherited from”z.infer.name
position
Section titled “position”position:
number|null
Defined in: v1/schemas.ts:365
Inherited from
Section titled “Inherited from”z.infer.position
optionalquiz?: {id:number;questions: {answers:string[];correct_answers:string[];graded:boolean;question:string;question_type:"single"|"multiple"; }[]; } |null
Defined in: v1/schemas.ts:368
Inherited from
Section titled “Inherited from”z.infer.quiz
optionaltext?:string|null
Defined in: v1/schemas.ts:364
Inherited from
Section titled “Inherited from”z.infer.text
optionalurl?:string|null
Defined in: v1/schemas.ts:363
Inherited from
Section titled “Inherited from”z.infer.url