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

# Transliteration

POST https://api.sarvam.ai/transliterate
Content-Type: application/json

**Transliteration** converts text from one script to another while preserving the original pronunciation. For example, **'नमस्ते'** becomes **'namaste'** in English, and **'how are you'** can be written as **'हाउ आर यू'** in Devanagari. This process ensures that the sound of the original text remains intact, even when written in a different script.

Transliteration is useful when you want to represent words phonetically across different writing systems, such as converting **'मैं ऑफिस जा रहा हूँ'** to **'main office ja raha hun'** in English letters.

**Translation**, on the other hand, converts text from one language to another while preserving the meaning rather than pronunciation. For example, **'मैं ऑफिस जा रहा हूँ'** translates to **'I am going to the office'** in English, changing both the script and the language while conveying the intended message.
### Examples of **Transliteration**:
- **'Good morning'** becomes **'गुड मॉर्निंग'** in Hindi, where the pronunciation is preserved but the meaning is not translated.
- **'सुप्रभात'** becomes **'suprabhat'** in English.

Available languages:
- **`en-IN`**: English
- **`hi-IN`**: Hindi
- **`bn-IN`**: Bengali
- **`gu-IN`**: Gujarati
- **`kn-IN`**: Kannada
- **`ml-IN`**: Malayalam
- **`mr-IN`**: Marathi
- **`od-IN`**: Odia
- **`pa-IN`**: Punjabi
- **`ta-IN`**: Tamil
- **`te-IN`**: Telugu

For hands-on practice, you can explore the notebook tutorial on [Transliterate API Tutorial](https://github.com/sarvamai/sarvam-ai-cookbook/blob/main/notebooks/transliterate/Transliterate_API_Tutorial.ipynb).

Reference: https://docs.sarvam.ai/api-reference/text/transliterate-text

## Authentication

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

## Request

### Body (application/json)

- `input` (string, required) — The text you want to transliterate.
- `source_language_code` (enum, required) — The language code of the input text. This specifies the source language for transliteration. Note: The source language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
  - Allowed values: `auto`, `bn-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, `ta-IN`, `te-IN`
- `target_language_code` (enum, required) — The language code of the transliteration text. This specifies the target language for transliteration. Note:The target language should either be an Indic language or English. As we supports both Indic-to-English and English-to-Indic transliteration.
  - Allowed values: `bn-IN`, `en-IN`, `gu-IN`, `hi-IN`, `kn-IN`, `ml-IN`, `mr-IN`, `od-IN`, `pa-IN`, `ta-IN`, `te-IN`
- `numerals_format` (enum, optional) — `numerals_format` is an optional parameter with two options: - **`international`** (default): Uses regular numerals (0-9). - **`native`**: Uses language-specific native numerals. ### Example: - If `international` format is selected, we use regular numerals (0-9). For example: `मेरा phone number है: 9840950950`. - If `native` format is selected, we use language-specific native numerals, like: `मेरा phone number है: ९८४०९५०९५०`.
  - Allowed values: `international`, `native`
- `spoken_form_numerals_language` (enum, optional) — `spoken_form_numerals_language` is an optional parameter with two options and only works when spoken_form is true: - **`english`** : Numbers in the text will be spoken in English. - **`native(default)`**: Numbers in the text will be spoken in the native language. ### Examples: - **Input:** "मेरे पास ₹200 है" - If `english` format is selected: "मेरे पास टू हन्डर्ड रूपीस है" - If `native` format is selected: "मेरे पास दो सौ रुपये है"
  - Allowed values: `english`, `native`
- `spoken_form` (boolean, optional, default: false) — - Default: `False` - Converts text into a natural spoken form when `True`. - **Note:** No effect if output language is `en-IN`. ### Example: - **Input:** `मुझे कल 9:30am को appointment है` - **Output:** `मुझे कल सुबह साढ़े नौ बजे को अपॉइंटमेंट है`

## Response

### 200

Successful Response

- `request_id` (string, required, nullable)
- `transliterated_text` (string, required) — Transliterated text result in the requested target language.
- `source_language_code` (string, required) — Detected or provided source language of the input text.

## Examples

**Request**

```json
{
  "input": "namaste",
  "source_language_code": "en-IN",
  "target_language_code": "hi-IN"
}
```

**Response**

```json
{
  "request_id": "20250101_0a1b2c3d-1234-5678-9abc-def012345678",
  "transliterated_text": "नमस्ते",
  "source_language_code": "en-IN"
}
```

**SDK Code**

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

async function main() {
    const client = new SarvamAIClient({
        apiSubscriptionKey: "YOUR_API_KEY_HERE",
    });
    await client.text.transliterate({
        input: "namaste",
        source_language_code: "en-IN",
        target_language_code: "hi-IN",
    });
}
main();

```

```python text_transliterate_example
from sarvamai import SarvamAI

client = SarvamAI(
    api_subscription_key="YOUR_API_KEY_HERE",
)

client.text.transliterate(
    input="namaste",
    source_language_code="en-IN",
    target_language_code="hi-IN",
)

```

```go text_transliterate_example
package main

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

func main() {

	url := "https://api.sarvam.ai/transliterate"

	payload := strings.NewReader("{\n  \"input\": \"namaste\",\n  \"source_language_code\": \"en-IN\",\n  \"target_language_code\": \"hi-IN\"\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 text_transliterate_example
require 'uri'
require 'net/http'

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

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  \"input\": \"namaste\",\n  \"source_language_code\": \"en-IN\",\n  \"target_language_code\": \"hi-IN\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.sarvam.ai/transliterate")
  .header("api-subscription-key", "<apiSubscriptionKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"input\": \"namaste\",\n  \"source_language_code\": \"en-IN\",\n  \"target_language_code\": \"hi-IN\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.sarvam.ai/transliterate', [
  'body' => '{
  "input": "namaste",
  "source_language_code": "en-IN",
  "target_language_code": "hi-IN"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-subscription-key' => '<apiSubscriptionKey>',
  ],
]);

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

```csharp text_transliterate_example
using RestSharp;

var client = new RestClient("https://api.sarvam.ai/transliterate");
var request = new RestRequest(Method.POST);
request.AddHeader("api-subscription-key", "<apiSubscriptionKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"input\": \"namaste\",\n  \"source_language_code\": \"en-IN\",\n  \"target_language_code\": \"hi-IN\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift text_transliterate_example
import Foundation

let headers = [
  "api-subscription-key": "<apiSubscriptionKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "input": "namaste",
  "source_language_code": "en-IN",
  "target_language_code": "hi-IN"
] as [String : Any]

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

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