{
  "openapi": "3.0.1",
  "info": {
    "title": "Sawfish – FFmpeg Video API for AI Agents",
    "description": "Pay-per-task FFmpeg API for developers and AI agents. Probe, trim, extract audio, normalize loudness, contact sheets and subtitle burn-in, plus ready recipes for vision LLMs, speech-to-text and 9:16 shorts. Send a URL, get files and JSON back.",
    "version": "0.0",
    "x-build-id": "WuQZeDd9AuB1vXOsC"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zyonelvis~sawfish/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zyonelvis-sawfish",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/zyonelvis~sawfish/runs": {
      "post": {
        "operationId": "runs-sync-zyonelvis-sawfish",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/zyonelvis~sawfish/run-sync": {
      "post": {
        "operationId": "run-sync-zyonelvis-sawfish",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "operation"
        ],
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "probe",
              "extract-audio",
              "contact-sheet",
              "trim",
              "normalize-audio",
              "burn-subtitles",
              "recipe/shorts-prep",
              "recipe/transcribe-prep",
              "recipe/vision-prep"
            ],
            "type": "string",
            "description": "Media task or AI recipe to run. Atomic tasks: `probe` (metadata only), `extract-audio` (MP3/WAV), `contact-sheet` (timestamped frame grid using exact source PTS), `trim` (cut segment), `normalize-audio` (2-pass EBU R128 loudness), `burn-subtitles` (hardcode SRT/ASS, max 720p & 60s). AI recipes: `recipe/vision-prep` (probe + exact-PTS contact sheet + JSON manifest for vision LLMs), `recipe/transcribe-prep` (16 kHz mono -16 LUFS WAV ready for Whisper/STT), `recipe/shorts-prep` (trim + 9:16 vertical crop + -14 LUFS loudness).",
            "default": "recipe/vision-prep"
          },
          "video_url": {
            "title": "Video / Audio URL (HTTPS)",
            "type": "string",
            "description": "Public HTTPS URL of the video or audio file to process (max 100 MB video / 25 MB audio; max 10 min / 1080p). Private/internal IPs and non-HTTPS URLs are blocked for security. Leave empty if using `input_kvs_key`."
          },
          "input_kvs_key": {
            "title": "Input Key-Value Store Key",
            "type": "string",
            "description": "Key name of the media file stored in an Apify Key-Value Store (for example `sample.mp4` or `audio.wav`). Use this instead of `video_url` when passing uploaded or upstream Actor files."
          },
          "input_kvs_id": {
            "title": "Input Key-Value Store ID (optional)",
            "type": "string",
            "description": "Optional Key-Value Store ID or name where `input_kvs_key` is stored. If omitted, reads from this run's default Key-Value Store."
          },
          "output_kvs_key": {
            "title": "Custom Output KVS Key (optional)",
            "type": "string",
            "description": "Optional filename/key for saving the generated output file in the default Key-Value Store (for example `clip.mp4` or `grid.jpg`). Auto-generated if omitted."
          },
          "cols": {
            "title": "Grid Columns (contact-sheet / vision-prep)",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "Number of columns in the contact sheet grid (1 to 6). Used by `contact-sheet` and `recipe/vision-prep`.",
            "default": 4
          },
          "rows": {
            "title": "Grid Rows (contact-sheet / vision-prep)",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "Number of rows in the contact sheet grid (1 to 6). Total frames extracted = cols * rows. Used by `contact-sheet` and `recipe/vision-prep`.",
            "default": 3
          },
          "tile_width": {
            "title": "Tile Width in Pixels (contact-sheet / vision-prep)",
            "minimum": 120,
            "maximum": 640,
            "type": "integer",
            "description": "Width in pixels of each frame tile in the contact sheet (120 to 640). Used by `contact-sheet` and `recipe/vision-prep`.",
            "default": 320
          },
          "image_format": {
            "title": "Image Format (contact-sheet / vision-prep)",
            "enum": [
              "jpg",
              "webp"
            ],
            "type": "string",
            "description": "Output image format for the contact sheet (`jpg` or `webp`). Used by `contact-sheet` and `recipe/vision-prep`.",
            "default": "jpg"
          },
          "timestamps": {
            "title": "Burn Real Timestamps on Tiles (contact-sheet)",
            "type": "boolean",
            "description": "Draw each frame's exact source PTS timestamp on the tile image. Always enabled in `recipe/vision-prep`.",
            "default": true
          },
          "audio_format": {
            "title": "Audio Output Format (extract-audio)",
            "enum": [
              "mp3",
              "wav"
            ],
            "type": "string",
            "description": "Output audio format (`mp3` or `wav`) for `extract-audio`.",
            "default": "mp3"
          },
          "sample_rate": {
            "title": "Audio Sample Rate in Hz (extract-audio)",
            "minimum": 16000,
            "maximum": 48000,
            "type": "integer",
            "description": "Output sample rate in Hz for `extract-audio`. Allowed values: `16000`, `44100` or `48000`. Use `16000` for speech-to-text.",
            "default": 44100
          },
          "mono": {
            "title": "Downmix to Mono (extract-audio)",
            "type": "boolean",
            "description": "Convert audio to single-channel mono when running `extract-audio`.",
            "default": false
          },
          "target_lufs": {
            "title": "Target Loudness LUFS (normalize-audio / shorts-prep / transcribe-prep)",
            "minimum": -24,
            "maximum": -9,
            "type": "number",
            "description": "Target integrated loudness in LUFS (-24 to -9). Recommended: `-14` for YouTube/Shorts/TikTok, `-16` for podcasts/STT transcription.",
            "default": -14
          },
          "true_peak": {
            "title": "True Peak Limit dBTP (normalize-audio)",
            "minimum": -6,
            "maximum": -0.5,
            "type": "number",
            "description": "Maximum true peak in dBTP (-6 to -0.5) for 2-pass EBU R128 normalization in `normalize-audio`.",
            "default": -1.5
          },
          "normalize_output_format": {
            "title": "Normalized Output Format (normalize-audio)",
            "enum": [
              "keep",
              "mp3",
              "wav",
              "mp4"
            ],
            "type": "string",
            "description": "Container/format for `normalize-audio` (`keep`, `mp3`, `wav`, or `mp4`).",
            "default": "keep"
          },
          "start_sec": {
            "title": "Start Time in Seconds (trim / shorts-prep)",
            "minimum": 0,
            "maximum": 600,
            "type": "number",
            "description": "Start timestamp in seconds (>= 0) for `trim` or `recipe/shorts-prep`.",
            "default": 0
          },
          "end_sec": {
            "title": "End Time in Seconds (trim / shorts-prep)",
            "minimum": 0.1,
            "maximum": 600,
            "type": "number",
            "description": "End timestamp in seconds (> start_sec). Required for `trim`; optional for `recipe/shorts-prep` (defaults to full clip up to 180s)."
          },
          "trim_mode": {
            "title": "Trim Mode (trim)",
            "enum": [
              "fast",
              "accurate"
            ],
            "type": "string",
            "description": "`fast` uses stream copy (keyframe-aligned, milliseconds); `accurate` re-encodes for frame-exact cuts.",
            "default": "accurate"
          },
          "trim_output_format": {
            "title": "Trim Output Format (trim)",
            "enum": [
              "mp4",
              "mp3"
            ],
            "type": "string",
            "description": "Output format (`mp4` or `mp3`) for `trim`.",
            "default": "mp4"
          },
          "shorts_resolution": {
            "title": "Vertical Resolution (recipe/shorts-prep)",
            "enum": [
              "720p",
              "1080p"
            ],
            "type": "string",
            "description": "Target 9:16 vertical resolution for `recipe/shorts-prep`: `720p` (720x1280) or `1080p` (1080x1920).",
            "default": "720p"
          },
          "subtitles_text": {
            "title": "Subtitles Text — SRT or ASS (burn-subtitles)",
            "type": "string",
            "description": "Full SRT or ASS subtitle text to burn into the video. Required for `burn-subtitles` (MVP limit: max 720p resolution and 60s duration)."
          },
          "subtitle_format": {
            "title": "Subtitle Format (burn-subtitles)",
            "enum": [
              "srt",
              "ass"
            ],
            "type": "string",
            "description": "Format of `subtitles_text` (`srt` or `ass`).",
            "default": "srt"
          },
          "font_size": {
            "title": "Font Size (burn-subtitles)",
            "minimum": 12,
            "maximum": 48,
            "type": "integer",
            "description": "Subtitle font size (12 to 48) for `burn-subtitles`.",
            "default": 22
          },
          "font_color": {
            "title": "Font Color Hex (burn-subtitles)",
            "type": "string",
            "description": "Subtitle text color in `#RRGGBB` format (default `#FFFFFF`).",
            "default": "#FFFFFF"
          },
          "outline_color": {
            "title": "Outline Color Hex (burn-subtitles)",
            "type": "string",
            "description": "Subtitle outline color in `#RRGGBB` format (default `#000000`).",
            "default": "#000000"
          },
          "position": {
            "title": "Subtitle Position (burn-subtitles)",
            "enum": [
              "bottom",
              "center",
              "top"
            ],
            "type": "string",
            "description": "Vertical subtitle placement (`bottom`, `center`, or `top`).",
            "default": "bottom"
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}