GET
/translate/file
Requires Auth
Translate file from URL (Synchronous)
Translates a file from URL synchronously. Returns HTML page by default or JSON if format=json. Use this for small files (< 10MB). Supports bilingual mode to keep original text alongside translation.
Parameters
file
*
query
string
URL of the file to translate (must be publicly accessible)
Example:
https://example.com/document.pdf
target
query
string
Target language code (ISO 639-1). Default: en
Example:
ar
Allowed Values:
en
ar
fr
es
de
zh
ja
ru
pt
it
ko
hi
tr
fa
format
query
string
Response format
Example:
html
Allowed Values:
html
json
async
query
string
Enable asynchronous processing. Use 'true' for large files to avoid timeouts.
Example:
false
Allowed Values:
true
false
bilingual
query
string
Enable bilingual mode. When true, original text is kept and translation is added below it. Also accepts: keep_original, dual_language, show_original as aliases.
Example:
false
Allowed Values:
true
false
keep_original
dual_language
show_original
Code Examples
curl -X GET \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
'https://nexus-api.dhurgham.dev/api/file-translation-api/translate/file?file=https%3A%2F%2Fexample.com%2Fdocument.pdf&target=ar&format=html&async=false&bilingual=false'
Example cURL Request
curl -X GET \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
'https://nexus-api.dhurgham.dev/api/file-translation-api/translate/file?file=https%3A%2F%2Fexample.com%2Fdocument.pdf&target=ar&format=html&async=false&bilingual=false'
frontend.example_response
{
"success": true,
"download_url": "https://nexus-api.dhurgham.dev/api/file-translation-api/dl/abc123",
"message": "Translation completed successfully"
}