> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt.
> For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Create Document Translation Job

POST https://api.sarvam.ai/translate/document/jobs
Content-Type: application/json

## Document Translation

Create a document translation job. Returns a `job_id` and a short-lived signed `upload_url`.

**Flow:**

1. `POST /translate/document/jobs` with source/target languages and options.
2. `PUT` the raw file bytes to `upload_url` with header `Content-Type: <mime>`.
3. `POST /translate/document/jobs/{job_id}/start` to begin the pipeline.
4. Poll `GET /translate/document/jobs/{job_id}/live-status` until translation completes.
5. `POST /translate/document/jobs/{job_id}/export?lang=<code>&format=<fmt>` to enqueue an async export for each target language.
6. Poll `GET /translate/document/jobs/{job_id}/export/status` until `export_state` is `Completed`, then download from `download_url`.

A single job translates into every language in `target_language_codes`. Exports run asynchronously — do not expect the download URL in the trigger response.

Reference: https://docs.sarvam.ai/api-reference/translate-document/create-doc-translation

## Authentication

- `api-subscription-key` header (required)

## Request

### Body (application/json)

- `job_name` (string, required) — Human-readable job name.
- `source_language_code` (enum, required) — Source language (BCP-47).
  - Allowed values: `as-IN`, `bn-IN`, `brx-IN`, `doi-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ks-IN`, `kok-IN`, `mai-IN`, `ml-IN`, `mni-IN`, `mr-IN`, `ne-IN`, `or-IN`, `pa-IN`, `sa-IN`, `sat-IN`, `sd-IN`, `ta-IN`, `te-IN`, `ur-IN`
- `original_filename` (string, required) — Original filename with extension. Supported: PDF, OOXML, legacy Office, HTML, ODF.
- `target_language_codes` (list of enum, required) — Target languages (BCP-47).
  - Allowed values: `as-IN`, `bn-IN`, `brx-IN`, `doi-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ks-IN`, `kok-IN`, `mai-IN`, `ml-IN`, `mni-IN`, `mr-IN`, `ne-IN`, `or-IN`, `pa-IN`, `sa-IN`, `sat-IN`, `sd-IN`, `ta-IN`, `te-IN`, `ur-IN`
- `genre` (enum, optional, nullable) — Genre enum name (e.g. `NON_FICTION`). Use the enum constant name, not the human-readable label.
  - Allowed values: `NON_FICTION`, `ADULT_FICTION`, `CHILDREN_FICTION`, `RELIGIOUS`, `LEGAL`, `ACADEMIC`
- `metadata` (map from string to any, optional, nullable) — Arbitrary key-value metadata attached to the job.
- `auto_process` (boolean, optional, default: true) — When true (default), translation begins automatically after the document is parsed.
- `model_type` (enum, optional, nullable) — Translation model quality tier: `lite` (faster, short-form content) or `plus` (higher quality, long-form content). Defaults to `plus` when omitted.
  - Allowed values: `lite`, `plus`
- `use_native_numerals` (boolean, optional, nullable) — `null` (default) uses the application default. `true` uses native numerals; `false` uses international numerals.
- `style_guidelines` (string, optional, nullable) — Global tone, terminology, and formatting instructions (up to ~4000 characters). Applies to every target language.
- `language_specific_guidelines` (map from string to string, optional, nullable) — Per-language overrides (up to ~4000 characters each). Keys must match entries in `target_language_codes`.

## Response

### 201

Job created.

- `job_id` (string, required) — Unique job identifier.
- `upload_url` (string, required) — Signed URL for direct file upload.
- `expires_in_hours` (integer, required) — Hours until the upload URL expires.
- `source_language_code` (string, required) — Echo of request source language.
- `target_language_codes` (list of string, required) — Echo of target languages.

## Examples

**Request**

```json
{
  "job_name": "chapter1",
  "source_language_code": "en-IN",
  "original_filename": "chapter1.pdf",
  "target_language_codes": [
    "hi-IN",
    "ta-IN"
  ],
  "genre": "NON_FICTION",
  "auto_process": true,
  "model_type": "plus",
  "use_native_numerals": true
}
```

**Response**

```json
{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "upload_url": "https://api.sarvam.ai/translate/document/uploads/550e8400-e29b-41d4-a716-446655440000?sig=...",
  "expires_in_hours": 24,
  "source_language_code": "en-IN",
  "target_language_codes": [
    "hi-IN",
    "ta-IN"
  ]
}
```

**SDK Code**

