{"openapi":"3.1.0","info":{"title":"ClipHeist API","version":"1.0.0","description":"REST API used by the ClipHeist web app. Browser routes authenticate with the `ch_session` cookie. AI agents should use the MCP server at /mcp with a personal API key instead.","contact":{"url":"https://clipheist.shipaw.site/contact"},"termsOfService":"https://clipheist.shipaw.site/api-terms"},"servers":[{"url":"https://clipheist.shipaw.site"}],"components":{"securitySchemes":{"session":{"type":"apiKey","in":"cookie","name":"ch_session"},"apiKey":{"type":"http","scheme":"bearer","description":"Personal API key `ch_...` (MCP endpoint only)"}},"schemas":{"Plan":{"type":"object","properties":{"id":{"type":"string","enum":["free","pro","studio"]},"name":{"type":"string"},"priceMonthly":{"type":"number"},"videosPerPeriod":{"type":"integer"},"maxVideoMinutes":{"type":"integer"},"maxClipsPerVideo":{"type":"integer"},"watermark":{"type":"boolean"},"autopost":{"type":"boolean"},"desktopSeats":{"type":"integer"},"features":{"type":"array","items":{"type":"string"}}}},"Video":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"source":{"type":"string"},"duration":{"type":["number","null"]},"status":{"type":"string","enum":["queued","downloading","analyzing","ready","no_moments","failed"]},"progress":{"type":"integer"},"error":{"type":["string","null"]},"settings":{"type":"object"},"created_at":{"type":"integer"}}},"Clip":{"type":"object","properties":{"id":{"type":"string"},"video_id":{"type":"string"},"start":{"type":"number"},"end":{"type":"number"},"score":{"type":"number"},"reason":{"type":"string"},"title":{"type":["string","null"]},"caption":{"type":["string","null"]},"hashtags":{"type":["string","null"]},"layout":{"type":"string","enum":["blur","crop","facecam"]},"status":{"type":"string","enum":["candidate","queued","rendering","rendered","failed"]},"hasThumb":{"type":"boolean"},"hasFile":{"type":"boolean"}}},"Post":{"type":"object","properties":{"id":{"type":"string"},"clip_id":{"type":"string"},"provider":{"type":"string","enum":["youtube","tiktok"]},"status":{"type":"string","enum":["scheduled","posting","posted","failed"]},"scheduled_at":{"type":"integer"},"external_url":{"type":["string","null"]},"views":{"type":"integer"},"campaign_id":{"type":["string","null"]}}},"Error":{"type":"object","properties":{"error":{"type":"string"}}}}},"paths":{"/api/health":{"get":{"summary":"Health check","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/plans":{"get":{"summary":"List plans","responses":{"200":{"description":"Plans","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}}}}}}}},"/api/status":{"get":{"summary":"Service status and recent checks","responses":{"200":{"description":"Status","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/ask":{"post":{"summary":"Ask the ClipHeist assistant (answers from public docs)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["q"],"properties":{"q":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"Answer with sources","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"type":"string"},"sources":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":"string"}}}}}}}}}}}},"/api/auth/signup":{"post":{"summary":"Create an account (sets session cookie)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":8}}}}}},"responses":{"200":{"description":"Signed up","content":{"application/json":{"schema":{"type":"object"}}}},"409":{"description":"Email exists"}}}},"/api/auth/login":{"post":{"summary":"Sign in (sets session cookie)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"Signed in","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Wrong email or password"}}}},"/api/auth/logout":{"post":{"summary":"Sign out","responses":{"200":{"description":"Signed out","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/me":{"get":{"summary":"Current user, plan, usage and connections","security":[{"session":[]}],"responses":{"200":{"description":"Me","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Not signed in"},"404":{"description":"Not found"}}}},"/api/videos":{"get":{"summary":"List VODs","security":[{"session":[]}],"responses":{"200":{"description":"Videos","content":{"application/json":{"schema":{"type":"object","properties":{"videos":{"type":"array","items":{"$ref":"#/components/schemas/Video"}}}}}}}}},"post":{"summary":"Add a VOD (multipart upload `file`, or JSON `url` + `rightsConfirmed`)","security":[{"session":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"settings":{"type":"string","description":"JSON: clipSeconds, maxClips, layout, burnTitle, autoRender, facecam"}}}},"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"rightsConfirmed":{"type":"string","enum":["true"]},"settings":{"type":"object"}}}}}},"responses":{"201":{"description":"Queued","content":{"application/json":{"schema":{"type":"object","properties":{"video":{"$ref":"#/components/schemas/Video"}}}}}},"402":{"description":"Plan limit reached"}}}},"/api/videos/{id}":{"get":{"summary":"VOD with its moments","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Video and clips","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Not signed in"},"404":{"description":"Not found"}}},"delete":{"summary":"Delete a VOD and its clips","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/clips/{id}":{"patch":{"summary":"Edit hook, caption, hashtags, layout or trim","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"caption":{"type":"string"},"hashtags":{"type":"string"},"layout":{"type":"string","enum":["blur","crop","facecam"]},"start":{"type":"number"},"end":{"type":"number"}}}}}},"responses":{"200":{"description":"Clip","content":{"application/json":{"schema":{"type":"object","properties":{"clip":{"$ref":"#/components/schemas/Clip"}}}}}}}}},"/api/clips/{id}/render":{"post":{"summary":"Queue a vertical render","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Queued","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/clips/{id}/download":{"get":{"summary":"Download the rendered MP4","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"MP4","content":{"video/mp4":{}}}}}},"/api/clips/{id}/growth":{"post":{"summary":"Growth (SEO) score with checks; `ai: true` adds AI rewrites","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"ai":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Score","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/clips/{id}/post":{"post":{"summary":"Schedule a post (Pro/Studio)","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["provider"],"properties":{"provider":{"type":"string","enum":["youtube","tiktok"]},"scheduledAt":{"type":"integer","description":"ms epoch"},"campaignId":{"type":"string"}}}}}},"responses":{"201":{"description":"Scheduled","content":{"application/json":{"schema":{"type":"object","properties":{"post":{"$ref":"#/components/schemas/Post"}}}}}},"402":{"description":"Paid plan required"}}}},"/api/dl/{clipId}":{"get":{"summary":"Signed, cookie-less clip download (links come from the MCP get_clip tool)","parameters":[{"name":"clipId","in":"path","required":true,"schema":{"type":"string"}},{"name":"exp","in":"query","required":true,"schema":{"type":"integer"}},{"name":"sig","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"MP4","content":{"video/mp4":{}}},"403":{"description":"Expired or invalid"}}}},"/api/growth/plan":{"get":{"summary":"Channel growth plan","security":[{"session":[]}],"responses":{"200":{"description":"Plan","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/posts":{"get":{"summary":"List posts","security":[{"session":[]}],"responses":{"200":{"description":"Posts","content":{"application/json":{"schema":{"type":"object","properties":{"posts":{"type":"array","items":{"$ref":"#/components/schemas/Post"}}}}}}}}}},"/api/posts/{id}":{"patch":{"summary":"Update views / campaign","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Post","content":{"application/json":{"schema":{"type":"object"}}}}}},"delete":{"summary":"Cancel a scheduled or failed post","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/posts/refresh-views":{"post":{"summary":"Refresh YouTube view counts","security":[{"session":[]}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/campaigns":{"get":{"summary":"Campaigns with views and estimated payouts","security":[{"session":[]}],"responses":{"200":{"description":"Campaigns","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"Add a campaign","security":[{"session":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","cpm"],"properties":{"name":{"type":"string"},"url":{"type":"string"},"cpm":{"type":"number"},"maxPayout":{"type":"number"}}}}}},"responses":{"201":{"description":"Created"}}}},"/api/campaigns/{id}":{"delete":{"summary":"Remove a campaign","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/keys":{"get":{"summary":"List API keys","security":[{"session":[]}],"responses":{"200":{"description":"Keys","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"summary":"Create an API key (returned once)","security":[{"session":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Key"}}}},"/api/keys/{id}":{"delete":{"summary":"Revoke an API key","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/license":{"get":{"summary":"Desktop licence key, seats and devices","security":[{"session":[]}],"responses":{"200":{"description":"Licence","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/license/rotate":{"post":{"summary":"Rotate the licence key (signs out every device)","security":[{"session":[]}],"responses":{"200":{"description":"New key","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/license/devices/{id}":{"delete":{"summary":"Remove a desktop device","security":[{"session":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/mcp":{"post":{"summary":"MCP server (JSON-RPC 2.0 over Streamable HTTP)","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"JSON-RPC response"},"202":{"description":"Notification accepted"},"401":{"description":"Missing or invalid API key"}}}}}}