> This page is for API Reference.

> Sarvam Voice Agents (Samvaad) is a voice AI agent platform for Indian languages: build, test and deploy AI calling agents on your own phone numbers, from ₹3 a minute. Start here: https://docs.sarvam.ai/voice-agents/why-voice-agents.
> 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).
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Dictate a Clip

POST https://api.sarvam.ai/v2/dictate
Content-Type: multipart/form-data

Turns a recording of up to 30 seconds into text a person can paste, and returns it in the same response.

Each call returns two texts:

- `transcript`: the words that speech recognition heard, unchanged.
- `text`: the finished version, with punctuation, no fillers or false starts, numbers as digits, your names spelled your way, and your `style.rules` applied.

Add `output_rules` to also get one `output` made from the whole recording, such as a summary or a JSON record.

The finishing step never fails the call. If it fails or is too slow, `text` is the raw transcript and `degraded` tells you why.

**Other routes:** for a recording up to 1 hour, use `POST /v2/dictate/jobs`. For live audio, use the `/v2/dictate/ws` WebSocket. For recipes and how-to guides, see [Dictate best practices](/api/api-guides-tutorials/dictate/best-practices).

**Good to know**

- Send `multipart/form-data`. `style`, `vocabulary` and `context` are JSON text in a form part. `language_code`, `mode`, `output_rules` and `model` are plain text.
- Use the path exactly as written. A trailing slash, such as `/v2/dictate/`, is answered with `307` to an `http://` address, and a client that follows it sends your request and key without encryption.
- Send every option as a form part. A query parameter, such as `?language_code=hi-IN`, is ignored, and it does not return an error.
- Leave a field out to keep its default. `null`, an unknown field, a repeated field, or a `style`, `vocabulary`, `context`, `model` or `language_code` part sent as an empty string returns `400`.
- A clip with only background noise is not an error. You get `200` with an empty `text` and no finishing tokens.
- Character limits count characters, not bytes. Each form part other than `file` can be at most 1 MiB.
- Every result names its snapshot in `model`. Pass `model` to pin a dated snapshot.
- Every response has an `x-request-id` header. Send it to support if you report a problem.

Reference: https://docs.sarvam.ai/api-reference/dictate/clip

## Authentication

- `api-subscription-key` header (required) — API Key authentication via header
- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `file` (file, required) — Audio of 30 seconds or less, up to 10,000,000 bytes, not empty. Formats: WAV, MP3, AAC, AIFF, OGG, Opus, FLAC, MP4/M4A, AMR, WMA and WebM, found from the MIME type or the file content.
- `language_code` (enum, optional)
- `mode` (enum, optional)
- `style` (DictateStyle, optional)
- `vocabulary` (list of DictateVocabularyEntry, optional)
- `context` (DictateContext, optional)
- `output_rules` (string, optional)
- `model` (string, optional)

## Response

### 200

Successful Response

- `request_id` (string, required) — Dictate's ID for this call. Send it to support when you report a problem.
- `model` (string, required) — The snapshot that made this result, for example `dictate-v1-2026-11-04` or `dictate-v1-2026-11-05`.
- `transcript` (string, required) — The words that speech recognition heard. Dictate does not change this text.
- `text` (string, required) — The finished text. If `degraded` is not `null`, this is the raw transcript.
- `language_code` (string, required, nullable) — The detected language, else the language you sent, else `null`.
- `corrections` (list of DictateCorrection, required) — The vocabulary and reference changes that were applied.
- `degraded` (enum, required, nullable) — `null` when the finishing step succeeded. Otherwise the reason it did not.
  - Allowed values: `llm_timeout`, `llm_error`, `llm_guard_failed`, `llm_context_limit`, `asr_error`, `asr_timeout`
- `usage` (DictateUsage, required) — Billed: audio that was recognised and finished, silence included. Not billed: a failed call or job, a degraded clip, and the degraded sections of a job. A repeated request is billed again. With `output_rules`, the output's tokens are included in the token counts here and also shown in `output.usage`.
- `output` (DictateOutput, optional) — Present only when you sent `output_rules`.

## Errors

