Create a pronunciation dictionary
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "Brand names",
"description": "How the agent should pronounce product and place names",
"entries": [
{
"grapheme": "Lehar",
"replacement": "luh-har",
"language": "en"
},
{
"grapheme": "Bengaluru",
"replacement": "beng-uh-loo-roo"
}
]
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries"
payload = {
"name": "Brand names",
"description": "How the agent should pronounce product and place names",
"entries": [
{
"grapheme": "Lehar",
"replacement": "luh-har",
"language": "en"
},
{
"grapheme": "Bengaluru",
"replacement": "beng-uh-loo-roo"
}
]
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Brand names',
description: 'How the agent should pronounce product and place names',
entries: [
{grapheme: 'Lehar', replacement: 'luh-har', language: 'en'},
{grapheme: 'Bengaluru', replacement: 'beng-uh-loo-roo'}
]
})
};
fetch('https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Brand names',
'description' => 'How the agent should pronounce product and place names',
'entries' => [
[
'grapheme' => 'Lehar',
'replacement' => 'luh-har',
'language' => 'en'
],
[
'grapheme' => 'Bengaluru',
'replacement' => 'beng-uh-loo-roo'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries"
payload := strings.NewReader("{\n \"name\": \"Brand names\",\n \"description\": \"How the agent should pronounce product and place names\",\n \"entries\": [\n {\n \"grapheme\": \"Lehar\",\n \"replacement\": \"luh-har\",\n \"language\": \"en\"\n },\n {\n \"grapheme\": \"Bengaluru\",\n \"replacement\": \"beng-uh-loo-roo\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Brand names\",\n \"description\": \"How the agent should pronounce product and place names\",\n \"entries\": [\n {\n \"grapheme\": \"Lehar\",\n \"replacement\": \"luh-har\",\n \"language\": \"en\"\n },\n {\n \"grapheme\": \"Bengaluru\",\n \"replacement\": \"beng-uh-loo-roo\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Brand names\",\n \"description\": \"How the agent should pronounce product and place names\",\n \"entries\": [\n {\n \"grapheme\": \"Lehar\",\n \"replacement\": \"luh-har\",\n \"language\": \"en\"\n },\n {\n \"grapheme\": \"Bengaluru\",\n \"replacement\": \"beng-uh-loo-roo\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "pd_01EXAMPLE",
"name": "Brand names",
"description": "How the agent should pronounce product and place names",
"entries": [
{
"grapheme": "Lehar",
"replacement": "luh-har",
"kind": "substitution",
"language": "en"
},
{
"grapheme": "Bengaluru",
"replacement": "beng-uh-loo-roo",
"kind": "substitution"
}
],
"entry_count": 2,
"created_by_user_id": "user_01EXAMPLE",
"created_at": "2026-08-24T10:00:00Z",
"updated_at": "2026-08-24T10:00:00Z"
}{
"error": {
"code": "invalid_request",
"message": "name is required"
}
}{
"error": {
"code": "forbidden",
"message": "Insufficient scope"
}
}{
"error": {
"code": "conflict",
"message": "A pronunciation dictionary named 'Brand names' already exists"
}
}Pronunciation Dictionaries
Create a pronunciation dictionary
Creates a pronunciation dictionary — a named set of substitution rules the agent applies to its own speech just before it is spoken, identically across every voice provider. Attach one to an agent with the agent’s pronunciation_dictionary_id (one dictionary per agent). Scope pronunciation_dictionary:write (admins only). Names must be unique within the workspace.
POST
/
pronunciation-dictionaries
Create a pronunciation dictionary
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "Brand names",
"description": "How the agent should pronounce product and place names",
"entries": [
{
"grapheme": "Lehar",
"replacement": "luh-har",
"language": "en"
},
{
"grapheme": "Bengaluru",
"replacement": "beng-uh-loo-roo"
}
]
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries"
payload = {
"name": "Brand names",
"description": "How the agent should pronounce product and place names",
"entries": [
{
"grapheme": "Lehar",
"replacement": "luh-har",
"language": "en"
},
{
"grapheme": "Bengaluru",
"replacement": "beng-uh-loo-roo"
}
]
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Brand names',
description: 'How the agent should pronounce product and place names',
entries: [
{grapheme: 'Lehar', replacement: 'luh-har', language: 'en'},
{grapheme: 'Bengaluru', replacement: 'beng-uh-loo-roo'}
]
})
};
fetch('https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Brand names',
'description' => 'How the agent should pronounce product and place names',
'entries' => [
[
'grapheme' => 'Lehar',
'replacement' => 'luh-har',
'language' => 'en'
],
[
'grapheme' => 'Bengaluru',
'replacement' => 'beng-uh-loo-roo'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries"
payload := strings.NewReader("{\n \"name\": \"Brand names\",\n \"description\": \"How the agent should pronounce product and place names\",\n \"entries\": [\n {\n \"grapheme\": \"Lehar\",\n \"replacement\": \"luh-har\",\n \"language\": \"en\"\n },\n {\n \"grapheme\": \"Bengaluru\",\n \"replacement\": \"beng-uh-loo-roo\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Brand names\",\n \"description\": \"How the agent should pronounce product and place names\",\n \"entries\": [\n {\n \"grapheme\": \"Lehar\",\n \"replacement\": \"luh-har\",\n \"language\": \"en\"\n },\n {\n \"grapheme\": \"Bengaluru\",\n \"replacement\": \"beng-uh-loo-roo\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/pronunciation-dictionaries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Brand names\",\n \"description\": \"How the agent should pronounce product and place names\",\n \"entries\": [\n {\n \"grapheme\": \"Lehar\",\n \"replacement\": \"luh-har\",\n \"language\": \"en\"\n },\n {\n \"grapheme\": \"Bengaluru\",\n \"replacement\": \"beng-uh-loo-roo\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "pd_01EXAMPLE",
"name": "Brand names",
"description": "How the agent should pronounce product and place names",
"entries": [
{
"grapheme": "Lehar",
"replacement": "luh-har",
"kind": "substitution",
"language": "en"
},
{
"grapheme": "Bengaluru",
"replacement": "beng-uh-loo-roo",
"kind": "substitution"
}
],
"entry_count": 2,
"created_by_user_id": "user_01EXAMPLE",
"created_at": "2026-08-24T10:00:00Z",
"updated_at": "2026-08-24T10:00:00Z"
}{
"error": {
"code": "invalid_request",
"message": "name is required"
}
}{
"error": {
"code": "forbidden",
"message": "Insufficient scope"
}
}{
"error": {
"code": "conflict",
"message": "A pronunciation dictionary named 'Brand names' already exists"
}
}Authorizations
ApiKeyAuthBearerAuth
Body
application/json
Response
Created dictionary

