Create task

POST

Parameters

Header parameters

NameDescription
dupdub_tokenYour DupDub token
Content-Typeapplication/json

Body parameters

NameTypeDescription
videoUrlstring | requiredURL of the video to be translated
sourceLanguagestring | requiredThe source language:
Afrikaans
Arabic
Armenian
Azerbaijani
Belarusian
Bosnian
Bulgarian
Catalan
Chinese
Croatian
Czech
Danish
Dutch
English
Estonian
Finnish
French
Galician
German
Greek
Hebrew
Hindi
Hungarian
Icelandic
Indonesian
Italian
Japanese
Kannada
Kazakh
Korean
Latvian
Lithuanian
Macedonian
Malay
Marathi
Maori
Nepali
Norwegian
Persian
Polish
Portuguese
Romanian
Russian
Serbian
Slovak
Slovenian
Spanish
Swahili
Swedish
Tagalog
Tamil
Thai
Turkish
Ukrainian
Urdu
Vietnamese
Welsh
targetLanguagestring | requiredThe target language:
English
Japanese
Chinese
German
Hindi
French
Korean
Portuguese
Italian
Spanish
Indonesian
Dutch
Turkish
Filipino
Polish
Swedish
Bulgarian
Romanian
Arabic
Czech
Greek
Finnish
Croatian
Malay
Slovak
Danish
Tamil
Ukrainian
Russian
speakerNuminteger | required-1: auto
1 ~ 8
titlestring | optionalThe title of the translation project
lipSyncinteger | optionalSpecifies if lip synchronization is required
1: Yes
2: No (default)
musicStatusinteger | optionalSpecified if preserve background music
1: Yes
2: No (default)
captionsTypeinteger | optionalSpecified if add subtitle
1: Yes
2: No (default)
subtitleTypeinteger | optionalSpecified whether to use the original text, the translation text, or both for the subtitles. This setting is applicable only when captionType is set to 1
1: Translation
2: Original
3: Both
transTextinteger | optionalRemove captions from the source video:
1: Yes
2: No (default)

Response

NameTypeDescription
dataobjectThe container object for the response data
├ idintegerUnique identifier of the project
├ sourcestringSource URL of the video
├ userIdintegerUser identifier associated with the project
├ titlestringTitle of the project
├ taskIdstringTask identifier for the project
├ videoUrl stringURL of the translated video
├ durationintegerDuration of the video in seconds
├ spaceSizeintegerThe size of the video file in bytes
├ widthintegerWidth of the video
├ heightintegerHeight of the video
├ executeStatusintegerExecution status of the translation process
1: Processing
2: Succeed
3: Failed
├ executeMsgstringExecution message or error message if any
├ statusintegerCurrent status of the project
0: Failed
1: Succeed
├ sourceLanguage stringSource language of the video
├ targetLanguagestringTarget language of the translation
├ transTextintegerSubtitle removal status
├ lipSyncintegerLip sync status
├ speakerNumintegerNumber of speakers in the translated video
├ retVideoUrlstringURL of the resulting translated video
├ coverPhotoUrl stringURL of the cover photo for the video
├ lastopenAtstringLast access time
├ createdAt stringCreation date and time of the project
├ updatedAt stringLast update date and time of the project
├ statusPercentage integerPercentage completion of the project
├ statusPercentageName stringName description of the completion percentage
├ watchStatusintegerWatching status of the project
0: No
1: Yes
├ withoutVideo integerStatus of final video synthesis
1: No synthesized
2: Synthesized
codeintegerResponse code indicating success or failure
200: Succeed
400: Parameter validation failed
403: No relevant permissions
500: Failed
502: Gateway service exception
2001: Login failed, please login again
2060: You do not have enough remaining credits or an active subscription. Upgrade your plan to access more
3000: Server error, please try again later
3018: Server error, please try again later
4082: Failed to parse the video
4083: Your account doesn’t have enough credits. Upgrade to create this video
4084: The video duration is too short, please try another one
messagestring A message providing additional information about the response code

Sample Codes

Request

import requests

# API endpoint for creating a video translation project
url = "https://moyin-gateway.dupdub.com/tts/v1/videoTrans/create"

# Your DupDub API key
api_key = "<<Your DupDub API Key>>"

# Project details
data = {
  "videoUrl": "https://cdn-static.dupdub.com/backend/subtitles/2024-03-08-9220709806353611459.mp4",
  "sourceLanguage": "English",
  "targetLanguage": "German",
  "title": "Did Mona Lisa Find The Pearl Earring?",
  "speakerNum": -1
}

headers = {
    "dupdub_token": f"{api_key}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=data, headers=headers)

# Parse the response
if response.status_code == 200:
    result = response.json()
    print(result)
    task_id = result["data"]["taskId"]
    print("Project created successfully. Task ID:", task_id)
    
else:
    print("Failed to create project. Status Code:", response.status_code)

Response

{
  'code': 200,
  'message': 'OK',
  'data': {
    'id': 2649,
    'source': 'web',
    'userId': 131361,
    'title': 'Did Mona Lisa Find The Pearl Earring?',
    'taskId': '5fa12a2571ef49d79c0109edb10ac9ba',
    'videoUrl': 'https://cdn-static.dupdub.com/backend/subtitles/2024-03-08-9220709806353611459.mp4',
    'duration': 40,
    'spaceSize': None,
    'width': 270,
    'height': 480,
    'executeStatus': 1,
    'executeMsg': None,
    'status': 1,
    'sourceLanguage': 'English',
    'targetLanguage': 'German',
    'transText': 2,
    'lipSync': 2,
    'speakerNum': -1,
    'retVideoUrl': None,
    'coverPhotoUrl': 'https://cdn-static.dupdub.com/backend/subtitles/bbb89ca117c04df59381378ff0b99722.png',
    'lastopenAt': '2024-03-09 14:43:04',
    'createdAt': '2024-03-09 14:43:04',
    'updatedAt': '2024-03-09 14:43:04',
    'statusPercentage': None,
    'watchStatus': None,
    'statusPercentageName': None,
    'withoutVideo': 2
  }
}
Table of Contents