Skip to main content
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,
  "contentType": "audio",
  "variantTypeId": 123,
  "mimeType": "video/mp4",
  "originalFilename": "<string>",
  "externalPlatform": "youtube",
  "externalPlatformId": "dQw4w9WgXcQ"
}
'
{
  "mediaAsset": {
    "id": 123,
    "itemId": 123,
    "contentType": "video",
    "status": "created",
    "duration": 123,
    "muxAssetId": "<string>",
    "muxPlaybackId": "<string>",
    "variantTypeId": 123,
    "variantType": {
      "id": 123,
      "name": "Sermon Video",
      "contentType": "video",
      "indexable": true,
      "displayOrder": 123,
      "collectionId": 123
    }
  },
  "uploadUrl": "https://storage.example.com/upload/abc123?signature=xyz"
}

Authorizations

Authorization
string
header
required

Enter your API token from the Haystack dashboard

Body

application/json
itemId
integer
required

The item this media belongs to

contentType
enum<string>
required

The type of media content

Available options:
audio,
video
variantTypeId
integer
required

The variant type ID for this media asset (e.g., original, sermon audio, full service)

mimeType
string

MIME type of the file being uploaded

Example:

"video/mp4"

originalFilename
string

Original filename of the uploaded file

externalPlatform
enum<string>

Platform for external video playback (video content only)

Available options:
youtube,
vimeo
externalPlatformId
string

Video ID on the external platform (required if externalPlatform is set)

Example:

"dQw4w9WgXcQ"

Response

200 - application/json

Media asset created with upload URL

mediaAsset
object
uploadUrl
string

Secure URL to upload your video/audio file (PUT request)

Example:

"https://storage.example.com/upload/abc123?signature=xyz"