{
  "openapi": "3.1.0",
  "info": {
    "title": "MiniMax API",
    "description": "MiniMax video generation and file management API",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.minimax.io"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/files/retrieve": {
      "get": {
        "summary": "Retrieve File",
        "operationId": "retrieveFile",
        "tags": ["Files"],
        "parameters": [
          {
            "name": "file_id",
            "in": "query",
            "required": true,
            "description": "The unique identifier for the file.\nSupports `file_id` obtained from video generation and asynchronous speech synthesis tasks.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetrieveFileResp"
                }
              }
            }
          }
        }
      }
    },
    "/v1/query/video_generation": {
      "get": {
        "summary": "Query Video Generation Task",
        "operationId": "queryVideoGenerationTask",
        "tags": ["Video"],
        "parameters": [
          {
            "name": "task_id",
            "in": "query",
            "required": true,
            "description": "The task ID to query. Only tasks created under the current account can be queried.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QueryVideoGenerationTaskResp"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RetrieveFileResp": {
        "type": "object",
        "properties": {
          "file": {
            "$ref": "#/components/schemas/FileObject"
          },
          "base_resp": {
            "$ref": "#/components/schemas/RetrieveFileBaseResp"
          }
        },
        "example": {
          "file": {
            "file_id": "${file_id}",
            "bytes": 0,
            "created_at": 1700469398,
            "filename": "output_aigc.mp4",
            "purpose": "video_generation",
            "download_url": "www.downloadurl.com"
          },
          "base_resp": {
            "status_code": 0,
            "status_msg": "success"
          }
        }
      },
      "FileObject": {
        "type": "object",
        "properties": {
          "file_id": {
            "type": "integer",
            "format": "int64",
            "description": "The unique identifier for the file."
          },
          "bytes": {
            "type": "integer",
            "format": "int64",
            "description": "The size of the file in bytes."
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "The Unix timestamp (in seconds) when the file was created."
          },
          "filename": {
            "type": "string",
            "description": "The name of the file."
          },
          "purpose": {
            "type": "string",
            "description": "The purpose of the file."
          },
          "download_url": {
            "type": "string",
            "format": "url",
            "description": "The URL address for downloading the file, valid for 1 hour."
          }
        }
      },
      "RetrieveFileBaseResp": {
        "type": "object",
        "properties": {
          "status_code": {
            "type": "integer",
            "description": "The status codes are as follows:\n- 1000, Unknown error;\n- 1001, Timeout;\n- 1002, RPM limit triggered;\n- 1004, Authentication failed;\n- 1008, Insufficient balance;\n- 1013, Internal service error;\n- 1026, Input content error;\n- 1027, Output content error;\n- 1039, TPM limit triggered;\n- 2013, Abnormal input format.\n\n For more information, please refer to the [Error Code Reference](/api-reference/errorcode)."
          },
          "status_msg": {
            "type": "string",
            "description": "Status details."
          }
        }
      },
      "QueryVideoGenerationTaskResp": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string",
            "description": "The queried task ID."
          },
          "status": {
            "$ref": "#/components/schemas/VideoProcessStatus"
          },
          "file_id": {
            "type": "string",
            "description": "Returned when the task succeeds. Represents the file ID of the generated video."
          },
          "video_width": {
            "type": "integer",
            "description": "Returned when the task succeeds. The width of the generated video (in pixels)."
          },
          "video_height": {
            "type": "integer",
            "description": "Returned when the task succeeds. The height of the generated video (in pixels)."
          },
          "base_resp": {
            "$ref": "#/components/schemas/QueryVideoGenerationTaskBaseResp"
          }
        },
        "example": {
          "task_id": "176843862716480",
          "status": "Success",
          "file_id": "176844028768320",
          "video_width": 1920,
          "video_height": 1080,
          "base_resp": {
            "status_code": 0,
            "status_msg": "success"
          }
        }
      },
      "QueryVideoGenerationTaskBaseResp": {
        "type": "object",
        "properties": {
          "status_code": {
            "type": "integer",
            "description": "The status codes are as follows:\n- `0`, Request successful;\n- `1002`,  Rate limit triggered, retry later\n- `1004`, Authentication failed, check API Key\n- `1026`, Contains sensitive content in the input\n- `1027`, Contains sensitive content in the generated video\n\n For more information, please refer to the [Error Code Reference](/api-reference/errorcode)."
          },
          "status_msg": {
            "type": "string",
            "description": "Status message. Returns `success` when successful."
          }
        }
      },
      "VideoProcessStatus": {
        "type": "string",
        "enum": ["Preparing", "Queueing", "Processing", "Success", "Fail"],
        "description": "The current status of the task. Possible values:\n- `Preparing` – Preparing\n- `Queueing` – In queue\n- `Processing` – Generating\n- `Success` – Completed successfully\n- `Fail` – Failed"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "`HTTP: Bearer Auth`\n- Security Scheme Type: http\n- HTTP Authorization Scheme: `Bearer API_key`, can be found in [Account Management>API Keys](https://platform.minimax.io/user-center/basic-information/interface-key)."
      }
    }
  }
}
