Skip to main content
POST
/
v1
/
video_template_generation
Video Template Generation
curl --request POST \
  --url https://api.minimax.io/v1/video_template_generation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "template_id": "393769180141805569",
  "media_inputs": [
    {
      "value": "https://cdn.hailuoai.com/prod/2024-09-18-16/user/multi_chat_file/9c0b5c14-ee88-4a5b-b503-4f626f018639.jpeg"
    }
  ],
  "text_inputs": [
    {
      "value": "Lion"
    }
  ]
}'
{
  "task_id": "401047179385389059",
  "base_resp": {
    "status_code": 0,
    "status_msg": "success"
  }
}

Authorizations

Authorization
string
header
required

HTTP: Bearer Auth

Headers

Content-Type
enum<string>
default:application/json
required

The media type of the request body. Must be set to application/json to ensure the data is sent in JSON format.

Available options:
application/json

Body

application/json
template_id
string
required

The ID of the video template. For details on available IDs and required inputs, see Video Agent Template List.

text_inputs
object[]

An array of text inputs used to fill the text fields in the template. The requirements vary by template.

media_inputs
object[]

An array of media inputs (e.g., images) used to fill the media fields in the template. The requirements vary by template.

callback_url
string

A callback URL to receive task status updates. You can configure this parameter to receive asynchronous notifications when the task status changes.

1. URL Verification: Once configured, the MiniMax server will send a POST request to the callback_url containing a challenge field. Your server must return the same challenge value within 3 seconds to complete verification.

2. Status Updates: After verification, MiniMax will push the latest task status to the callback URL whenever the task state changes. The pushed data structure is identical to the response body of the task query API.

The status field in the callback includes the following states:

  • processing - In progress
  • success - Completed successfully
  • failed - Failed

Callback Service Example:

from fastapi import FastAPI, HTTPException, Request
from fastapi.middleware.cors import CORSMiddleware
import json

app = FastAPI()

@app.post("/get_callback")
async def get_callback(request: Request):
try:
json_data = await request.json()
challenge = json_data.get("challenge")
if challenge is not None:
# Verification request, return challenge as is
return {"challenge": challenge}
else:
# Callback request, handle your own logic here
# Example payload:
# {
# "task_id": "115334141465231360",
# "status": "Success",
# "file_id": "205258526306433",
# "base_resp": {
# "status_code": 0,
# "status_msg": "success"
# }
# }
return {"status": "success"}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

if __name__ == "__main__":
import uvicorn
uvicorn.run(
app, # required
host="0.0.0.0", # required
port=8000, # required, can be customized
# ssl_keyfile="yourname.yourDomainName.com.key", # optional, enable SSL if needed
# ssl_certfile="yourname.yourDomainName.com.crt", # optional, enable SSL if needed
)

Response

200 - application/json
task_id
string

The unique ID of the task, used to query task status later.

base_resp
object

Contains the status code and message.