### 400 Bad Request Error

Invalid request. - `invalid_request_error`: a field, limit, URL, JSON or form error; an unknown or repeated field (including `style.prefix` and `style.suffix`); a `style`, `vocabulary`, `context`, `model` or `language_code` part sent as an empty string; `null`; an unknown `model`; a `sounds_like` that is listed for two vocabulary entries; or audio that cannot be read, a file over 10,000,000 bytes, or a clip over 30 s. Correct the request; do not send it again unchanged. A request whose headers are too large gets a `400` from the load balancer instead: the body is an HTML page, not JSON, so check the content type before you parse it.

- `error` (V2ErrorObject, required)

### 403 Forbidden Error

Missing or wrong API key (`invalid_api_key_error`). The gateway answers before Dictate does, with the same error shape.

- `error` (V2ErrorObject, required)

### 405 Method Not Allowed Error

Wrong HTTP method for this path (`invalid_request_error`). This path takes `POST`.

- `error` (V2ErrorObject, required)

### 408 Request Timeout Error

The upload stopped for 30 s, or took longer than 120 s (`invalid_request_error`). Retry on a faster connection, or use a job with `audio_url`. Through the gateway, a stalled upload can get no answer, and the connection can stay open.

- `any`

### 413 Content Too Large Error

The request body is over 12,097,152 bytes (`invalid_request_error`, from the gateway). Keep a clip under 10 MB, or use `POST /v2/dictate/jobs` with `audio_url`.

- `any`

### 429 Too Many Requests Error

Your key is over its rate limit (`rate_limit_exceeded_error`). The gateway answers before Dictate does, with the usual error shape. Retry after the number of seconds in the `Retry-After` header. Job reads count toward the limit.

- `error` (V2ErrorObject, required)

### 500 Internal Server Error

Unexpected problem (`internal_server_error`). Retry once, and report it with the `x-request-id` header if it repeats.

- `any`

### 502 Bad Gateway Error

Speech recognition sent an unusable answer (`asr_invalid_result`). Retry once.

- `any`

### 503 Service Unavailable Error

Has the header `Retry-After: 1`. - `service_overloaded`: Dictate is at a capacity limit, or could not measure the clip at that moment. Retry after `Retry-After`, with backoff. - `model_overloaded`: speech recognition is overloaded or not available. Retry with backoff. - `service_unavailable`: the route is not available. Do not retry.

- `any`

## Types

### DictateCorrection

A change that Dictate made from your vocabulary or reference. It is listed when the finished text has the term's exact spelling where a word matched it, including a change of capital letters and a term with an apostrophe suffix ("Zentrix's"). It does not list changes that the model makes alone (including those from `context.text`), punctuation, capital letters in words that are not your terms, a term inside an email address or a URL (except at the start of the address, followed by a hyphen or apostrophe), or a term with a suffix joined without an apostrophe.

- `heard` (string, required) — What speech recognition wrote.
- `wrote` (string, required) — What the finished text has.
- `source` (enum, required) — Whether the term came from `vocabulary` or from `context.reference`.
  - Allowed values: `vocabulary`, `reference`

### DictateUsage

Billed: audio that was recognised and finished, silence included. Not billed: a failed call or job, a degraded clip, and the degraded sections of a job. A repeated request is billed again. With `output_rules`, the output's tokens are included in the token counts here and also shown in `output.usage`.

- `audio_duration_s` (double, required) — Audio length in seconds, to 3 decimals. For a clip or a job, the whole file, including silence. A degraded clip still shows the clip length, but is not billed.
- `words` (integer, required) — Words in the raw transcript.
- `llm_input_tokens` (integer, required, nullable) — Tokens sent to the finishing model. `null` if the model did not report them.
- `llm_output_tokens` (integer, required, nullable) — Tokens from the finishing model. `null` if the model did not report them.

### DictateOutput

The output made from the whole recording with `output_rules`.

