curl --request POST \
--url https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_id": "<string>",
"target_language": "<string>",
"attachment_filters": [
{
"name": "<string>",
"id": "<string>",
"mime_type": "<string>"
}
],
"prompt_extension": "",
"pubsub_topic": "<string>"
}
'import requests
url = "https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate"
payload = {
"document_id": "<string>",
"target_language": "<string>",
"attachment_filters": [
{
"name": "<string>",
"id": "<string>",
"mime_type": "<string>"
}
],
"prompt_extension": "",
"pubsub_topic": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document_id: '<string>',
target_language: '<string>',
attachment_filters: [{name: '<string>', id: '<string>', mime_type: '<string>'}],
prompt_extension: '',
pubsub_topic: '<string>'
})
};
fetch('https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_id' => '<string>',
'target_language' => '<string>',
'attachment_filters' => [
[
'name' => '<string>',
'id' => '<string>',
'mime_type' => '<string>'
]
],
'prompt_extension' => '',
'pubsub_topic' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate"
payload := strings.NewReader("{\n \"document_id\": \"<string>\",\n \"target_language\": \"<string>\",\n \"attachment_filters\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n ],\n \"prompt_extension\": \"\",\n \"pubsub_topic\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document_id\": \"<string>\",\n \"target_language\": \"<string>\",\n \"attachment_filters\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n ],\n \"prompt_extension\": \"\",\n \"pubsub_topic\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_id\": \"<string>\",\n \"target_language\": \"<string>\",\n \"attachment_filters\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n ],\n \"prompt_extension\": \"\",\n \"pubsub_topic\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"translations_started": [
{
"job_id": "<string>",
"attachment_id": "<string>",
"attachment_title": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Translate Document Api
Translates document attachments to a target language while preserving formatting. Supports .doc, .docx, .ppt, .xlsx, .pptx files and Google Docs, Sheets, Slides.
curl --request POST \
--url https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document_id": "<string>",
"target_language": "<string>",
"attachment_filters": [
{
"name": "<string>",
"id": "<string>",
"mime_type": "<string>"
}
],
"prompt_extension": "",
"pubsub_topic": "<string>"
}
'import requests
url = "https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate"
payload = {
"document_id": "<string>",
"target_language": "<string>",
"attachment_filters": [
{
"name": "<string>",
"id": "<string>",
"mime_type": "<string>"
}
],
"prompt_extension": "",
"pubsub_topic": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document_id: '<string>',
target_language: '<string>',
attachment_filters: [{name: '<string>', id: '<string>', mime_type: '<string>'}],
prompt_extension: '',
pubsub_topic: '<string>'
})
};
fetch('https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_id' => '<string>',
'target_language' => '<string>',
'attachment_filters' => [
[
'name' => '<string>',
'id' => '<string>',
'mime_type' => '<string>'
]
],
'prompt_extension' => '',
'pubsub_topic' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate"
payload := strings.NewReader("{\n \"document_id\": \"<string>\",\n \"target_language\": \"<string>\",\n \"attachment_filters\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n ],\n \"prompt_extension\": \"\",\n \"pubsub_topic\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document_id\": \"<string>\",\n \"target_language\": \"<string>\",\n \"attachment_filters\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n ],\n \"prompt_extension\": \"\",\n \"pubsub_topic\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://document-assistant.us.aodocs.app/assistant/api/v1/tenants/{tenant}/documents/{document_id}/content:translate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_id\": \"<string>\",\n \"target_language\": \"<string>\",\n \"attachment_filters\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\",\n \"mime_type\": \"<string>\"\n }\n ],\n \"prompt_extension\": \"\",\n \"pubsub_topic\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"translations_started": [
{
"job_id": "<string>",
"attachment_id": "<string>",
"attachment_title": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The document id
The domain of the customer
"example.com"
Body
The ID of the document to translate
The target language for translation (e.g. 'French', 'German', 'Spanish')
The attachments to translate. If provided, only attachments matching one of the filters are translated. If not provided, all supported attachments will be translated.
Show child attributes
Show child attributes
Optional additional instructions appended to the translation prompt
Fully-qualified Pub/Sub topic ('projects//topics/') to receive per-attachment completion/failure notifications. If omitted, no notifications are sent.
Response
Successful Response
List of attachments for which translation has been started
Show child attributes
Show child attributes