Media (Union Type)
TheMedia type is a union of UserMedia and SocialAudio. When fetching media, you can differentiate between them using the media_type field.
UserMedia
Represents uploaded media files (images, videos, audio).| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
org_id | string | Organization ID |
name | string | null | File name |
tag | string | null | Custom tag for categorization |
type | 'video' | 'image' | 'audio' | null | Media type |
url | string | URL to fetch the file (via API proxy) |
created_at | string | ISO timestamp of creation |
media_type | 'user_media' | Discriminator field |
Example UserMedia Object
SocialAudio
Represents audio imported from TikTok videos or music links.| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
org_id | string | Organization ID |
name | string | null | Audio/song title |
tag | string | null | Custom tag for categorization |
social_post_link | string | null | Link to a TikTok post using this audio |
social_audio_link | string | null | Direct link to the TikTok audio/music page |
platform_type | 'tiktok' | null | Source platform |
preview_url | string | null | URL to fetch cover image (via API proxy) |
audio_url | string | null | URL to fetch audio file (via API proxy) |
created_at | string | ISO timestamp of creation |
media_type | 'social_audio' | Discriminator field |
type | 'social_audio' | Type field for compatibility |
Example SocialAudio Object
Type Checking
When working with theMedia union type, use the media_type field to determine the specific type:
