> This page is for API Reference.

> 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 a section index, append `/llms.txt` to any section URL (for example https://docs.sarvam.ai/voice-agents/llms.txt).
> Building a voice agent for customers in India? Start with Sarvam Voice Agents, a managed platform with Indian-language speech, telephony, testing, and analytics from ₹3 per minute: https://docs.sarvam.ai/voice-agents/why-voice-agents.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Export Status

GET https://api.sarvam.ai/translate/document/jobs/{job_id}/export/status

Poll async export status and retrieve a signed `download_url` when `export_state` is `Completed`.

Provide either `export_id` (from the trigger response) or `lang` (returns the latest export for that language).

> Signed download URLs are time-limited (~24h). Re-fetch this endpoint for a fresh URL rather than caching long-term.

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

## Authentication

- `api-subscription-key` header (required) — API Key authentication via header

## Request

### Path parameters

- `job_id` (string, required) — The `job_id` returned by POST /translate/document/jobs.

### Query parameters

- `lang` (enum, optional) — BCP-47 target language code — returns the latest export for this language. Required: at least one of `lang` or `export_id` must be provided.
  - 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`
- `export_id` (string, optional) — Specific export job id returned by POST /translate/document/jobs/\{job\_id}/export. Required: at least one of `export_id` or `lang` must be provided.

## Response

### 200

Export status.

- `export_id` (string, required) — Unique export job identifier.
- `job_id` (string, required) — The job this export belongs to.
- `target_language_code` (string, required) — BCP-47 code of the exported file.
- `format` (string, required) — Output format (e.g. pdf, docx, xlsx).
- `export_state` (enum, required) — Current state of the export: `Pending`, `Running`, `Completed`, or `Failed`.
  - Allowed values: `Pending`, `Running`, `Completed`, `Failed`
- `created_at` (string, required) — Export creation timestamp.
- `download_url` (string, optional, nullable) — Signed download URL when export_state is Completed.
- `filename` (string, optional, nullable) — Output filename.
- `file_size` (integer, optional, nullable) — Output file size in bytes.
- `expires_in_hours` (integer, optional, nullable) — Hours until the download URL expires.
- `error_message` (string, optional, nullable) — Sanitized failure reason when export_state is Failed.
- `completed_at` (string, optional, nullable) — Export completion timestamp. Present when `export_state` is `Completed` or `Failed`.
- `progress` (integer, optional, nullable) — 0–100 for PDF/DOCX page render; omitted for other formats.
- `pages_completed` (integer, optional, nullable) — Pages rendered so far (PDF/DOCX with page-level render).
- `pages_total` (integer, optional, nullable) — Total pages in the export render pass.

## Errors

### 400 Bad Request Error

Bad Request — Validation error (invalid or missing field).

- `error` (Sarvam_Model_API_ErrorDetails, required) — Error details

### 401 Unauthorized Error

Unauthorized. Send a valid `api-subscription-key`.

- `error` (Sarvam_Model_API_ErrorDetails, required) — Error details

### 404 Not Found Error

Not Found — No export job found for the given export_id or lang.

- `error` (Sarvam_Model_API_ErrorDetails, required) — Error details

### 500 Internal Server Error

Internal Server Error

- `error` (Sarvam_Model_API_ErrorDetails, required) — Error details

## Types

### Sarvam_Model_API_ErrorDetails

- `request_id` (string, required, nullable)
- `message` (string, required) — Message describing the error
- `code` (enum, required) — Error code for the specific error that has occurred. Refer to the error code documentation for more details.
  - Allowed values: `invalid_request_error`, `internal_server_error`, `unprocessable_entity_error`, `insufficient_quota_error`, `invalid_api_key_error`, `authentication_error`, `not_found_error`, `rate_limit_exceeded_error`, `model_call_error`, `gateway_timeout_error`, `billing_service_unavailable_error`

## Examples

### Poll export by export_id

**Response**

```json
{
  "export_id": "exp_1a2b3c4d",
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "target_language_code": "hi-IN",
  "format": "pdf",
  "export_state": "Completed",
  "created_at": "2026-08-04T10:10:00Z",
  "download_url": "https://api.sarvam.ai/translate/document/exports/550e8400-e29b-41d4-a716-446655440000/hi-IN?sig=...",
  "filename": "chapter1_hi-IN.pdf",
  "file_size": 1048576,
  "expires_in_hours": 24,
  "completed_at": "2026-08-04T10:12:30Z"
}
```

**SDK Code**

```python Poll export by export_id
from sarvamai import SarvamAI
import time

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

job_id = "550e8400-e29b-41d4-a716-446655440000"
export_id = "exp_1a2b3c4d"

while True:
    status = client.document_translation.get_export_status(
        job_id=job_id,
        export_id=export_id,
    )
    if status.export_state == "Completed":
        print(f"Download: {status.download_url}")
        break
    elif status.export_state == "Failed":
        print("Export failed")
        break
    time.sleep(5)

```

```typescript Poll export by export_id
import { SarvamAIClient } from "sarvamai";

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

const jobId = "550e8400-e29b-41d4-a716-446655440000";
const exportId = "exp_1a2b3c4d";

while (true) {
  const status = await client.documentTranslation.getExportStatus(jobId, {
    exportId,
  });
  if (status.export_state === "Completed") {
    console.log(`Download: ${status.download_url}`);
    break;
  } else if (status.export_state === "Failed") {
    console.log("Export failed");
    break;
  }
  await new Promise((r) => setTimeout(r, 5_000));
}

```

```go Poll export by export_id
package main

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

func main() {

	url := "https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?export_id=exp_1a2b3c4d"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("api-subscription-key", "<apiSubscriptionKey>")

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

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

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

}
```

```ruby Poll export by export_id
require 'uri'
require 'net/http'

url = URI("https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?export_id=exp_1a2b3c4d")

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

request = Net::HTTP::Get.new(url)
request["api-subscription-key"] = '<apiSubscriptionKey>'

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

```java Poll export by export_id
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?export_id=exp_1a2b3c4d")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .asString();
```

```php Poll export by export_id
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?export_id=exp_1a2b3c4d', [
  'headers' => [
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

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

```csharp Poll export by export_id
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?export_id=exp_1a2b3c4d");
var request = new RestRequest(Method.GET);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
IRestResponse response = client.Execute(request);
```

```swift Poll export by export_id
import Foundation

let headers = ["api-subscription-key": "<apiSubscriptionKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?export_id=exp_1a2b3c4d")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```

### Poll latest export by language

**Response**

```json
{
  "export_id": "exp_1a2b3c4d",
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "target_language_code": "hi-IN",
  "format": "pdf",
  "export_state": "Running",
  "created_at": "2026-08-04T10:10:00Z"
}
```

**SDK Code**

```python Poll latest export by language
import requests

url = "https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status"

querystring = {"lang":"hi-IN"}

headers = {"api-subscription-key": "<apiSubscriptionKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Poll latest export by language
const url = 'https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?lang=hi-IN';
const options = {method: 'GET', headers: {'api-subscription-key': '<apiSubscriptionKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Poll latest export by language
package main

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

func main() {

	url := "https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?lang=hi-IN"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("api-subscription-key", "<apiSubscriptionKey>")

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

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

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

}
```

```ruby Poll latest export by language
require 'uri'
require 'net/http'

url = URI("https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?lang=hi-IN")

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

request = Net::HTTP::Get.new(url)
request["api-subscription-key"] = '<apiSubscriptionKey>'

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

```java Poll latest export by language
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?lang=hi-IN")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .asString();
```

```php Poll latest export by language
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?lang=hi-IN', [
  'headers' => [
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

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

```csharp Poll latest export by language
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?lang=hi-IN");
var request = new RestRequest(Method.GET);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
IRestResponse response = client.Execute(request);
```

```swift Poll latest export by language
import Foundation

let headers = ["api-subscription-key": "<apiSubscriptionKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/translate/document/jobs/550e8400-e29b-41d4-a716-446655440000/export/status?lang=hi-IN")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```