Skip to main content

Translate Document

Translate documents to other languages.

Endpoint

POST /api/v3/documents/{id}/translate

Request

{
"target_language": "fr"
}

Response

{
"translated_document_id": 456,
"source_language": "en",
"target_language": "fr",
"status": "completed"
}

Creates a new document with translated content.

Examples

Translate to French

curl -X POST https://api.scriptix.io/api/v3/documents/123/translate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"target_language": "fr"}'

Python

response = requests.post(
'https://api.scriptix.io/api/v3/documents/123/translate',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={'target_language': 'fr'}
)

result = response.json()
translated_id = result['translated_document_id']

# Retrieve translated document
translated = requests.get(
f'https://api.scriptix.io/api/v3/documents/{translated_id}',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
).json()

print(f"Translated text: {translated['content']['text']}")

Supported Languages

See Supported Languages for complete list.