> 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.

# Get Download URL

GET https://api.sarvam.ai/doc-ai/v1/job/{job_id}/download-url

Creates a download URL for a completed job's output. Download the output using the returned `method`, `url` and `headers` before `expires_at`.

Requesting a download URL before the job reaches a terminal status returns `409`.

Reference: https://docs.sarvam.ai/api-reference/doc-ai/job/download-url

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: sarvam
  version: 1.0.0
paths:
  /doc-ai/v1/job/{job_id}/download-url:
    get:
      operationId: get_download_url
      summary: Get Document AI Download URL
      description: >-
        Creates a download URL for a completed job's output. Download the output
        using the returned `method`, `url` and `headers` before `expires_at`.


        Requesting a download URL before the job reaches a terminal status
        returns `409`.
      tags:
        - docAi
      parameters:
        - name: job_id
          in: path
          description: The unique identifier of the job
          required: true
          schema:
            type: string
        - name: api-subscription-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocAIDownloadURLResponse'
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocAIErrorModel'
        '409':
          description: Download requested before the job reached a terminal status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocAIErrorModel'
servers:
  - url: https://api.sarvam.ai
    description: Production
components:
  schemas:
    DocAIDownloadURLResponse:
      type: object
      properties:
        method:
          type: string
          description: HTTP method to use for the download (e.g. `GET`).
        url:
          type: string
          description: Presigned URL to download the job output from.
        headers:
          type: object
          additionalProperties:
            type: string
          description: Headers that must be sent with the download request.
        expires_at:
          type: string
          description: Timestamp after which the download URL is no longer valid.
      required:
        - method
        - url
        - expires_at
      title: DocAIDownloadURLResponse
    DocAIErrorDetail:
      type: object
      properties:
        location:
          type: string
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'.
        message:
          type: string
          description: Error message text.
        value:
          description: The value at the given location.
      title: DocAIErrorDetail
    DocAIErrorModel:
      type: object
      properties:
        type:
          type: string
          format: uri
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
        title:
          type: string
          description: A short, human-readable summary of the problem type.
        status:
          type: integer
          description: HTTP status code.
        detail:
          type: string
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
        instance:
          type: string
          format: uri
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
        errors:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/DocAIErrorDetail'
          description: Optional list of individual error details.
      title: DocAIErrorModel
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-subscription-key

```

## Examples



**Response**

```json
{
  "method": "string",
  "url": "string",
  "expires_at": "string",
  "headers": {}
}
```

**SDK Code**

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

async function main() {
    const client = new SarvamAIClient({
        apiSubscriptionKey: "YOUR_API_KEY_HERE",
    });
    await client.docAi.getDownloadUrl("job_id");
}
main();

```

```python
from sarvamai import SarvamAI

client = SarvamAI(
    api_subscription_key="YOUR_API_KEY_HERE",
)

client.doc_ai.get_download_url(
    job_id="job_id",
)

```

```go
package main

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

func main() {

	url := "https://api.sarvam.ai/doc-ai/v1/job/job_id/download-url"

	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
require 'uri'
require 'net/http'

url = URI("https://api.sarvam.ai/doc-ai/v1/job/job_id/download-url")

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
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.sarvam.ai/doc-ai/v1/job/job_id/download-url")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.sarvam.ai/doc-ai/v1/job/job_id/download-url', [
  'headers' => [
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/doc-ai/v1/job/job_id/download-url");
var request = new RestRequest(Method.GET);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/doc-ai/v1/job/job_id/download-url")! 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()
```