- `text` (string, required, nullable) — The output as written. JSON comes back as a string: parse it yourself. In a JSON output, a string value that is only the word "null" (any case, spaces around it) comes back as JSON `null`; nothing else in the output is changed. `null` when the call gave no usable text (see `degraded`).
- `degraded` (enum, required, nullable) — `null` for a complete output. Otherwise the reason it is not complete.
  - Allowed values: `llm_timeout`, `llm_error`, `llm_context_limit`, `llm_length`, `asr_incomplete`
- `usage` (DictateOutputUsage, required)

### V2ErrorObject

- `message` (string, optional)
- `code` (string, optional) — Machine-readable code, e.g. `invalid_request_error`, `not_found_error`.
- `request_id` (string, optional)
- `param` (string, optional, nullable) — Present when a field was named.
- `spend_limits` (map from string to any, optional, nullable) — Present only on a 429 from an exhausted seat budget.

### DictateOutputUsage

- `llm_input_tokens` (integer, required, nullable) — Tokens sent to the model for this output.
- `llm_output_tokens` (integer, required, nullable) — Tokens the model wrote for this output.

## Examples

### Hindi voice note, with a name and a bullet rule

**Request**

```json
{
  "file": "<file: <file1>>",
  "language_code": "hi-IN",
  "mode": "codemix",
  "style": {
    "preset": "clean",
    "rules": "Write each task as a bullet."
  },
  "vocabulary": [
    {
      "word": "Zentrix",
      "sounds_like": [
        "Centrix"
      ],
      "description": "Our billing product"
    }
  ]
}
```

**Response**

```json
{
  "request_id": "20261107_3e2d9211-cc30-4e00-a570-2440fa18c00f",
  "model": "dictate-v1-2026-11-04",
  "transcript": "कल तक Centrix का invoice भेजना है और client को call करना है।",
  "text": "- कल तक Zentrix का invoice भेजना है।\n- और client को call करना है।",
  "language_code": "hi-IN",
  "corrections": [
    {
      "heard": "Centrix",
      "wrote": "Zentrix",
      "source": "vocabulary"
    }
  ],
  "degraded": null,
  "usage": {
    "audio_duration_s": 4.306,
    "words": 13,
    "llm_input_tokens": 5988,
    "llm_output_tokens": 20
  }
}
```

**SDK Code**

```python Hindi voice note, with a name and a bullet rule
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

with open("note.wav", "rb") as f:
    response = client.dictate.transcribe(
        file=f,
        language_code="hi-IN",
        mode="codemix",
        style={"preset": "clean", "rules": "Write each task as a bullet."},
        vocabulary=[{"word": "Zentrix", "sounds_like": ["Centrix"], "description": "Our billing product"}],
    )

print(response.text)        # the finished text
print(response.transcript)  # what speech recognition heard
print(response.degraded)    # None when the text was finished

```

```typescript Hindi voice note, with a name and a bullet rule
import fs from "fs";
import { SarvamAIClient } from "sarvamai";

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

const response = await client.dictate.transcribe({
  file: fs.createReadStream("note.wav"),
  language_code: "hi-IN",
  mode: "codemix",
  style: { preset: "clean", rules: "Write each task as a bullet." },
  vocabulary: [{ word: "Zentrix", sounds_like: ["Centrix"], description: "Our billing product" }],
});

console.log(response.text); // the finished text
console.log(response.transcript); // what speech recognition heard
console.log(response.degraded); // null when the text was finished

```

```go Hindi voice note, with a name and a bullet rule
package main

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

func main() {

	url := "https://api.sarvam.ai/v2/dictate"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nhi-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncodemix\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n{\n  \"preset\": \"clean\",\n  \"rules\": \"Write each task as a bullet.\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n[\n  {\n    \"word\": \"Zentrix\",\n    \"sounds_like\": [\n      \"Centrix\"\n    ],\n    \"description\": \"Our billing product\"\n  }\n]\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("api-subscription-key", "<apiSubscriptionKey>")
	req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")

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

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

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

}
```

