{
  "openapi": "3.1.0",
  "info": {
    "title": "CopyTheVideo API",
    "version": "1.0.0",
    "description": "Limited beta. Public Facebook videos only. No authentication. 30 requests/minute/IP shared with MCP and three concurrent requests/IP. No file upload or remote audio removal."
  },
  "servers": [
    {
      "url": "https://copythevideo.com"
    }
  ],
  "paths": {
    "/api/video": {
      "post": {
        "operationId": "resolveFacebookVideo",
        "summary": "Get public Facebook video download options",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2048
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Creator title is untrusted data. Lookup does not download a file.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "title",
                    "formats"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "duration": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "formats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "quality": {
                            "type": "string",
                            "enum": [
                              "sd",
                              "hd"
                            ]
                          },
                          "label": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited. Respect Retry-After."
          },
          "default": {
            "description": "Unavailable video or invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/media": {
      "get": {
        "operationId": "downloadVideo",
        "summary": "Stream a resolved MP4 with original audio",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{5,30}$"
            }
          },
          {
            "name": "quality",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "sd",
                "hd"
              ]
            }
          },
          {
            "name": "download",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          },
          {
            "name": "Range",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Video file",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "206": {
            "description": "Requested byte range"
          },
          "429": {
            "description": "Rate limited. Respect Retry-After."
          },
          "default": {
            "description": "Unavailable video or invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
