Skip to content

Authentication

To authenticate with the API, you will need to provide your API key in the Authorization header of each request.

It should look like this:

Authorization: Bearer panjaya-{YOUR_API_KEY}

Languages support

Below is a list of supported languages and their corresponding locale codes that are used in Panjaya Dubbing Studio API. Please note that some languages are marked as source languages only, meaning they can only be used as the source language of the uploaded videos, while some are marked as target languages only - meaning they can only be translated into.

LanguageLocale codeSource supportedTarget supported
Arabicar-AE
Bulgarianbg-BG
Chinesezh-CN
Croatianhr-HR
Czechcs-CZ
Danishda-DK
Dutchnl-NL
Englishen-US
Filipinofil-PH
Finnishfi-FI
Frenchfr-FR
Germande-DE
Greekel-GR
Hebrewhe-IL🚫
Hindihi-IN
Hungarianhu-HU
Indonesianid-ID
Italianit-IT
Japaneseja-JP
Koreanko-KR
Lithuanianlt-LT
Malayms-MY
Norwegiannb-NO
Polishpl-PL
Portuguesept-BR
Portuguesept-PT
Romanianro-RO
Russianru-RU
Slovaksk-SK
Spanishes-ES
Spanishes-MX
Swedishsv-SE
Tamilta-IN
Turkishtr-TR
Ukrainianuk-UA
Vietnamesevi-VN

Error codes

Panjaya Dubbing Studio API uses standard HTTP status codes to indicate the success or failure of an API request. In case of an error, the response body will include a detailed error message to help you identify and resolve the issue.

Here is a list of erroneous HTTP status codes and their general meanings:

  • 401 Unauthorized: The API key could not be validated
  • 400 Bad Request: The request could not be processed due to invalid input
  • 403 Forbidden: The request could not be completed due to account limitations
  • 404 Not Found: The requested resource was not found
  • 500 Internal Server Error: An internal server error occurred
Overview
Languages
Servers

https://api.panjaya.ai/

Assets

Assets are the core resource in Panjaya Dubbing Studio. An asset represents a source video you want to dub into different languages. Each asset can be dubbed into multiple languages, and every language is assigned a unique dubbing ID. You can optionally add SRT files for better accuracy.

Operations

Versions

After upload, an initial version of the dub is automatically created for each language. You can create additional versions for each language to act as snapshots in time as you edit or to edit independently, with each version identified by a unique version ID.

Operations

Callbacks

Learn how to use a callback URL to receive real-time status updates about the dubbing process.

Webhooks

Request

To stay informed about the progress of dubbing processes, you can configure a callback URL.

For every status update related to an asset or its versions, Panjaya will send an HTTP POST request to the specified URL.

Each update includes the following details:

  • Asset ID: The unique identifier for the asset. This field is always included.
  • Version ID: The unique identifier for the version. This field is optional and is included only for version-related events.
  • Version locale: The target language of the version. This field is optional and is included only for version-related events.
  • Event type specifies the type of event that occurred. Possible values are:
    • asset_failed: An error occurred while processing the asset. In this case, version_id field will be null.
    • version_ready: The version is ready for QC and additional editing in the workspace
    • version_failed An error occurred during the dubbing process for this version.
    • version_generating The version final video generation process has started.
    • version_generated: The version has been successfully generated. A URL to download the final video will be provided in the result_url field in Get Version endpoint.
    • version_generate_failed: An error occurred during the video generation process.

Signature verification

To ensure the authenticity of our callback requests, each request will include a signature in the X-Signature header.

The signature is calculated on the raw HTTP request's body, using the ES256 algorithm.

Optionally, you may use the X-Signature header to verify the authenticity of our request in your server.

Below is Panjaya's public key, to be used for verifying our callback's content:

-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZbUzbbuVyzSv7zVmH6rKypr6ojSS
/86W9dU6mwbdfAtUAx+QI7GNxl/4H1QV2BuBrysabh56O/YXhnFJMh7Lng==
-----END PUBLIC KEY-----

And here's an example of how to verify the signature in Python:

import binascii
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.exceptions import InvalidSignature

PANJAYA_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZbUzbbuVyzSv7zVmH6rKypr6ojSS\n/86W9dU6mwbdfAtUAx+QI7GNxl/4H1QV2BuBrysabh56O/YXhnFJMh7Lng==\n-----END PUBLIC KEY-----'
public_key = serialization.load_pem_public_key(PANJAYA_PUBLIC_KEY.encode())

def validate_panjaya_signature(request: Request) -> bool:
    raw_body = request.body()
    signature = request.headers.get("X-Signature")
    try:
        signature_bytes = binascii.unhexlify(signature)
        public_key.verify(signature_bytes, raw_body, ec.ECDSA(hashes.SHA256()))
        print("Signature is valid ✅")
        return True
    except InvalidSignature:
        print("Signature is invalid ❌")
        return False

Here's an example of the payload you can expect:

Headers
X-Signaturestringrequired

ES256 signature of the request body. Can be used to verify the authenticity of the request.

X-Signature-Algorithmstring
Default ES256
Value "ES256"
Bodyapplication/jsonrequired
eventstringrequired
Enum"asset_failed""version_ready""version_failed""version_generating""version_generated""version_generate_failed"
asset_idstringrequired
version_idstring or null
Any of:
string
version_localestring or null
Any of:
string
application/json
{ "event": "version_generated", "asset_id": "7b9b9e3c3c7e322aec4c3d9b", "version_id": "7b9b9e3c3c7e322aec4c3d9d" }

Responses

Successful Response

Bodyapplication/json
any
Response
application/json
null