{
  "openapi": "3.1.0",
  "info": {
    "title": "StoryCut API",
    "version": "1.0.0",
    "summary": "Turn long videos into captioned vertical clips with virality scores.",
    "description": "Runs, clips, exports, uploads, usage and webhooks. The full reference, with examples: https://app.storycut.com/v1/docs.md",
    "contact": {
      "name": "StoryCut",
      "email": "contact@storycut.com",
      "url": "https://app.storycut.com/dashboard/integrations?tab=docs"
    }
  },
  "externalDocs": {
    "description": "API reference (Markdown)",
    "url": "https://app.storycut.com/v1/docs.md"
  },
  "servers": [
    {
      "url": "https://app.storycut.com/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Runs"
    },
    {
      "name": "Uploads"
    },
    {
      "name": "Clips and exports"
    },
    {
      "name": "Account"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Docs"
    }
  ],
  "paths": {
    "/uploads": {
      "post": {
        "operationId": "createUpload",
        "summary": "Get a signed URL to send a video file straight to storage.",
        "tags": [
          "Uploads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UploadCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The upload, with the signed URL.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadCreated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/uploads/{id}": {
      "get": {
        "operationId": "getUpload",
        "summary": "Whether the file has arrived.",
        "tags": [
          "Uploads"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The upload id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The upload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Upload"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        }
      }
    },
    "/runs": {
      "post": {
        "operationId": "createRun",
        "summary": "Start a run from `youtube_url`, `upload_id` or `video_url`.",
        "tags": [
          "Runs"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "410": {
            "$ref": "#/components/responses/E410"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      },
      "get": {
        "operationId": "listRuns",
        "summary": "Your runs, newest first.",
        "tags": [
          "Runs"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "queued",
                "processing",
                "completed",
                "failed",
                "cancelled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Runs, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/runs/{id}": {
      "get": {
        "operationId": "getRun",
        "summary": "A run: status, step, progress, clips made.",
        "tags": [
          "Runs"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The run id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        }
      }
    },
    "/runs/{id}/cancel": {
      "post": {
        "operationId": "cancelRun",
        "summary": "Stop a queued or processing run; its credits come back.",
        "tags": [
          "Runs"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The run id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The run, with status cancelled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          }
        }
      }
    },
    "/runs/{id}/clips": {
      "get": {
        "operationId": "listClips",
        "summary": "The run’s clips, best first.",
        "tags": [
          "Clips and exports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The run id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The clips, best first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClipList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        }
      }
    },
    "/clips/{id}/export": {
      "post": {
        "operationId": "exportClip",
        "summary": "Render a clip as an MP4.",
        "tags": [
          "Clips and exports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The clip id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "201": {
            "description": "The export, processing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Export"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "410": {
            "$ref": "#/components/responses/E410"
          },
          "500": {
            "$ref": "#/components/responses/E500"
          }
        }
      }
    },
    "/exports/{id}": {
      "get": {
        "operationId": "getExport",
        "summary": "An export’s status, then its `download_url`.",
        "tags": [
          "Clips and exports"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The export id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Export"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "How live calls are billed, the credit balance, the plan’s allowance.",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "Billing and what is left.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/credits": {
      "get": {
        "operationId": "getCredits",
        "summary": "The credit balance and the latest movements.",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The balance and the latest movements.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credits"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "summary": "Your webhook endpoints and the events available.",
        "tags": [
          "Webhooks"
        ],
        "responses": {
          "200": {
            "description": "Your endpoints.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "summary": "Add a webhook endpoint.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookCreate"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The endpoint and its secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Remove a webhook endpoint.",
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The webhook id.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Removed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        }
      }
    },
    "/docs.md": {
      "get": {
        "operationId": "getDocs",
        "summary": "This reference as Markdown (no key needed).",
        "tags": [
          "Docs"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "GitHub Markdown.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApi",
        "summary": "The OpenAPI 3.1 description (no key needed).",
        "tags": [
          "Docs"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "This document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "run.completed": {
      "post": {
        "operationId": "on_run_completed",
        "summary": "A run finished: its clips are ready.",
        "description": "`data`: `id`, `title`, `status`, `clips_count`, `clips_url`.",
        "parameters": [
          {
            "name": "X-StoryCut-Event",
            "in": "header",
            "required": true,
            "schema": {
              "const": "run.completed"
            }
          },
          {
            "name": "X-StoryCut-Signature",
            "in": "header",
            "required": true,
            "description": "`sha256=` + hex HMAC-SHA256 of the raw body with the endpoint’s secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Answer with any 2xx status within 10 seconds."
          }
        }
      }
    },
    "run.failed": {
      "post": {
        "operationId": "on_run_failed",
        "summary": "A run couldn’t make clips, with the reason (its credits are returned).",
        "description": "`data`: `id`, `title`, `status`, `error`, `reason`.",
        "parameters": [
          {
            "name": "X-StoryCut-Event",
            "in": "header",
            "required": true,
            "schema": {
              "const": "run.failed"
            }
          },
          {
            "name": "X-StoryCut-Signature",
            "in": "header",
            "required": true,
            "description": "`sha256=` + hex HMAC-SHA256 of the raw body with the endpoint’s secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Answer with any 2xx status within 10 seconds."
          }
        }
      }
    },
    "export.completed": {
      "post": {
        "operationId": "on_export_completed",
        "summary": "An export finished, with its download link (valid 24 hours).",
        "description": "`data`: `id`, `clip_id`, `title`, `status`, `download_url`.",
        "parameters": [
          {
            "name": "X-StoryCut-Event",
            "in": "header",
            "required": true,
            "schema": {
              "const": "export.completed"
            }
          },
          {
            "name": "X-StoryCut-Signature",
            "in": "header",
            "required": true,
            "description": "`sha256=` + hex HMAC-SHA256 of the raw body with the endpoint’s secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Answer with any 2xx status within 10 seconds."
          }
        }
      }
    },
    "export.failed": {
      "post": {
        "operationId": "on_export_failed",
        "summary": "An export failed (its credits are returned).",
        "description": "`data`: `id`, `clip_id`, `title`, `status`, `error`.",
        "parameters": [
          {
            "name": "X-StoryCut-Event",
            "in": "header",
            "required": true,
            "schema": {
              "const": "export.failed"
            }
          },
          {
            "name": "X-StoryCut-Signature",
            "in": "header",
            "required": true,
            "description": "`sha256=` + hex HMAC-SHA256 of the raw body with the endpoint’s secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Answer with any 2xx status within 10 seconds."
          }
        }
      }
    },
    "credits.low": {
      "post": {
        "operationId": "on_credits_low",
        "summary": "Your balance dropped below 10% of the last pack you bought (between 50 and 500 credits), once until the next purchase.",
        "description": "`data`: `balance`, `threshold`.",
        "parameters": [
          {
            "name": "X-StoryCut-Event",
            "in": "header",
            "required": true,
            "schema": {
              "const": "credits.low"
            }
          },
          {
            "name": "X-StoryCut-Signature",
            "in": "header",
            "required": true,
            "description": "`sha256=` + hex HMAC-SHA256 of the raw body with the endpoint’s secret.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Event"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Answer with any 2xx status within 10 seconds."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "`sc_live_…` (live) or `sc_test_…` (test mode) keys from the developer console."
      }
    },
    "parameters": {
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Any unique string (200 characters at most): the same key within 24 hours gets the first answer back.",
        "schema": {
          "type": "string",
          "maxLength": 200
        }
      }
    },
    "responses": {
      "E400": {
        "description": "`missing_source`: Not exactly one of `youtube_url`, `upload_id`, `video_url`. Other bad requests: `bad_source`, `bad_clip_length`, `bad_language`, `bad_title`, `bad_metadata`, `bad_speech_check`, `bad_youtube_url`, `bad_size`, `bad_type`, `bad_json`, `bad_idempotency_key`; webhooks: `bad_url`, `bad_events`, `too_many`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E401": {
        "description": "`unauthorized`: Missing, revoked or unknown key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E402": {
        "description": "`insufficient_credits`: Not enough credits for this run or export: `error.balance` and `error.needed` tell how many.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E403": {
        "description": "`api_access_required`: Live mode needs credits or a paid plan.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E404": {
        "description": "`not_found`: No such run, clip, export, upload or webhook on this account (`upload_not_found` for an unknown `upload_id`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E409": {
        "description": "`upload_not_received`: Start the run after the PUT has finished (also `upload_incomplete`, `upload_used`, `not_cancellable`, `idempotency_conflict`, `idempotency_in_progress`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E410": {
        "description": "`upload_expired`: The upload is over 24 hours old: upload the file again. `source_expired`: the run’s source video was deleted (7 days after a credit-billed run), so its clips can’t be exported any more.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E413": {
        "description": "`file_too_large`: Over 5 GB for an upload (500 MB in test mode), 13 GB for `video_url`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E422": {
        "description": "`video_too_short`: Under 2 minutes (also `not_a_video`, `bad_video_url`, `video_url_unreachable`, `video_unavailable`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E429": {
        "description": "`rate_limited`: Over 120 requests a minute for this key: wait for `Retry-After` seconds.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E500": {
        "description": "`error`: Something went wrong on StoryCut’s side: try again with the same `Idempotency-Key` (also `start_failed`, `export_failed`).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "A stable, lower-case code (see Errors)."
              },
              "message": {
                "type": "string",
                "description": "What happened, for a person."
              },
              "balance": {
                "type": "integer",
                "description": "402 insufficient_credits: the balance."
              },
              "needed": {
                "type": "integer",
                "description": "402 insufficient_credits: the credits needed."
              }
            }
          }
        }
      },
      "UploadCreate": {
        "type": "object",
        "required": [
          "size_bytes"
        ],
        "properties": {
          "filename": {
            "type": "string",
            "description": "The file name (used as the run’s title)."
          },
          "size_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5368709120,
            "description": "The exact size in bytes. Up to 5 GB (500 MB in test mode); for a bigger file, use `video_url`."
          },
          "content_type": {
            "type": "string",
            "description": "`video/mp4`, `video/quicktime`, `video/x-m4v`, `video/webm`, `video/x-matroska` or `video/mpeg` (or let the file name tell)."
          }
        }
      },
      "UploadCreated": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status",
          "upload_url",
          "upload_method",
          "upload_headers"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "upl_…"
          },
          "object": {
            "const": "upload"
          },
          "status": {
            "const": "pending"
          },
          "filename": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "content_type": {
            "type": "string"
          },
          "livemode": {
            "type": "boolean"
          },
          "upload_url": {
            "type": "string",
            "format": "uri",
            "description": "PUT the file here (valid 2 hours)."
          },
          "upload_method": {
            "const": "PUT"
          },
          "upload_headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Send these headers with the PUT."
          },
          "upload_url_expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "Start the run before this (24 hours)."
          }
        }
      },
      "Upload": {
        "type": "object",
        "required": [
          "id",
          "object",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "upload"
          },
          "status": {
            "enum": [
              "pending",
              "uploaded",
              "used",
              "expired"
            ]
          },
          "filename": {
            "type": "string"
          },
          "size_bytes": {
            "type": "integer"
          },
          "content_type": {
            "type": "string"
          },
          "livemode": {
            "type": "boolean"
          },
          "run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "RunCreate": {
        "type": "object",
        "description": "Send exactly one of youtube_url, upload_id or video_url.",
        "oneOf": [
          {
            "required": [
              "youtube_url"
            ]
          },
          {
            "required": [
              "upload_id"
            ]
          },
          {
            "required": [
              "video_url"
            ]
          }
        ],
        "properties": {
          "youtube_url": {
            "type": "string",
            "description": "A public YouTube video."
          },
          "upload_id": {
            "type": "string",
            "description": "A file you sent with `POST /v1/uploads` (see Upload a file)."
          },
          "video_url": {
            "type": "string",
            "format": "uri",
            "description": "A direct https link to a video file: a presigned S3, GCS or R2 URL, a CDN file. StoryCut downloads it (up to 13 GB). The link’s query string is never stored."
          },
          "clip_length": {
            "enum": [
              "short",
              "medium",
              "long"
            ],
            "default": "short",
            "description": "`\"short\"` 15–30 s (default), `\"medium\"` 30–59 s or `\"long\"` 60–89 s."
          },
          "language": {
            "type": "string",
            "default": "auto",
            "pattern": "^(auto|[a-z]{2,3}(-[A-Za-z]{2,4})?)$",
            "description": "`\"auto\"` (default) or the spoken language code, e.g. `\"en\"`, `\"es\"`, `\"hi\"`."
          },
          "title": {
            "type": "string",
            "description": "Your name for the run (the file name or the video title otherwise). YouTube runs billed to a plan keep the video’s title."
          },
          "metadata": {
            "type": "object",
            "maxProperties": 20,
            "description": "Up to 20 keys of your own (letters, digits, `_` `.` `-`; 40 characters at most) with string, number or boolean values (500 characters each, 4 KB in all, returned as strings), returned on the run and in every webhook about it and its exports.",
            "propertyNames": {
              "pattern": "^[A-Za-z0-9_.-]{1,40}$"
            },
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            }
          },
          "speech_check": {
            "type": "boolean",
            "default": true,
            "description": "`true` (default): StoryCut listens to the video before transcribing it, and a run in which nobody talks (music without words, gameplay without commentary) stops right after its download with `error_code` `no_speech_heard`, its credits returned. `false`: make clips anyway (send it again for such a run when you know someone talks in the video)."
          },
          "simulate": {
            "enum": [
              "failed",
              "no_speech_heard"
            ],
            "description": "Test mode only: `\"failed\"` makes the test run fail (and sends `run.failed`); `\"no_speech_heard\"` makes it stop like a run in which nobody talks."
          }
        }
      },
      "Run": {
        "type": "object",
        "required": [
          "id",
          "object",
          "livemode",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "The run id (a UUID). Keep it."
          },
          "object": {
            "const": "run"
          },
          "livemode": {
            "type": "boolean"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "`youtube`, `upload` or `url`."
          },
          "status": {
            "enum": [
              "queued",
              "processing",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "step": {
            "type": [
              "string",
              "null"
            ],
            "description": "What it is doing: `fetching_video` or `waiting_for_slot` while queued, then e.g. `downloading`, `transcribing`, `finding_clips`, `rendering_previews`. For display only: names can change."
          },
          "progress": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "clips_count": {
            "type": "integer"
          },
          "video_seconds": {
            "type": [
              "number",
              "null"
            ]
          },
          "processed_seconds": {
            "type": [
              "number",
              "null"
            ],
            "description": "The part used (the first 150 minutes of a longer video)."
          },
          "credits_charged": {
            "type": "integer",
            "description": "What the run cost in credits (0 on plan billing and in test mode)."
          },
          "clip_length": {
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Credit billing: when the source video is deleted (completed runs). Export before then."
          },
          "clips_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "RunList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "has_more"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Run"
            }
          },
          "has_more": {
            "type": "boolean"
          }
        }
      },
      "Clip": {
        "type": "object",
        "required": [
          "id",
          "object",
          "run_id"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "clip"
          },
          "livemode": {
            "type": "boolean"
          },
          "run_id": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "score": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100
          },
          "start": {
            "type": "number"
          },
          "end": {
            "type": "number"
          },
          "duration": {
            "type": "number"
          },
          "locked": {
            "type": "boolean",
            "description": "`true` when the clip needs a paid plan to export (never on credit billing)."
          },
          "exported": {
            "type": "boolean"
          },
          "preview_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "A short preview MP4 when one was made (credit-billed runs make none)."
          },
          "edit_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "The clip in the StoryCut editor: edits saved there are used by the next export."
          }
        }
      },
      "ClipList": {
        "type": "object",
        "required": [
          "object",
          "run_id",
          "status",
          "data"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "run_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "The run’s status; `data` is empty until it is `completed`."
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Clip"
            }
          }
        }
      },
      "Export": {
        "type": "object",
        "required": [
          "id",
          "object",
          "clip_id",
          "status"
        ],
        "properties": {
          "id": {
            "type": [
              "integer",
              "string"
            ],
            "description": "A number in live mode; `test_…` in test mode."
          },
          "object": {
            "const": "export"
          },
          "livemode": {
            "type": "boolean"
          },
          "clip_id": {
            "type": "string"
          },
          "run_id": {
            "type": "string",
            "description": "Test mode."
          },
          "status": {
            "type": "string",
            "description": "`processing`, `completed`, `failed` or `expired`."
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "credits_charged": {
            "type": "integer"
          },
          "download_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Once completed; valid 24 hours (ask again for a new one)."
          },
          "download_url_expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Usage": {
        "type": "object",
        "required": [
          "object",
          "livemode",
          "billing",
          "credits"
        ],
        "properties": {
          "object": {
            "const": "usage"
          },
          "livemode": {
            "type": "boolean"
          },
          "billing": {
            "enum": [
              "credits",
              "plan",
              "test"
            ]
          },
          "credits": {
            "type": "object",
            "properties": {
              "balance": {
                "type": "integer"
              },
              "uses_credits": {
                "type": "boolean"
              }
            }
          },
          "plan": {
            "type": [
              "string",
              "null"
            ]
          },
          "ai_clips": {
            "type": [
              "object",
              "null"
            ],
            "description": "Plan billing: the plan’s AI Clips allowance this month."
          },
          "pricing": {
            "type": "object",
            "properties": {
              "credit_per_minute": {
                "const": 1
              },
              "min_credits_per_run": {
                "const": 5
              },
              "credits_per_export": {
                "const": 5
              }
            }
          }
        }
      },
      "Credits": {
        "type": "object",
        "required": [
          "object",
          "balance",
          "data"
        ],
        "properties": {
          "object": {
            "const": "credits"
          },
          "balance": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "amount": {
                  "type": "integer"
                },
                "kind": {
                  "type": "string"
                },
                "ref": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                }
              }
            }
          }
        }
      },
      "WebhookCreate": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "A public https address (redirects aren’t followed)."
          },
          "events": {
            "type": "array",
            "items": {
              "enum": [
                "run.completed",
                "run.failed",
                "export.completed",
                "export.failed",
                "credits.low"
              ]
            },
            "description": "All events when left out."
          }
        }
      },
      "WebhookCreated": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events",
          "secret"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "secret": {
            "type": "string",
            "description": "whsec_… The signing secret, shown only this once."
          }
        }
      },
      "Webhook": {
        "type": "object",
        "required": [
          "id",
          "url",
          "events"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_status": {
            "type": [
              "integer",
              "null"
            ]
          },
          "last_delivery_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "failures": {
            "type": "integer"
          },
          "paused": {
            "type": "boolean"
          }
        }
      },
      "WebhookList": {
        "type": "object",
        "required": [
          "object",
          "data",
          "events"
        ],
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Webhook"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Event": {
        "type": "object",
        "required": [
          "id",
          "event",
          "created_at",
          "livemode",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "evt_… The same on a resent delivery."
          },
          "event": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "livemode": {
            "type": "boolean"
          },
          "data": {
            "type": "object"
          }
        }
      }
    }
  }
}
