{
  "openapi": "3.1.0",
  "info": {
    "title": "Control a Character API",
    "version": "1.0.0",
    "description": "Create a Runway character-performance task through the official-format CometAPI route."
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/runwayml/v1/character_performance": {
      "post": {
        "summary": "Create a Runway character-performance task",
        "operationId": "control_a_character",
        "description": "Submit a character asset plus a reference performance clip and receive a task id for later polling.",
        "parameters": [
          {
            "name": "X-Runway-Version",
            "in": "header",
            "required": true,
            "description": "Runway version header, for example `2024-11-06`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "character",
                  "reference",
                  "bodyControl",
                  "expressionIntensity",
                  "seed",
                  "model",
                  "ratio",
                  "contentModeration"
                ],
                "properties": {
                  "character": {
                    "type": "object",
                    "description": "The character to control. You can either provide a video or an image.",
                    "required": [
                      "type",
                      "uri"
                    ],
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "uri": {
                        "type": "string"
                      }
                    },
                    "default": {
                      "type": "video",
                      "uri": "https://your-video-host/source.mp4"
                    }
                  },
                  "reference": {
                    "type": "object",
                    "description": "Reference performance clip. Provide `type` (`video`) and `uri` (HTTPS URL).",
                    "required": [
                      "type",
                      "uri"
                    ],
                    "properties": {
                      "type": {
                        "type": "string"
                      },
                      "uri": {
                        "type": "string"
                      }
                    },
                    "default": {
                      "type": "video",
                      "uri": "https://your-video-host/source.mp4"
                    }
                  },
                  "bodyControl": {
                    "type": "boolean",
                    "description": "Enable body control.",
                    "default": true
                  },
                  "expressionIntensity": {
                    "type": "integer",
                    "description": "Intensity of the expression transfer. Higher values produce more exaggerated expressions.",
                    "default": 1
                  },
                  "seed": {
                    "type": "integer",
                    "description": "Random seed for reproducible results.",
                    "default": 1
                  },
                  "model": {
                    "type": "string",
                    "description": "The model variant to use. Must be act_two.",
                    "default": "act_two"
                  },
                  "ratio": {
                    "type": "string",
                    "description": "Requested output frame shape, for example 1280:720 or 720:1280. Keep the character and reference assets close to the requested frame shape.",
                    "default": "1280:720"
                  },
                  "contentModeration": {
                    "type": "object",
                    "required": [
                      "publicFigureThreshold"
                    ],
                    "properties": {
                      "publicFigureThreshold": {
                        "type": "string",
                        "description": "Threshold for public-figure detection. Use `auto` for default behavior."
                      }
                    },
                    "default": {
                      "publicFigureThreshold": "auto"
                    }
                  }
                },
                "default": {
                  "character": {
                    "type": "video",
                    "uri": "https://your-video-host/source.mp4"
                  },
                  "reference": {
                    "type": "video",
                    "uri": "https://your-video-host/source.mp4"
                  },
                  "bodyControl": true,
                  "expressionIntensity": 1,
                  "seed": 1,
                  "model": "act_two",
                  "ratio": "1280:720",
                  "contentModeration": {
                    "publicFigureThreshold": "auto"
                  }
                }
              },
              "examples": {
                "Default": {
                  "summary": "Default",
                  "value": {
                    "character": {
                      "type": "video",
                      "uri": "https://your-video-host/source.mp4"
                    },
                    "reference": {
                      "type": "video",
                      "uri": "https://your-video-host/source.mp4"
                    },
                    "bodyControl": true,
                    "expressionIntensity": 3,
                    "seed": 4294967295,
                    "model": "act_two",
                    "ratio": "1280:720",
                    "contentModeration": {
                      "publicFigureThreshold": "auto"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "id": "5b91e444-c232-deaf-a4d7-8aef3e57336b"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "Default",
            "source": "curl https://api.cometapi.com/runwayml/v1/character_performance \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n      \"character\": {\n        \"type\": \"video\",\n        \"uri\": \"https://your-video-host/character.mp4\"\n      },\n      \"reference\": {\n        \"type\": \"video\",\n        \"uri\": \"https://your-video-host/performance.mp4\"\n      },\n      \"model\": \"act_two\",\n      \"ratio\": \"1280:720\"\n    }'\n"
          },
          {
            "lang": "Python",
            "label": "Default",
            "source": "import os\nimport requests\n\nresponse = requests.post(\n    \"https://api.cometapi.com/runwayml/v1/character_performance\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]},\n    json={\n            \"character\": {\n                    \"type\": \"video\",\n                    \"uri\": \"https://your-video-host/character.mp4\"\n            },\n            \"reference\": {\n                    \"type\": \"video\",\n                    \"uri\": \"https://your-video-host/performance.mp4\"\n            },\n            \"model\": \"act_two\",\n            \"ratio\": \"1280:720\"\n    },\n)\n\ntask = response.json()\nprint(task[\"id\"])  # poll GET /runwayml/v1/tasks/{id} until the output array appears\n"
          },
          {
            "lang": "JavaScript",
            "label": "Default",
            "source": "const response = await fetch(\"https://api.cometapi.com/runwayml/v1/character_performance\", {\n    method: \"POST\",\n    headers: {\n        Authorization: `Bearer ${process.env.COMETAPI_KEY}`,\n        \"Content-Type\": \"application/json\",\n    },\n    body: JSON.stringify({\n            \"character\": {\n                \"type\": \"video\",\n                \"uri\": \"https://your-video-host/character.mp4\"\n            },\n            \"reference\": {\n                \"type\": \"video\",\n                \"uri\": \"https://your-video-host/performance.mp4\"\n            },\n            \"model\": \"act_two\",\n            \"ratio\": \"1280:720\"\n        }),\n});\n\nconst task = await response.json();\nconsole.log(task.id); // poll GET /runwayml/v1/tasks/{id} until the output array appears\n"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token authentication. Use your CometAPI key."
      }
    }
  }
}