```python
from sarvamai import SarvamAI
import requests

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

job = client.document_translation.create(
    job_name="chapter1",
    source_language_code="en-IN",
    target_language_codes=["hi-IN", "ta-IN"],
    original_filename="chapter1.pdf",
)

# SDK does not upload the file — PUT bytes to the signed URL, then start.
with open("chapter1.pdf", "rb") as f:
    requests.put(
        job.upload_url,
        data=f,
        headers={
            "Content-Type": "application/pdf",
            "x-ms-blob-type": "BlockBlob",
        },
    )

client.document_translation.start(job_id=job.job_id)

```

```python
from sarvamai import SarvamAI

client = SarvamAI(
    api_subscription_key="YOUR_API_KEY_HERE",
)

client.document_translation.create(
    job_name="chapter1",
    source_language_code="en-IN",
    original_filename="chapter1.pdf",
    genre="NON_FICTION",
    auto_process=True,
    target_language_codes=[
        "hi-IN",
        "ta-IN"
    ],
    model_type="plus",
    use_native_numerals=True,
)

```

```typescript
import { SarvamAIClient } from "sarvamai";
import fs from "fs";

const client = new SarvamAIClient({
  apiSubscriptionKey: process.env.SARVAM_API_KEY,
});

const job = await client.documentTranslation.create({
  job_name: "chapter1",
  source_language_code: "en-IN",
  target_language_codes: ["hi-IN", "ta-IN"],
  original_filename: "chapter1.pdf",
});

// SDK does not upload the file — PUT bytes to the signed URL, then start.
await fetch(job.upload_url, {
  method: "PUT",
  headers: {
    "Content-Type": "application/pdf",
    "x-ms-blob-type": "BlockBlob",
  },
  body: fs.readFileSync("chapter1.pdf"),
});

await client.documentTranslation.start(job.job_id);

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.sarvam.ai/translate/document/jobs"

	payload := strings.NewReader("{\n  \"job_name\": \"chapter1\",\n  \"source_language_code\": \"en-IN\",\n  \"original_filename\": \"chapter1.pdf\",\n  \"target_language_codes\": [\n    \"hi-IN\",\n    \"ta-IN\"\n  ],\n  \"genre\": \"NON_FICTION\",\n  \"auto_process\": true,\n  \"model_type\": \"plus\",\n  \"use_native_numerals\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("api-subscription-key", "<apiSubscriptionKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.sarvam.ai/translate/document/jobs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-subscription-key"] = '<apiSubscriptionKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"job_name\": \"chapter1\",\n  \"source_language_code\": \"en-IN\",\n  \"original_filename\": \"chapter1.pdf\",\n  \"target_language_codes\": [\n    \"hi-IN\",\n    \"ta-IN\"\n  ],\n  \"genre\": \"NON_FICTION\",\n  \"auto_process\": true,\n  \"model_type\": \"plus\",\n  \"use_native_numerals\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sarvam.ai/translate/document/jobs")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"job_name\": \"chapter1\",\n  \"source_language_code\": \"en-IN\",\n  \"original_filename\": \"chapter1.pdf\",\n  \"target_language_codes\": [\n    \"hi-IN\",\n    \"ta-IN\"\n  ],\n  \"genre\": \"NON_FICTION\",\n  \"auto_process\": true,\n  \"model_type\": \"plus\",\n  \"use_native_numerals\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sarvam.ai/translate/document/jobs', [
  'body' => '{
  "job_name": "chapter1",
  "source_language_code": "en-IN",
  "original_filename": "chapter1.pdf",
  "target_language_codes": [
    "hi-IN",
    "ta-IN"
  ],
  "genre": "NON_FICTION",
  "auto_process": true,
  "model_type": "plus",
  "use_native_numerals": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/translate/document/jobs");
var request = new RestRequest(Method.POST);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"job_name\": \"chapter1\",\n  \"source_language_code\": \"en-IN\",\n  \"original_filename\": \"chapter1.pdf\",\n  \"target_language_codes\": [\n    \"hi-IN\",\n    \"ta-IN\"\n  ],\n  \"genre\": \"NON_FICTION\",\n  \"auto_process\": true,\n  \"model_type\": \"plus\",\n  \"use_native_numerals\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "api-subscription-key": "<apiSubscriptionKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "job_name": "chapter1",
  "source_language_code": "en-IN",
  "original_filename": "chapter1.pdf",
  "target_language_codes": ["hi-IN", "ta-IN"],
  "genre": "NON_FICTION",
  "auto_process": true,
  "model_type": "plus",
  "use_native_numerals": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/translate/document/jobs")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```