apyhub
FILE CONVERSION · SMART GENERATION

Translate Documents API

Hosted on ApyHub

What it does

Document Translation translates uploaded documents or documents fetched from a URL into a target language. Send a file or a document URL, choose an Azure language code, and get translated text back with the translated language in the response.

Use the /file endpoint when you already have the document bytes, or /url when the source document is hosted elsewhere. Both endpoints accept a file_type query parameter, and the file-based endpoint also accepts transliteration in the query string. The URL-based endpoint lets you request transliteration with perform_transliteration in the body.

The response includes translation and translated_language, which are required. When available, it can also return detected_language with a score and language code, plus transliteration when transliteration is requested and supported. That makes it useful for workflows where you need the translated document text for review, indexing, or downstream language-specific processing.

Use Document Translation when you need to localize uploaded PDFs and other document files, extract translated content from a hosted document, or route content based on detected language without building your own translation pipeline.

▣ ENDPOINT 01 / 02
POST
Translate uploaded document
http://localhost:8080/apyhub/translate-documents/file
QUICKSTARTGUIDE

Quickstart

Translate a document file to a target language by uploading the file and its language code.

curl -X POST "http://localhost:8080/apyhub/translate-documents/file" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/document.pdf" \
  -F "language=fr"

What you'll get back

Returns a JSON object with required translation and translated_language string fields. It may also include transliteration as a string, and detected_language as an object with score and language.

{
  "translation": "Translated document text.",
  "translated_language": "de",
  "detected_language": {
    "score": 1,
    "language": "en"
  }
}
TRY ITLIVE · 150 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
Document file to translate.
Azure target language code (e.g. fr, de).

About this endpoint

What it does

Uploads a document file and translates its text into the requested target language. You can also provide optional query parameters to indicate the file type and request transliteration.

Query Parameter(s)

AttributeTypeMandatoryDescription
file_typeStringNoFile type hint for the uploaded document. Example: pdf.
transliterationStringNoRequest transliteration support. Example value: true.

Request Body

ParameterTypeMandatoryDescription
fileStringYesDocument file to translate. Binary file upload.
languageStringYesAzure target language code, such as fr or de.

Response

Returns a JSON object with required translation and translated_language string fields. It may also include transliteration as a string, and detected_language as an object containing optional score and language fields.

ParameterTypeMandatoryDescription
translationStringYesTranslated document text.
transliterationStringNoPresent when transliteration was requested and supported.
detected_languageObjectNoDetected source language details. Contains score and language when provided.
detected_language.scoreNumberNoDetection confidence score as a float.
detected_language.languageStringNoDetected language code.
translated_languageStringYesThe translated language code.

Query parameters

Name
Type
Description
file_typeOPTIONAL
string
transliterationOPTIONAL
string

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 02 / 02
POST
Translate document from URL
http://localhost:8080/apyhub/translate-documents/url
QUICKSTARTGUIDE

Quickstart

Translate a document from a file URL into the target language.

curl -X POST "http://localhost:8080/apyhub/translate-documents/url" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://assets.apyhub.com/samples/sample.pdf",
    "language": "de"
  }'

What you'll get back

Returns a JSON object with required translation and translated_language string fields. The response may also include transliteration and detected_language.

{
  "translation": "Translated document text.",
  "translated_language": "de"
}
TRY ITLIVE · 150 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*

About this endpoint

What it does

Translates a document fetched from a URL into the target language you provide, and returns the translated text along with the translated language. It can also include transliteration output when requested and supported.

Query Parameter(s)

AttributeTypeMandatoryDescription
file_typeStringNoFile type of the source document, such as pdf.
transliterationStringNoRequest transliteration support.

Request Body

ParameterTypeMandatoryDescription
urlStringYesSource document URL. Must be a URI.
languageStringYesTarget language code, such as de.
perform_transliterationBooleanNoWhether transliteration should be performed.

Response

Returns a JSON object with translation and translated_language string fields. It may also include a transliteration string field, and a detected_language object containing score and language when available.

ParameterTypeMandatoryDescription
translationStringYesTranslated document text.
transliterationStringNoPresent when transliteration was requested and supported.
detected_languageObjectNoDetected source language details.<br>Contains:<br>- score (Number) — confidence score.<br>- language (String) — detected language code.
translated_languageStringYesLanguage code of the translated document, such as de.

Query parameters

Name
Type
Description
file_typeOPTIONAL
string
transliterationOPTIONAL
string

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.