{
  "openapi": "3.1.0",
  "info": {
    "title": "SeedRouter Seedance 2.0",
    "version": "1.0.0",
    "description": "The official ModelArk video generation task API: change the base URL and API key. Media by URL only; tasks cannot be cancelled or deleted; draft and tools are not exposed."
  },
  "servers": [
    {
      "url": "https://api.seedrouter.ai/v1"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/contents/generations/tasks": {
      "post": {
        "summary": "Create a video generation task",
        "operationId": "createVideoTask",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VideoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted. Poll the returned id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List your video tasks from the last 7 days",
        "operationId": "listVideoTasks",
        "parameters": [
          {
            "name": "page_num",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 1
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 20
            }
          },
          {
            "name": "filter.status",
            "in": "query",
            "schema": {
              "enum": [
                "queued",
                "running",
                "cancelled",
                "succeeded",
                "failed",
                "expired"
              ]
            }
          },
          {
            "name": "filter.model",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter.task_ids",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "filter.service_tier",
            "in": "query",
            "schema": {
              "const": "default"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/VideoTask"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/contents/generations/tasks/{task_id}": {
      "get": {
        "summary": "Read an owned video task",
        "operationId": "getVideoTask",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^task_[A-Za-z0-9]{1,64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Queued, running, succeeded, failed or expired task. Polling timeout is not a task failure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VideoTask"
                }
              }
            }
          },
          "401": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Public error; no infrastructure details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "VideoRequest": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "enum": [
              "dreamina-seedance-2-0",
              "dreamina-seedance-2-0-fast",
              "dreamina-seedance-2-0-mini"
            ]
          },
          "content": {
            "minItems": 1,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "text"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "image_url"
                    },
                    "image_url": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "first_frame",
                        "last_frame",
                        "reference_image"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "image_url"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "video_url"
                    },
                    "video_url": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "const": "reference_video"
                    }
                  },
                  "required": [
                    "type",
                    "video_url"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "audio_url"
                    },
                    "audio_url": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "const": "reference_audio"
                    }
                  },
                  "required": [
                    "type",
                    "audio_url"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "description": "One text item plus media by public HTTP(S) URL: first_frame / last_frame images, or up to 9 reference_image, 3 reference_video and 3 reference_audio items. Base64, data: and asset:// are not accepted."
          },
          "resolution": {
            "type": "string",
            "enum": [
              "480p",
              "720p",
              "1080p",
              "4k"
            ],
            "default": "720p",
            "description": "The -fast and -mini ids accept 480p and 720p only."
          },
          "ratio": {
            "type": "string",
            "enum": [
              "16:9",
              "4:3",
              "1:1",
              "3:4",
              "9:16",
              "21:9",
              "adaptive"
            ],
            "default": "adaptive"
          },
          "duration": {
            "type": "integer",
            "minimum": -1,
            "maximum": 15,
            "not": {
              "enum": [
                0,
                1,
                2,
                3
              ]
            },
            "default": 5,
            "description": "-1 (the model chooses) or 4–15 seconds."
          },
          "generate_audio": {
            "type": "boolean",
            "default": true
          },
          "watermark": {
            "type": "boolean",
            "default": false
          },
          "return_last_frame": {
            "type": "boolean",
            "default": false
          },
          "execution_expires_after": {
            "type": "integer",
            "minimum": 3600,
            "maximum": 259200,
            "default": 172800
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9,
            "default": 0
          },
          "safety_identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "service_tier": {
            "type": "string",
            "const": "default",
            "default": "default"
          },
          "content_filter": {
            "type": "boolean",
            "default": true,
            "description": "SeedRouter extension. false turns off content filtering."
          }
        },
        "required": [
          "model",
          "content"
        ],
        "additionalProperties": false
      },
      "VideoTask": {
        "type": "object",
        "required": [
          "id",
          "model",
          "status",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "model": {
            "enum": [
              "dreamina-seedance-2-0",
              "dreamina-seedance-2-0-fast",
              "dreamina-seedance-2-0-mini"
            ]
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "expired"
            ]
          },
          "content": {
            "type": "object",
            "properties": {
              "video_url": {
                "type": "string",
                "format": "uri"
              },
              "last_frame_url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "completion_tokens": {
                "type": "integer",
                "description": "Video tokens of the finished video; the billed unit."
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          },
          "seed": {
            "type": "integer"
          },
          "resolution": {
            "type": "string"
          },
          "ratio": {
            "type": "string"
          },
          "duration": {
            "type": "integer"
          },
          "framespersecond": {
            "type": "integer"
          },
          "generate_audio": {
            "type": "boolean"
          },
          "draft": {
            "type": "boolean"
          },
          "output_format": {
            "type": "string"
          },
          "service_tier": {
            "type": "string"
          },
          "execution_expires_after": {
            "type": "integer"
          },
          "priority": {
            "type": "integer"
          },
          "safety_identifier": {
            "type": "string"
          },
          "created_at": {
            "type": "integer"
          },
          "updated_at": {
            "type": "integer"
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "enum": [
                  10001,
                  10002,
                  20001,
                  20002,
                  30001,
                  30002,
                  50001,
                  50002,
                  50003,
                  60001,
                  60002,
                  60003,
                  60004,
                  90001
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "enum": [
              10001,
              10002,
              20001,
              20002,
              30001,
              30002,
              50001,
              50002,
              50003,
              60001,
              60002,
              60003,
              60004,
              90001
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
