Files

Generate asset upload urls

Generates a list of pre-signed upload URLs for the assets required. This API is only necessary if you want to upload to Magic Hour's storage. Refer to the Input Files Guide for more details.

The response array will match the order of items in the request body.

Valid file extensions per asset type:

  • video: mp4, m4v, mov, webm
  • audio: mp3, wav, aac, flac, webm, weba, m4a, opus, ogg, oga, aiff, amr
  • image: png, jpg, jpeg, jfif, heic, heif, webp, avif, jp2, tiff, tif, bmp
  • gif: gif, webp, webm

Note: gif is only supported for face swap API video_file_path field.

Once you receive an upload URL, send a PUT request to upload the file directly.

Example:

curl -X PUT --data '@/path/to/file/video.mp4' \
  https://videos.magichour.ai/api-assets/id/video.mp4?<auth params from the API response>
post/v1/files/upload-urls

Request body

Example request

{
  "items": [
    {
      "type": "video",
      "extension": "mp4"
    },
    {
      "type": "audio",
      "extension": "mp3"
    }
  ]
}

Response

Success

Example response

{
  "items": [
    {
      "upload_url": "https://videos.magichour.ai/api-assets/id/video.mp4?auth-value=1234567890",
      "expires_at": "2024-07-25T16:56:21.932Z",
      "file_path": "api-assets/id/video.mp4"
    },
    {
      "upload_url": "https://videos.magichour.ai/api-assets/id/audio.mp3?auth-value=1234567890",
      "expires_at": "2024-07-25T16:56:21.932Z",
      "file_path": "api-assets/id/audio.mp3"
    }
  ]
}

Changes

Changed in 2 of the 59 revisions of this API.9

    • added the non-success response with the status

      response-non-success-status-added

    • removed the Not Found enum value from the response property for the response status

      response-property-enum-value-removed

    • removed the Unauthorized enum value from the response property for the response status

      response-property-enum-value-removed

    • added the required property to the response with the status

      response-required-property-added

    • added the required property to the response with the status

      response-required-property-added

    • added the required property to the response with the status

      response-required-property-added

    • added the required property to the response with the status

      response-required-property-added

    • added the required property to the response with the status

      response-required-property-added

    • added the non-success response with the status

      response-non-success-status-added