Create media asset
curl --request POST \
--url https://api.thehaystack.ai/v2/haystack/media/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"itemId": 123,
"variantTypeId": 123,
"mimeType": "video/mp4",
"originalFilename": "<string>",
"externalPlatformId": "dQw4w9WgXcQ"
}
'{
"mediaAsset": {
"id": 123,
"itemId": 123,
"item": {
"id": 123,
"title": "The Power of Prayer",
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"date": "2025-01-15",
"collectionId": 123,
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"durationSecs": 123,
"publishedDate": "2023-11-07T05:31:56Z",
"autoPublish": true,
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"verticalImgUrl": "<string>",
"entryDate": "2023-11-07T05:31:56Z",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
},
"series": {
"id": 123,
"title": "The Gospel of John",
"subTitle": "<string>",
"collectionId": 123,
"description": "<string>",
"shortDescription": "<string>",
"sortOrder": 123,
"itemSortDirection": "DESC",
"showItemOrderInSeries": true,
"urlSlug": "<string>",
"colorHex": "#FF5733",
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"published": true,
"verticalImgUrl": "<string>",
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {},
"items": "<array>",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
}
},
"speakers": [
{
"id": 123,
"name": "Pastor John Smith",
"bio": "<string>",
"imageUrl": "<string>",
"imageFilename": "<string>",
"itemCount": 123
}
],
"scriptures": [
{
"id": 123,
"itemId": 123,
"book": "<string>",
"bookName": "Matthew",
"chapter": 123,
"verseStart": 123,
"verseEnd": 123,
"keyVerse": true,
"suggested": true,
"accepted": true,
"displayOrder": 123,
"citation": "Matthew 5:1-12",
"hidden": true
}
],
"mediaAssets": "<array>",
"resources": [
{
"id": 123,
"itemId": 123,
"title": "<string>",
"subTitle": "<string>",
"description": "<string>",
"resourceTypeId": 123,
"displayOrder": 123,
"fileMimeType": "<string>",
"fileSizeBytes": 123,
"externalPlatformId": "<string>",
"thumbnailImgUrl": "<string>",
"url": "<string>",
"resourceType": {
"id": 123,
"name": "<string>"
},
"linkTarget": "<string>"
}
],
"suggestedDescription": "<string>",
"suggestedShortDescription": "<string>",
"errorMessage": "<string>",
"indexedMediaAssetId": 123,
"autoAcceptScriptures": true,
"autoAcceptMediaChapters": true,
"transcriptUrl": "<string>",
"topics": [
{
"id": 123,
"name": "<string>",
"itemCount": 123
}
],
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {}
},
"mimeType": "<string>",
"variantTypeId": 123,
"variantType": {
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
},
"fileSizeBytes": 123,
"durationSecs": 123,
"bitrate": 123,
"videoWidth": 123,
"videoHeight": 123,
"filename": "<string>",
"originalFilename": "<string>",
"externalPlatformId": "<string>",
"muxAssetId": "<string>",
"muxPlaybackId": "<string>",
"url": "<string>",
"downloadUrl": "<string>",
"chapters": [
{
"id": 123,
"itemId": 123,
"mediaAssetId": 123,
"title": "Introduction",
"startMs": 123,
"suggested": true,
"accepted": true,
"hidden": true
}
],
"entryDate": "2023-11-07T05:31:56Z"
},
"uploadUrl": "https://storage.example.com/upload/abc123?signature=xyz"
}Media
Create Media Asset
Create a new media asset and receive an upload URL. Returns a secure upload URL where you can upload your video/audio file (max 5GB). If using YouTube or Vimeo for playback, provide externalPlatform and externalPlatformId, but you must still upload the original file to the returned uploadUrl for AI processing.
POST
/
media
/
create
Create media asset
curl --request POST \
--url https://api.thehaystack.ai/v2/haystack/media/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"itemId": 123,
"variantTypeId": 123,
"mimeType": "video/mp4",
"originalFilename": "<string>",
"externalPlatformId": "dQw4w9WgXcQ"
}
'{
"mediaAsset": {
"id": 123,
"itemId": 123,
"item": {
"id": 123,
"title": "The Power of Prayer",
"subTitle": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"date": "2025-01-15",
"collectionId": 123,
"seriesId": 123,
"orderInSeries": 123,
"urlSlug": "<string>",
"durationSecs": 123,
"publishedDate": "2023-11-07T05:31:56Z",
"autoPublish": true,
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"verticalImgUrl": "<string>",
"entryDate": "2023-11-07T05:31:56Z",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
},
"series": {
"id": 123,
"title": "The Gospel of John",
"subTitle": "<string>",
"collectionId": 123,
"description": "<string>",
"shortDescription": "<string>",
"sortOrder": 123,
"itemSortDirection": "DESC",
"showItemOrderInSeries": true,
"urlSlug": "<string>",
"colorHex": "#FF5733",
"squareImgUrl": "<string>",
"wideImgUrl": "<string>",
"ultraWideImgUrl": "<string>",
"published": true,
"verticalImgUrl": "<string>",
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {},
"items": "<array>",
"collection": {
"id": 1,
"name": "Sunday Sermons",
"fullService": false,
"variantTypes": [
{
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
}
]
}
},
"speakers": [
{
"id": 123,
"name": "Pastor John Smith",
"bio": "<string>",
"imageUrl": "<string>",
"imageFilename": "<string>",
"itemCount": 123
}
],
"scriptures": [
{
"id": 123,
"itemId": 123,
"book": "<string>",
"bookName": "Matthew",
"chapter": 123,
"verseStart": 123,
"verseEnd": 123,
"keyVerse": true,
"suggested": true,
"accepted": true,
"displayOrder": 123,
"citation": "Matthew 5:1-12",
"hidden": true
}
],
"mediaAssets": "<array>",
"resources": [
{
"id": 123,
"itemId": 123,
"title": "<string>",
"subTitle": "<string>",
"description": "<string>",
"resourceTypeId": 123,
"displayOrder": 123,
"fileMimeType": "<string>",
"fileSizeBytes": 123,
"externalPlatformId": "<string>",
"thumbnailImgUrl": "<string>",
"url": "<string>",
"resourceType": {
"id": 123,
"name": "<string>"
},
"linkTarget": "<string>"
}
],
"suggestedDescription": "<string>",
"suggestedShortDescription": "<string>",
"errorMessage": "<string>",
"indexedMediaAssetId": 123,
"autoAcceptScriptures": true,
"autoAcceptMediaChapters": true,
"transcriptUrl": "<string>",
"topics": [
{
"id": 123,
"name": "<string>",
"itemCount": 123
}
],
"squareImgMetadata": {},
"wideImgMetadata": {},
"ultraWideImgMetadata": {},
"verticalImgMetadata": {}
},
"mimeType": "<string>",
"variantTypeId": 123,
"variantType": {
"id": 123,
"name": "Sermon Video",
"indexable": true,
"displayOrder": 123,
"collectionId": 123
},
"fileSizeBytes": 123,
"durationSecs": 123,
"bitrate": 123,
"videoWidth": 123,
"videoHeight": 123,
"filename": "<string>",
"originalFilename": "<string>",
"externalPlatformId": "<string>",
"muxAssetId": "<string>",
"muxPlaybackId": "<string>",
"url": "<string>",
"downloadUrl": "<string>",
"chapters": [
{
"id": 123,
"itemId": 123,
"mediaAssetId": 123,
"title": "Introduction",
"startMs": 123,
"suggested": true,
"accepted": true,
"hidden": true
}
],
"entryDate": "2023-11-07T05:31:56Z"
},
"uploadUrl": "https://storage.example.com/upload/abc123?signature=xyz"
}Authorizations
Enter your API token from the Haystack dashboard
Body
application/json
The item this media belongs to
The type of media content
Available options:
audio, video The variant type ID for this media asset (e.g., original, sermon audio, full service)
MIME type of the file being uploaded
Example:
"video/mp4"
Original filename of the uploaded file
Platform for external video playback (video content only)
Available options:
youtube, vimeo Video ID on the external platform (required if externalPlatform is set)
Example:
"dQw4w9WgXcQ"
⌘I

