{
  "openapi": "3.0.3",
  "info": {
    "title": "Bobo De Panda AI Agent Video Management & Scheduling API",
    "description": "High-performance API built for AI agents to upload, schedule, monitor, and dispatch videos across YouTube Shorts, TikTok, Facebook Reels, and Instagram Reels.",
    "version": "2.5.0"
  },
  "servers": [
    {
      "url": "https://bobo.buatcvgratis.web.id/api",
      "description": "Production Server"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/agent.php?action=status": {
      "get": {
        "summary": "Check System Status & Providers",
        "operationId": "getSystemStatus",
        "description": "Returns current WIB server time, active providers, queue metrics, and supported platforms.",
        "responses": {
          "200": {
            "description": "Status successfully retrieved"
          }
        }
      }
    },
    "/agent.php?action=schedule": {
      "post": {
        "summary": "Upload and Schedule Video",
        "operationId": "scheduleVideo",
        "description": "Upload a video from remote URL, direct binary, or existing video ID, and schedule to one or multiple platforms.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["title", "platforms"],
                "properties": {
                  "title": { "type": "string", "example": "Bobo Panda Playing In Snow" },
                  "description": { "type": "string", "example": "Watch Bobo roll around in the winter snow!" },
                  "video_url": { "type": "string", "example": "https://cdn.example.com/videos/bobo.mp4" },
                  "video_id": { "type": "string", "example": "video-20261127120000-abc123" },
                  "platforms": {
                    "type": "array",
                    "items": { "type": "string", "enum": ["youtube", "tiktok", "facebook", "instagram"] },
                    "example": ["youtube", "tiktok", "facebook"]
                  },
                  "hashtags": {
                    "type": "array",
                    "items": { "type": "string" },
                    "example": ["#Shorts", "#FYP", "#BoboDePanda"]
                  },
                  "scheduled_at": {
                    "type": "string",
                    "description": "Scheduled time in WIB or relative string e.g. '+2 hours', 'tomorrow 10:00', 'now'",
                    "example": "+2 hours"
                  },
                  "post_immediately": {
                    "type": "boolean",
                    "default": false
                  },
                  "platform_providers": {
                    "type": "object",
                    "example": { "youtube": "youtube_direct", "tiktok": "buffer" }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Video uploaded and scheduled successfully"
          }
        }
      }
    },
    "/agent.php?action=list_schedules": {
      "get": {
        "summary": "List Schedules",
        "operationId": "listSchedules",
        "parameters": [
          { "name": "status", "in": "query", "schema": { "type": "string", "enum": ["pending", "posted", "failed", "processing"] } },
          { "name": "platform", "in": "query", "schema": { "type": "string", "enum": ["youtube", "tiktok", "facebook", "instagram"] } },
          { "name": "q", "in": "query", "schema": { "type": "string" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 50 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "default": 0 } }
        ],
        "responses": {
          "200": { "description": "Schedules retrieved successfully" }
        }
      }
    },
    "/agent.php?action=get_schedule": {
      "get": {
        "summary": "Get Schedule Detail",
        "operationId": "getScheduleDetail",
        "parameters": [
          { "name": "schedule_id", "in": "query", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "Schedule details retrieved" }
        }
      }
    },
    "/agent.php?action=post_now": {
      "post": {
        "summary": "Instant Dispatch Schedule",
        "operationId": "postNow",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["schedule_id"],
                "properties": {
                  "schedule_id": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Video successfully dispatched" }
        }
      }
    },
    "/agent.php?action=delete_schedule": {
      "post": {
        "summary": "Delete Schedule",
        "operationId": "deleteSchedule",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["schedule_id"],
                "properties": {
                  "schedule_id": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Schedule deleted successfully" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
