{
  "openapi": "3.1.0",
  "info": {
    "title": "Submit Video API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/mj/submit/video": {
      "post": {
        "summary": "Submit Video",
        "operationId": "submit_video",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "motion",
                  "image"
                ],
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "Text prompt to guide the video generation."
                  },
                  "motion": {
                    "type": "string",
                    "description": "Motion intensity of the generated video.",
                    "enum": [
                      "low",
                      "high"
                    ],
                    "default": "low"
                  },
                  "image": {
                    "type": "string",
                    "description": "First-frame image as a public URL or base64-encoded data URI.",
                    "default": "https://your-image-host/source.jpg"
                  },
                  "action": {
                    "type": "string",
                    "description": "Action to perform on an existing video task. When set, `index` and `taskId` are required."
                  },
                  "index": {
                    "type": "integer",
                    "description": "Zero-based index selecting which video variant to act on from the parent task."
                  },
                  "taskId": {
                    "type": "string",
                    "description": "Parent task id to continue from. Required when `action` is set."
                  },
                  "state": {
                    "type": "string",
                    "description": "Custom state string. Returned as-is in the task result and webhook callback for your own tracking."
                  },
                  "noStorage": {
                    "type": "boolean",
                    "description": "When `true`, return the original provider video URL instead of a CometAPI-proxied link."
                  },
                  "videoType": {
                    "type": "string",
                    "description": "Video model variant, e.g. `vid_1.1_i2v_480` (480p) or `vid_1.1_i2v_720` (720p)."
                  }
                },
                "default": {
                  "motion": "low",
                  "image": "https://your-image-host/source.jpg"
                }
              },
              "examples": {
                "Image to video": {
                  "summary": "Image to video (replace the image URL with your first-frame image)",
                  "value": {
                    "prompt": "A Bee in Flight",
                    "motion": "low",
                    "image": "https://your-image-host/first-frame.png"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "description",
                    "result",
                    "properties"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "description": "Submission status code. `1` = submitted successfully (`result` carries the task id). `21` = the action opened a confirmation modal; continue with `/mj/submit/modal` using the returned task id. `4` = parameter error; `description` explains the cause."
                    },
                    "description": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    },
                    "properties": {
                      "type": "object",
                      "required": [
                        "prompt"
                      ],
                      "properties": {
                        "prompt": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "Default",
            "source": "curl https://api.cometapi.com/mj/submit/video \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"prompt\": \"The paper boat drifts slowly forward\",\n    \"motion\": \"low\",\n    \"image\": \"https://your-image-host/first-frame.png\",\n    \"videoType\": \"vid_1.1_i2v_480\"\n  }'\n"
          },
          {
            "lang": "Python",
            "label": "Default",
            "source": "import os\nimport requests\n\nresponse = requests.post(\n    \"https://api.cometapi.com/mj/submit/video\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]},\n    json={\n        \"prompt\": \"The paper boat drifts slowly forward\",\n        \"motion\": \"low\",\n        \"image\": \"https://your-image-host/first-frame.png\",\n        \"videoType\": \"vid_1.1_i2v_480\",\n    },\n)\n\ntask = response.json()\nprint(task[\"code\"], task.get(\"result\"))\n"
          },
          {
            "lang": "JavaScript",
            "label": "Default",
            "source": "const response = await fetch(\"https://api.cometapi.com/mj/submit/video\", {\n    method: \"POST\",\n    headers: {\n        Authorization: `Bearer ${process.env.COMETAPI_KEY}`,\n        \"Content-Type\": \"application/json\",\n    },\n    body: JSON.stringify({\n        prompt: \"The paper boat drifts slowly forward\",\n        motion: \"low\",\n        image: \"https://your-image-host/first-frame.png\",\n        videoType: \"vid_1.1_i2v_480\",\n    }),\n});\n\nconst task = await response.json();\nconsole.log(task.code, task.result);\n"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token authentication. Use your CometAPI key."
      }
    }
  }
}
