---
title: "Generate asset upload urls"
method: POST
path: "/v1/files/upload-urls"
tags: ["Files"]
---

# Generate asset upload urls

`POST /v1/files/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](https://docs.magichour.ai/integration/inputs-and-outputs) 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>
```

## Request body

- object
  - `items` object[], required — The list of assets to upload. The response array will match the order of items in the request body.
    - `type` 'video' | 'audio' | 'image', required — The type of asset to upload. Possible types are video, audio, image
    - `extension` string, required — The extension of the file to upload. Do not include the dot (.) before the extension. Possible extensions are mp4,m4v,mov,webm,mp3,wav,aac,flac,webm,weba,m4a,opus,ogg,oga,aiff,amr,png,jpg,jpeg,jfif,heic,heif,webp,avif,jp2,tiff,tif,bmp,gif,webp,webm

## Response `200`

Success

- object — Success
  - `items` object[], required — The list of upload URLs and file paths for the assets. The response array will match the order of items in the request body. Refer to the [Input Files Guide](https://docs.magichour.ai/integration/inputs-and-outputs) for more details.
    - `upload_url` string, uri, required — Used to upload the file to storage, send a PUT request with the file as data to upload.
    - `expires_at` string, date-time, required — when the upload url expires, and will need to request a new one.
    - `file_path` string, required — this value is used in APIs that needs assets, such as image_file_path, video_file_path, and audio_file_path

## Other responses

- `400` — Invalid Request
- `401` — Unauthorized
- `402` — Payment Required
- `404` — Not Found
- `422` — Unprocessable Entity

---

[API](https://skmtc.net/magichourhq/apis/magic-hour-api.md) · [All operations](https://skmtc.net/magichourhq/apis/magic-hour-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/magichourhq/magic-hour-api/revisions/d03d90b0b8e0/schema)
