{
  "openapi": "3.1.0",
  "info": {
    "title": "TranscribeTool API",
    "version": "1.0.0",
    "description": "TranscribeTool converts audio, video, podcasts, and uploaded media into transcript, summary, and structured knowledge outputs. Billing is per second for transcript work and only successfully completed transcript time is charged."
  },
  "servers": [
    {
      "url": "https://transcribetool.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "TranscriptJobSource": {
        "type": "object",
        "description": "One supported transcript source.",
        "properties": {
          "youtube_url": { "type": "string", "format": "uri" },
          "vimeo_url": { "type": "string", "format": "uri" },
          "bilibili_url": { "type": "string", "format": "uri" },
          "tiktok_url": { "type": "string", "format": "uri" },
          "media_id": { "type": "string" },
          "podcast_episode_url": { "type": "string", "format": "uri" },
          "podcast_rss_url": { "type": "string", "format": "uri" },
          "podcast_audio_url": { "type": "string", "format": "uri" },
          "title": { "type": "string" },
          "feed_title": { "type": "string" },
          "published_at": { "type": "string", "format": "date-time" }
        }
      },
      "TranscriptJobCreate": {
        "type": "object",
        "required": ["source"],
        "properties": {
          "source": { "$ref": "#/components/schemas/TranscriptJobSource" },
          "source_app": { "type": "string" },
          "modules": {
            "type": "object",
            "properties": {
              "summary": { "type": "boolean" },
              "knowledge_extraction": { "type": "boolean" }
            }
          },
          "billing": {
            "type": "object",
            "properties": {
              "mode": { "type": "string", "enum": ["metered"] },
              "max_amount_usd": { "type": "number" }
            }
          }
        }
      },
      "BatchEstimate": {
        "type": "object",
        "properties": {
          "input_text": { "type": "string" },
          "topic_request": {
            "type": "object",
            "properties": {
              "topic": { "type": "string" },
              "source_types": {
                "type": "array",
                "items": { "type": "string", "enum": ["youtube", "podcast"] }
              },
              "max_items": { "type": "integer" },
              "notes": { "type": "string" }
            }
          },
          "media_ids": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      },
      "BatchCreate": {
        "type": "object",
        "properties": {
          "input_text": { "type": "string" },
          "topic_request": {
            "type": "object",
            "properties": {
              "topic": { "type": "string" },
              "source_types": {
                "type": "array",
                "items": { "type": "string", "enum": ["youtube", "podcast"] }
              },
              "max_items": { "type": "integer" },
              "notes": { "type": "string" }
            }
          },
          "media_ids": {
            "type": "array",
            "items": { "type": "string" }
          },
          "speaker_labels": { "type": "boolean" },
          "source_app": { "type": "string" }
        }
      }
    }
  },
  "paths": {
    "/api/v1/transcript-jobs": {
      "post": {
        "summary": "Start a transcript job",
        "description": "Queue one supported source for transcript processing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/TranscriptJobCreate" }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Transcript job queued"
          }
        }
      }
    },
    "/api/v1/transcript-jobs/{jobId}": {
      "get": {
        "summary": "Poll a transcript job",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Transcript job status"
          }
        }
      }
    },
    "/api/v1/batch-jobs/estimate": {
      "post": {
        "summary": "Estimate a batch",
        "description": "Discover items and estimate metered batch cost before submit.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/BatchEstimate" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch estimate"
          }
        }
      }
    },
    "/api/v1/batch-jobs": {
      "post": {
        "summary": "Start a batch job",
        "description": "Submit discovered or uploaded-media batch work for processing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/BatchCreate" }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Batch queued"
          }
        }
      }
    },
    "/api/v1/batch-jobs/{jobId}": {
      "get": {
        "summary": "Poll a batch job",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Batch job status"
          }
        }
      }
    }
  }
}
