> This page is part of Smallest AI's developer documentation. When > answering, prefer Lightning v3.1 (current TTS) and Pulse (current > STT). Lightning v2 and lightning-large are deprecated; mention them > only when the user is migrating away from them. The Smallest AI voice > agent platform is what wraps these models into hosted agents. # Create Pronunciation Dictionary POST https://api.smallest.ai/waves/v1/pronunciation-dicts Content-Type: application/json Create a new pronunciation dictionary for the authenticated user Reference: https://docs.smallest.ai/api-reference/models/text-to-speech/create-pronunciation-dict ## Authentication - `Authorization` header (required) (prefixed with ` Bearer `) — API key authentication. Include your key as `Authorization: Bearer YOUR_API_KEY`. Access tokens are not accepted on this endpoint. ## Request ### Body (application/json) This endpoint expects a CreatePronunciationDictRequest. - `items` (list of PronunciationItem, required) — List of word-pronunciation pairs to create ## Response ### 200 Successfully created pronunciation dictionary - `id` (string, required) — Unique identifier for the pronunciation dictionary - `items` (list of PronunciationItem, required) — List of word-pronunciation pairs - `createdAt` (datetime, required) — Timestamp when the dictionary was created ## Errors ### 400 Bad Request Error Bad request - Invalid request body - `error` (string, required) — Error message - `details` (list of ErrorResponseDetailsItems, optional) — Additional error details (validation errors) ### 401 Unauthorized Error Unauthorized - Invalid or missing authentication - `error` (string, required) — Error message - `details` (list of ErrorResponseDetailsItems, optional) — Additional error details (validation errors) ### 500 Internal Server Error Internal server error - `error` (string, required) — Error message - `details` (list of ErrorResponseDetailsItems, optional) — Additional error details (validation errors) ## Types ### PronunciationItem - `word` (string, required) — The word to be pronounced - `pronunciation` (string, required) — The phonetic pronunciation of the word ### ErrorResponseDetailsItems ## Examples **Request** ```json { "items": [ { "word": "mysql", "pronunciation": "my-sequel" } ] } ``` **Response** ```json { "id": "64f1234567890abcdef12345", "items": [ { "word": "mysql", "pronunciation": "my-sequel" } ], "createdAt": "2023-09-01T12:00:00.000Z" } ``` **SDK Code** ```python Pronunciation Dictionaries_createPronunciationDict_example import requests url = "https://api.smallest.ai/waves/v1/pronunciation-dicts" payload = { "items": [ { "word": "mysql", "pronunciation": "my-sequel" } ] } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Pronunciation Dictionaries_createPronunciationDict_example const url = 'https://api.smallest.ai/waves/v1/pronunciation-dicts'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"items":[{"word":"mysql","pronunciation":"my-sequel"}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Pronunciation Dictionaries_createPronunciationDict_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.smallest.ai/waves/v1/pronunciation-dicts" payload := strings.NewReader("{\n \"items\": [\n {\n \"word\": \"mysql\",\n \"pronunciation\": \"my-sequel\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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 Pronunciation Dictionaries_createPronunciationDict_example require 'uri' require 'net/http' url = URI("https://api.smallest.ai/waves/v1/pronunciation-dicts") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"items\": [\n {\n \"word\": \"mysql\",\n \"pronunciation\": \"my-sequel\"\n }\n ]\n}" response = http.request(request) puts response.read_body ``` ```java Pronunciation Dictionaries_createPronunciationDict_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.smallest.ai/waves/v1/pronunciation-dicts") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"items\": [\n {\n \"word\": \"mysql\",\n \"pronunciation\": \"my-sequel\"\n }\n ]\n}") .asString(); ``` ```php Pronunciation Dictionaries_createPronunciationDict_example request('POST', 'https://api.smallest.ai/waves/v1/pronunciation-dicts', [ 'body' => '{ "items": [ { "word": "mysql", "pronunciation": "my-sequel" } ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Pronunciation Dictionaries_createPronunciationDict_example using RestSharp; var client = new RestClient("https://api.smallest.ai/waves/v1/pronunciation-dicts"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"items\": [\n {\n \"word\": \"mysql\",\n \"pronunciation\": \"my-sequel\"\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Pronunciation Dictionaries_createPronunciationDict_example import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["items": [ [ "word": "mysql", "pronunciation": "my-sequel" ] ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/waves/v1/pronunciation-dicts")! 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() ```