clipwright/skills/openshorts/reference.md
pedro-bento fbabb4ec5d refactor: self-hosted fork — Postiz publishing, drop AI Shorts/UGC/agent/autopilot/MCP, fix Studio image API, remove upload cap
- Replace Upload-Post with a self-hosted Postiz client (postiz.py) and /api/postiz/* endpoints
- Remove AI Shorts, UGC gallery, AI Agent tab, Autopilot, MCP/agent layer, and their UIs
- Fix YouTube Studio thumbnail generation (google-genai >=2 Interactions API) and blocking download
- Make the video upload size cap configurable/unlimited (MAX_FILE_SIZE_MB, default 0)
- Update SEO/marketing/docs to the single-product self-hosted reality; lint+build green
2026-10-04 16:30:44 +01:00

144 lines
4.6 KiB
Markdown

# OpenShorts HTTP reference
Base URL: `http://localhost:8000` (self-hosted). The API is open by default and
needs no key, but it does need a Gemini key, either in the server's environment
or as an `X-Gemini-Key` header.
## Start a job
`POST /api/process`, JSON body for a URL source (use multipart form fields with
a `file` part to upload a local video instead):
```json
{
"url": "https://www.youtube.com/watch?v=...",
"acknowledged": true,
"layouts": ["auto"],
"output_format": "auto",
"target_clips": 4,
"clip_min_seconds": 15,
"clip_max_seconds": 60,
"webhook_url": "https://example.com/hooks/openshorts",
"webhook_secret": "change-me",
"force_low_quality": false
}
```
`acknowledged: true` is the rights attestation and is required. `layouts`
accepts a JSON list or a comma separated string of `auto`, `split`,
`screencast`, `speaker_cut`, `punch_in`. `output_format` is one of `auto`,
`vertical`, `horizontal`, `square`. `target_clips` is 1 to 15;
`clip_min_seconds` 5 to 175; `clip_max_seconds` 10 to 180 and at least 5 above
the minimum.
Success:
```json
{ "job_id": "0f0a...", "status": "queued" }
```
Quality gate, also HTTP 200:
```json
{ "needs_confirmation": true,
"quality_check": { "max_height": 480, "min_height": 720, "cookies_invalid": false } }
```
Ask the user, then resubmit the identical body with `force_low_quality: true`.
Errors: **429** too many jobs already running (`MAX_CONCURRENT_JOBS`), **400**
the source duration could not be determined.
## Poll a job
`GET /api/status/{job_id}` returns `{"status": ..., "logs": [...], "result": ...}`
where status is `queued`, `processing`, `completed` or `failed`. `result.clips`
appears once completed, each entry carrying `title`,
`video_title_for_youtube_short`, `video_description_for_tiktok`,
`video_description_for_instagram`, `start`, `end` and `video_url`. A relative
`video_url` is relative to the API base.
Poll every 30 to 60 seconds. Prefer a webhook.
## Webhook
Fired once per job, on success and on failure, so a flow never hangs:
```json
{
"event": "job.completed",
"job_id": "0f0a...",
"status": "completed",
"clips": [ { "index": 0, "title": "...", "video_url": "...", "download_url": "..." } ]
}
```
A failed job sends `"event": "job.failed"` with an `error` string and no clips.
`download_url` is a presigned link valid for 24 hours.
The URL must be public HTTPS; it is validated at submit time and re-resolved at
delivery time, so a URL that points at a private address is refused. With a
`webhook_secret`, the **raw request body** is signed HMAC-SHA256 and sent as
`X-OpenShorts-Signature: sha256=<hex>`. Verify against the raw bytes, not
against a re-serialized object:
```javascript
const crypto = require('crypto');
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(rawBody)
.digest('hex');
```
## Restyle captions
`POST /api/subtitle`
```json
{ "job_id": "...", "clip_index": 0, "style": "karaoke", "position": "bottom",
"font_size": 48, "font_name": "...", "font_color": "#FFFFFF",
"highlight_color": "#FFE600", "uppercase": true }
```
`style` is `classic` or `karaoke`; `position` is `top`, `middle` or `bottom`.
Only `job_id` and `clip_index` are required.
## Re-cut a clip
`POST /api/clip/rerender`
```json
{ "job_id": "...", "clip_index": 0,
"segments": [ { "start": 812.4, "end": 831.0 }, { "start": 840.2, "end": 858.9 } ],
"snap_to_words": true, "reapply_captions": true, "framing": "auto" }
```
Times are seconds in the **original source video**. Segments concatenate in the
order given. `framing` is `auto`, `full` (no side cropping) or `track` (force
subject tracking); omit it to keep the clip's current framing. Anything outside
the clip's original range, or any non-auto `framing`, re-runs the reframe engine
and needs the retained source video.
## Publish
`POST /api/postiz/post`
```json
{ "job_id": "...", "clip_index": 0, "platforms": ["tiktok", "instagram", "youtube"],
"title": "...", "description": "...",
"scheduled_date": "2026-08-25T18:00:00Z", "timezone": "Europe/Madrid" }
```
Omit `scheduled_date` to post now. The backend uploads the clip bytes to your
self-hosted Postiz instance and creates the post there; the provider settings
(`tiktok`, `instagram`, `youtube`) are built from the title and caption.
Connected channels: `GET /api/postiz/integrations`.
Queue: `GET /api/postiz/scheduled`, and
`DELETE /api/postiz/scheduled/{id}` to cancel one before it goes out.
Analytics of what was published: `GET /api/postiz/analytics` (channel totals) and
`GET /api/postiz/analytics/posts`.
Full generated API docs: `http://localhost:8000/docs`.