File Upload API

MuAPI provides a unified interface for uploading media assets (images and videos) to be used as inputs for various AI models and workflows.

Endpoints

1. Direct File Upload

POST /upload_file

Upload a file directly as multipart/form-data.

Request:

  • Method: POST
  • Authentication: x-api-key Header
  • Content-Type: multipart/form-data
  • Body: file (the file to upload)

Limits:

  • Images: 10MB (formats: .jpg, .png, .webp, etc.)
  • Videos: 50MB (formats: .mp4, .mov, etc.)

Example (Curl):

curl -X POST "https://api.muapi.ai/api/v1/upload_file" \
     -H "x-api-key: YOUR_API_KEY" \
     -H "Content-Type: multipart/form-data" \
     -F "file=@/path/to/your/image.jpg"

Example (Python):

import requests

url = "https://api.muapi.ai/api/v1/upload_file"
headers = {"x-api-key": "YOUR_API_KEY"}
files = {"file": open("image.jpg", "rb")}

response = requests.post(url, headers=headers, files=files)
print(response.json())

Response:

{
  "url": "https://s3.amazonaws.com/muapi-assets/outputs/abc123_image.jpg"
}

Usage Requirements

  • Authentication: All requests must be authenticated using a valid API Key.
  • Credit Balance: While file uploads are free (no credits deducted), you must have a credit balance greater than 0 to use these endpoints. This prevents abuse and ensures service stability for all users.
  • Expiry: Presigned URLs expire after 1 hour. Uploaded files are typically stored for temporary use in subsequent AI generation tasks.

Soporteed File Types

CategorySize LimitCommon Extensions
Images10 MB.jpg, .png, .webp
Videos50 MB.mp4, .mov
Others10 MB.zip, .pdf, .json
File Upload API — Muapi Docs