```ruby Hindi voice note, with a name and a bullet rule
require 'uri'
require 'net/http'

url = URI("https://api.sarvam.ai/v2/dictate")

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"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nhi-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncodemix\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n{\n  \"preset\": \"clean\",\n  \"rules\": \"Write each task as a bullet.\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n[\n  {\n    \"word\": \"Zentrix\",\n    \"sounds_like\": [\n      \"Centrix\"\n    ],\n    \"description\": \"Our billing product\"\n  }\n]\r\n-----011000010111000001101001--\r\n"

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

```java Hindi voice note, with a name and a bullet rule
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sarvam.ai/v2/dictate")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nhi-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncodemix\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n{\n  \"preset\": \"clean\",\n  \"rules\": \"Write each task as a bullet.\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n[\n  {\n    \"word\": \"Zentrix\",\n    \"sounds_like\": [\n      \"Centrix\"\n    ],\n    \"description\": \"Our billing product\"\n  }\n]\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php Hindi voice note, with a name and a bullet rule
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sarvam.ai/v2/dictate', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => '<file1>',
        'contents' => null
    ],
    [
        'name' => 'language_code',
        'contents' => 'hi-IN'
    ],
    [
        'name' => 'mode',
        'contents' => 'codemix'
    ],
    [
        'name' => 'style',
        'contents' => '{
  "preset": "clean",
  "rules": "Write each task as a bullet."
}'
    ],
    [
        'name' => 'vocabulary',
        'contents' => '[
  {
    "word": "Zentrix",
    "sounds_like": [
      "Centrix"
    ],
    "description": "Our billing product"
  }
]'
    ]
  ]
  'headers' => [
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

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

```csharp Hindi voice note, with a name and a bullet rule
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/v2/dictate");
var request = new RestRequest(Method.POST);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nhi-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\ncodemix\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n{\n  \"preset\": \"clean\",\n  \"rules\": \"Write each task as a bullet.\"\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n[\n  {\n    \"word\": \"Zentrix\",\n    \"sounds_like\": [\n      \"Centrix\"\n    ],\n    \"description\": \"Our billing product\"\n  }\n]\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Hindi voice note, with a name and a bullet rule
import Foundation

let headers = [
  "api-subscription-key": "<apiSubscriptionKey>",
  "Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
  [
    "name": "context",
    "value": 
  ],
  [
    "name": "file",
    "fileName": "<file1>"
  ],
  [
    "name": "language_code",
    "value": "hi-IN"
  ],
  [
    "name": "mode",
    "value": "codemix"
  ],
  [
    "name": "model",
    "value": 
  ],
  [
    "name": "output_rules",
    "value": 
  ],
  [
    "name": "style",
    "value": "{
  \"preset\": \"clean\",
  \"rules\": \"Write each task as a bullet.\"
}"
  ],
  [
    "name": "vocabulary",
    "value": "[
  {
    \"word\": \"Zentrix\",
    \"sounds_like\": [
      \"Centrix\"
    ],
    \"description\": \"Our billing product\"
  }
]"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/v2/dictate")! 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()
```

### English clip, with a JSON output made from the whole recording

**Request**

```json
{
  "file": "<file: <file1>>",
  "language_code": "en-IN",
  "output_rules": "Return JSON: {\"medicine\": string | null (the medicine the doctor prescribes), \"follow_up_days\": integer | null (days until the next visit)}. Write null when it was not said."
}
```

**Response**

```json
{
  "request_id": "20261107_e6aee51c-696b-4d75-943c-04f6ccc71dfe",
  "model": "dictate-v1-2026-11-04",
  "transcript": "Take amoxicillin 500 twice a day, um, and come back after 7 days.",
  "text": "Take amoxicillin 500 twice a day and come back after 7 days.",
  "language_code": "en-IN",
  "corrections": [],
  "degraded": null,
  "usage": {
    "audio_duration_s": 5.224,
    "words": 13,
    "llm_input_tokens": 5717,
    "llm_output_tokens": 43
  },
  "output": {
    "text": "{\"medicine\": \"amoxicillin 500\", \"follow_up_days\": 7}",
    "degraded": null,
    "usage": {
      "llm_input_tokens": 348,
      "llm_output_tokens": 23
    }
  }
}
```

**SDK Code**

```python English clip, with a JSON output made from the whole recording
from sarvamai import SarvamAI

client = SarvamAI(api_subscription_key="YOUR_SARVAM_API_KEY")

import json

with open("visit.wav", "rb") as f:
    response = client.dictate.transcribe(
        file=f,
        language_code="en-IN",
        output_rules=(
            'Return JSON: {"medicine": string | null (the medicine the doctor prescribes), '
            '"follow_up_days": integer | null (days until the next visit)}. '
            "Write null when it was not said."
        ),
    )

print(response.text)
if response.output and response.output.text:
    record = json.loads(response.output.text)  # output.text is a string: parse it
    print(record["medicine"], record["follow_up_days"])

```

```typescript English clip, with a JSON output made from the whole recording
import fs from "fs";
import { SarvamAIClient } from "sarvamai";

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

const response = await client.dictate.transcribe({
  file: fs.createReadStream("visit.wav"),
  language_code: "en-IN",
  output_rules:
    'Return JSON: {"medicine": string | null (the medicine the doctor prescribes), ' +
    '"follow_up_days": integer | null (days until the next visit)}. Write null when it was not said.',
});

console.log(response.text);
if (response.output?.text) {
  const record = JSON.parse(response.output.text); // output.text is a string: parse it
  console.log(record.medicine, record.follow_up_days);
}

```

```go English clip, with a JSON output made from the whole recording
package main

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

func main() {

	url := "https://api.sarvam.ai/v2/dictate"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nen-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\nReturn JSON: {\"medicine\": string | null (the medicine the doctor prescribes), \"follow_up_days\": integer | null (days until the next visit)}. Write null when it was not said.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("api-subscription-key", "<apiSubscriptionKey>")
	req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")

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

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

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

}
```

```ruby English clip, with a JSON output made from the whole recording
require 'uri'
require 'net/http'

url = URI("https://api.sarvam.ai/v2/dictate")

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"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nen-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\nReturn JSON: {\"medicine\": string | null (the medicine the doctor prescribes), \"follow_up_days\": integer | null (days until the next visit)}. Write null when it was not said.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"

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

```java English clip, with a JSON output made from the whole recording
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.sarvam.ai/v2/dictate")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nen-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\nReturn JSON: {\"medicine\": string | null (the medicine the doctor prescribes), \"follow_up_days\": integer | null (days until the next visit)}. Write null when it was not said.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php English clip, with a JSON output made from the whole recording
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sarvam.ai/v2/dictate', [
  'multipart' => [
    [
        'name' => 'file',
        'filename' => '<file1>',
        'contents' => null
    ],
    [
        'name' => 'language_code',
        'contents' => 'en-IN'
    ],
    [
        'name' => 'output_rules',
        'contents' => 'Return JSON: {"medicine": string | null (the medicine the doctor prescribes), "follow_up_days": integer | null (days until the next visit)}. Write null when it was not said.'
    ]
  ]
  'headers' => [
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

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

```csharp English clip, with a JSON output made from the whole recording
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/v2/dictate");
var request = new RestRequest(Method.POST);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"context\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"<file1>\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language_code\"\r\n\r\nen-IN\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"output_rules\"\r\n\r\nReturn JSON: {\"medicine\": string | null (the medicine the doctor prescribes), \"follow_up_days\": integer | null (days until the next visit)}. Write null when it was not said.\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"style\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"vocabulary\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift English clip, with a JSON output made from the whole recording
import Foundation

let headers = [
  "api-subscription-key": "<apiSubscriptionKey>",
  "Content-Type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
  [
    "name": "context",
    "value": 
  ],
  [
    "name": "file",
    "fileName": "<file1>"
  ],
  [
    "name": "language_code",
    "value": "en-IN"
  ],
  [
    "name": "mode",
    "value": 
  ],
  [
    "name": "model",
    "value": 
  ],
  [
    "name": "output_rules",
    "value": "Return JSON: {\"medicine\": string | null (the medicine the doctor prescribes), \"follow_up_days\": integer | null (days until the next visit)}. Write null when it was not said."
  ],
  [
    "name": "style",
    "value": 
  ],
  [
    "name": "vocabulary",
    "value": 
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.sarvam.ai/v2/dictate")! 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()
```