{
  "openapi": "3.1.0",
  "info": {
    "title": "DubSphere API — AI Video Dubbing & Voice Translation",
    "description": "DubSphere is the #1 AI video dubbing platform. This API enables developers to dub videos into 50+ languages, convert text to speech with 100+ natural voices, clone voices, generate subtitles, detect languages, and manage dubbing projects programmatically. Used by 10,000+ creators, agencies, and enterprises worldwide.\n\n## Quick Start\n1. Sign up at https://dubsphere.com/signup\n2. Get your API key from the Dashboard\n3. Start dubbing videos in minutes\n\n## SDK\nOfficial JavaScript/TypeScript SDK: https://dubsphere.com/sdk/dubsphere-sdk.js\n\n## Supported Languages\nEnglish, Spanish, French, German, Hindi, Arabic, Japanese, Korean, Chinese, Portuguese, Bengali, Turkish, Russian, Italian, Dutch, Polish, Thai, Vietnamese, Indonesian, Swedish, Norwegian, Danish, Finnish, Greek, Czech, Romanian, Hungarian, Ukrainian, Hebrew, Tamil, Telugu, Urdu, Persian, Swahili, Filipino, Malay, and more.",
    "version": "2.0.0",
    "contact": { "name": "DubSphere Support", "email": "support@dubsphere.com", "url": "https://dubsphere.com" },
    "license": { "name": "Proprietary" },
    "x-logo": { "url": "https://dubsphere.com/og-image.png" }
  },
  "servers": [{ "url": "https://api.dubsphere.com", "description": "Production API Server" }],
  "security": [{ "ApiKeyAuth": [] }],
  "tags": [
    { "name": "Dubbing", "description": "AI video dubbing operations — dub any video into 50+ languages" },
    { "name": "Text-to-Speech", "description": "Convert text to natural-sounding speech with 100+ voices" },
    { "name": "Voice Cloning", "description": "Clone voices to speak in any supported language" },
    { "name": "Transcription", "description": "Speech-to-text transcription with auto language detection" },
    { "name": "Subtitles", "description": "Generate subtitle files in source and target languages" },
    { "name": "Language", "description": "Language detection and supported languages listing" },
    { "name": "Voices", "description": "Browse and manage available voices" },
    { "name": "Usage", "description": "API usage tracking and credit management" }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "x-api-key", "description": "API key from your DubSphere dashboard" }
    },
    "schemas": {
      "DubbingRequest": {
        "type": "object",
        "required": ["video_url", "target_language"],
        "properties": {
          "video_url": { "type": "string", "format": "uri", "description": "URL of the source video (MP4, MOV, AVI, MKV, WebM)" },
          "target_language": { "type": "string", "description": "ISO 639-1 language code (e.g. es, fr, bn, ja, ko, ar, hi, zh)" },
          "voice_id": { "type": "string", "description": "Optional specific voice ID from the voice library" },
          "preserve_background": { "type": "boolean", "default": true, "description": "Preserve original background music and sound effects" },
          "lip_sync": { "type": "boolean", "default": false, "description": "Enable AI lip-sync for speaker's mouth matching" },
          "generate_subtitles": { "type": "boolean", "default": false, "description": "Auto-generate .srt subtitle files" }
        }
      },
      "TTSRequest": {
        "type": "object",
        "required": ["text"],
        "properties": {
          "text": { "type": "string", "maxLength": 10000, "description": "Text to convert to speech" },
          "language": { "type": "string", "default": "en", "description": "Language code" },
          "voice_id": { "type": "string", "description": "Voice ID from voice library" },
          "speed": { "type": "number", "minimum": 0.5, "maximum": 2.0, "default": 1.0 }
        }
      },
      "VoiceCloneRequest": {
        "type": "object",
        "required": ["audio_url", "name"],
        "properties": {
          "audio_url": { "type": "string", "format": "uri", "description": "URL of voice sample audio (30s-5min)" },
          "name": { "type": "string", "description": "Name for the cloned voice" }
        }
      }
    }
  },
  "paths": {
    "/v1/dubbing": {
      "post": {
        "tags": ["Dubbing"],
        "summary": "Dub a Video into Another Language",
        "description": "Submit a video for AI dubbing. The video is transcribed, translated, and re-voiced with natural-sounding AI voices in the target language. Supports 50+ languages with background music preservation and optional lip-sync.",
        "operationId": "dubVideo",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DubbingRequest" } } }
        },
        "responses": {
          "200": {
            "description": "Dubbing job started successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "project_id": { "type": "string" },
                    "status": { "type": "string", "enum": ["processing", "completed", "failed"] },
                    "estimated_time": { "type": "string", "description": "Estimated completion time" },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/dubbing/{project_id}": {
      "get": {
        "tags": ["Dubbing"],
        "summary": "Check Dubbing Status",
        "operationId": "getDubbingStatus",
        "parameters": [{ "name": "project_id", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": {
            "description": "Dubbing status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "project_id": { "type": "string" },
                    "status": { "type": "string" },
                    "dubbed_video_url": { "type": "string", "nullable": true },
                    "subtitle_url": { "type": "string", "nullable": true }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/tts": {
      "post": {
        "tags": ["Text-to-Speech"],
        "summary": "Convert Text to Speech",
        "description": "Generate natural-sounding speech from text in 50+ languages using 100+ premium AI voices. Supports speed control and voice selection.",
        "operationId": "textToSpeech",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TTSRequest" } } }
        },
        "responses": {
          "200": {
            "description": "Audio generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "audio_url": { "type": "string", "format": "uri" },
                    "duration_seconds": { "type": "number" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/clone-voice": {
      "post": {
        "tags": ["Voice Cloning"],
        "summary": "Clone a Voice",
        "description": "Create a digital clone of any voice from a 30-second to 5-minute audio sample. The cloned voice can then speak in any of the 50+ supported languages.",
        "operationId": "cloneVoice",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoiceCloneRequest" } } }
        },
        "responses": {
          "200": {
            "description": "Voice cloned",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "voice_id": { "type": "string" },
                    "name": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/transcribe": {
      "post": {
        "tags": ["Transcription"],
        "summary": "Transcribe Audio/Video",
        "description": "Transcribe speech from audio or video files with automatic language detection. Returns timestamped transcript.",
        "operationId": "transcribe",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["url"],
                "properties": {
                  "url": { "type": "string", "format": "uri" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transcription result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "transcript": { "type": "string" },
                    "language": { "type": "string" },
                    "segments": { "type": "array", "items": { "type": "object" } }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/subtitles": {
      "post": {
        "tags": ["Subtitles"],
        "summary": "Generate Subtitles",
        "description": "Generate .srt subtitle files from video in both source and translated target languages.",
        "operationId": "generateSubtitles",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["video_url", "target_language"],
                "properties": {
                  "video_url": { "type": "string", "format": "uri" },
                  "target_language": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subtitles generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "source_srt_url": { "type": "string" },
                    "target_srt_url": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/detect-language": {
      "post": {
        "tags": ["Language"],
        "summary": "Detect Language",
        "description": "Detect the language of given text or audio with confidence score.",
        "operationId": "detectLanguage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["text"],
                "properties": { "text": { "type": "string" } }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Language detected",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "detected_language": { "type": "string" },
                    "language_name": { "type": "string" },
                    "confidence": { "type": "number" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/languages": {
      "get": {
        "tags": ["Language"],
        "summary": "List All 50+ Supported Languages",
        "operationId": "getLanguages",
        "responses": {
          "200": {
            "description": "Complete list of supported languages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "languages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": { "type": "string" },
                          "name": { "type": "string" },
                          "native_name": { "type": "string" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/voices": {
      "get": {
        "tags": ["Voices"],
        "summary": "List Available Voices",
        "description": "Browse 100+ premium AI voices across all supported languages.",
        "operationId": "listVoices",
        "parameters": [
          { "name": "language", "in": "query", "schema": { "type": "string" }, "description": "Filter by language code" }
        ],
        "responses": {
          "200": {
            "description": "Voice list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "voices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "voice_id": { "type": "string" },
                          "name": { "type": "string" },
                          "language": { "type": "string" },
                          "gender": { "type": "string" },
                          "preview_url": { "type": "string" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "tags": ["Usage"],
        "summary": "Check API Usage & Credits",
        "operationId": "getUsage",
        "responses": {
          "200": {
            "description": "Current usage statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "monthly_used": { "type": "integer" },
                    "monthly_limit": { "type": "integer" },
                    "credits_remaining": { "type": "integer" },
                    "plan": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
