Translate a document
translate_documentTranslate a PDF (native or scanned), Word, PowerPoint, Excel, EPUB or image file and get a translated file with its layout preserved (native formats retain their type; images return PNG; converted formats return DOCX). Also accepts DOC, ODT, RTF, TXT, Markdown, HTML, subtitles, CSV and ebooks. Up to 50 MB and 1,000 PDF pages. Waits up to wait_seconds; if the document is still running, call get_document with the returned id. Charges the quoted credits once; failed documents are refunded.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tier | No | fast (default) or advanced (most accurate, more credits). | |
| output | No | formatted (default): layout preserved; native formats retain their type, images return PNG, converted formats return DOCX. text: translated text only, usually cheaper. | |
| file_url | No | Public https URL of the document. Provide this or file_base64. | |
| filename | No | File name with extension, e.g. contract.pdf. Required with file_base64; optional with file_url. | |
| file_base64 | No | The document's bytes, base64-encoded. Requires filename. | |
| max_credits | No | Refuse (without charging) if the document would cost more credits than this. | |
| wait_seconds | No | How long to wait for the result (default 50). | |
| source_language | No | Source language name or code. Omit to detect it. | |
| target_language | Yes | Language name (e.g. "Spanish", "Ancient Greek") or code from list_languages (e.g. "spa_Latn"). |