{
  "openapi": "3.0.3",
  "info": {
    "title": "vocce API",
    "description": "Hosted audio/video transcription. Upload a file, get back text + SRT + VTT + timestamped segments. No API key required during the free preview.",
    "version": "1.0.0",
    "contact": { "name": "vocce", "url": "https://vocce.io" }
  },
  "servers": [
    { "url": "https://api.vocce.io/api/v1", "description": "Production" }
  ],
  "paths": {
    "/transcribe": {
      "post": {
        "operationId": "createTranscription",
        "summary": "Start a transcription job",
        "description": "Upload a local audio or video file. Returns a task_id you then poll with getTranscription. No API key required.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Audio/video file (mp3, wav, m4a, mp4, mov, …), up to 50 MB."
                  },
                  "language": {
                    "type": "string",
                    "description": "ISO code such as 'en', 'zh', 'ja'. Omit to auto-detect."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Job accepted and queued.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/TaskCreated" }
              }
            }
          }
        }
      }
    },
    "/transcribe/tasks/{task_id}": {
      "get": {
        "operationId": "getTranscription",
        "summary": "Get transcription status and result",
        "description": "Poll a transcription task. While running, status is 'queued' or 'processing'. When status is 'done' (or 'completed'), the 'result' object holds the transcript, subtitles, and segments.",
        "parameters": [
          {
            "name": "task_id",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "The task_id returned by createTranscription."
          }
        ],
        "responses": {
          "200": {
            "description": "Current task status (and result once finished).",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Task" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "TaskCreated": {
        "type": "object",
        "properties": {
          "task_id": { "type": "string", "example": "job_2481" },
          "status": { "type": "string", "enum": ["queued"], "example": "queued" }
        }
      },
      "Task": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": ["queued", "processing", "done", "completed", "failed"],
            "description": "Job state. Terminal states are 'done'/'completed' and 'failed'."
          },
          "result": { "$ref": "#/components/schemas/TranscriptionResult" },
          "error": { "type": "string", "nullable": true, "description": "Set when status is 'failed'." }
        }
      },
      "TranscriptionResult": {
        "type": "object",
        "properties": {
          "text": { "type": "string", "description": "Full transcript as plain text." },
          "srt": { "type": "string", "description": "Subtitles in SubRip (SRT) format." },
          "vtt": { "type": "string", "description": "Subtitles in WebVTT format." },
          "language": { "type": "string", "description": "Detected or specified language code." },
          "duration": { "type": "number", "description": "Media duration in seconds." },
          "segments": {
            "type": "array",
            "description": "Timestamped transcript segments.",
            "items": {
              "type": "object",
              "properties": {
                "start": { "type": "number", "description": "Segment start time (seconds)." },
                "end": { "type": "number", "description": "Segment end time (seconds)." },
                "text": { "type": "string", "description": "Segment text." }
              }
            }
          }
        }
      }
    }
  }
}
