POST
/
parse
/
translatepdf

Headers

api-subscription-key
string
default:

Your unique subscription key for authenticating requests to the Sarvam AI Speech-to-Text API. " "Here are the steps to get your api key", example="dxxxxxx-bxxx-4xxx-axxx-cxxxxxxxxxxx

Body

multipart/form-data
pdf
file
required

Upload he PDF file you want to translate. This should be uploaded as a form input if you're using multipart/form-data.Note:- TranslatePDF supports only digital PDFs with selectable text for translation; scanned PDFs cannot be processed.

page_number
string
default:
1

The page number you want to translate. Use a one-based index (e.g., 1 for the first page). You can send an empty value if you want to translate the entire document.

hard_translate_dict
string

A dictionary of words for which you want to hardcode the translation. A list of words that you want to translate in a specific way. When these words appear in the document, the system will use your custom translation instead of automatic translation.If you add a dictionary with {"Hello": "नमस्कार"}, every time the word "नमस्कार" appears in the document, it will be translated as "नमस्कार" instead of the usual translation.

input_lang
string
default:
en-IN

The language code of the input PDF. If you don’t specify, the system will try to detect it automatically.Note:-TranslatePDF currently supports only English language PDFs for translation.

output_lang
enum<string>

The language code of the output text. This specifies the target language for translation. Available options: hi = "hi-IN" bn = "bn-IN" gu = "gu-IN" kn = "kn-IN" ml = "ml-IN" mr = "mr-IN" od = "od-IN" pa = "pa-IN" ta = "ta-IN" te = "te-IN" Example: "hi-IN" for Hindi

Available options:
hi-IN,
bn-IN,
kn-IN,
ml-IN,
mr-IN,
od-IN,
pa-IN,
ta-IN,
te-IN,
en-IN,
gu-IN

Response

200
application/json
Successful Response
translated_pdf
string | null

The translated PDF document in base64 encoding.