### Get SIP Messages HTTP Client Examples Source: https://elevenlabs.io/docs/api-reference/conversations/get-sip-messages Implementation examples using various programming languages and HTTP clients. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/conversations/conversation_id/sip-messages" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/convai/conversations/conversation_id/sip-messages") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/convai/conversations/conversation_id/sip-messages") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('GET', 'https://api.elevenlabs.io/v1/convai/conversations/conversation_id/sip-messages', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/conversations/conversation_id/sip-messages"); var request = new RestRequest(Method.GET); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/conversations/conversation_id/sip-messages")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ``` -------------------------------- ### Get Agent Topics HTTP Client Examples Source: https://elevenlabs.io/docs/api-reference/conversations/topics/get Examples for retrieving agent topics using standard HTTP libraries in various programming languages. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/agents/agent_id/topics" req, _ := http.NewRequest("GET", url, nil) 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.elevenlabs.io/v1/convai/agents/agent_id/topics") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/convai/agents/agent_id/topics") .asString(); ``` ```php request('GET', 'https://api.elevenlabs.io/v1/convai/agents/agent_id/topics'); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/agents/agent_id/topics"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/agents/agent_id/topics")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ``` -------------------------------- ### Get Voice Settings HTTP Client Examples Source: https://elevenlabs.io/docs/api-reference/voices/settings/get Examples for retrieving voice settings using standard HTTP libraries in various programming languages. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/voices/voice_id/settings" req, _ := http.NewRequest("GET", url, nil) 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.elevenlabs.io/v1/voices/voice_id/settings") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/voices/voice_id/settings") .asString(); ``` ```php request('GET', 'https://api.elevenlabs.io/v1/voices/voice_id/settings'); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/voices/voice_id/settings"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/voices/voice_id/settings")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ``` -------------------------------- ### Initialize Project Source: https://elevenlabs.io/docs/eleven-agents/operate/cli Creates the necessary project structure, configuration directories, and registry files. ```bash elevenlabs agents init ``` -------------------------------- ### Get Document HTTP Examples Source: https://elevenlabs.io/docs/eleven-agents/api-reference/knowledge-base/get-document Examples for interacting with the Get Document endpoint using standard HTTP libraries in various languages. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM?agent_id=agent_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM?agent_id=agent_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM?agent_id=agent_id") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('GET', 'https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM?agent_id=agent_id', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM?agent_id=agent_id"); var request = new RestRequest(Method.GET); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/knowledge-base/21m00Tcm4TlvDq8ikWAM?agent_id=agent_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ``` -------------------------------- ### Install Backend Dependencies Source: https://elevenlabs.io/docs/eleven-agents/guides/quickstarts/java-script Install additional packages required for the backend setup. ```bash npm install express cors dotenv ``` -------------------------------- ### Create Composition Plan HTTP Client Examples Source: https://elevenlabs.io/docs/api-reference/music/create-composition-plan Implementation examples using various language-specific HTTP clients. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/music/plan" payload := strings.NewReader("{\n \"prompt\": \"string\"\n}") req, _ := http.NewRequest("POST", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/music/plan") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"prompt\": \"string\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.elevenlabs.io/v1/music/plan") .header("Content-Type", "application/json") .body("{\n \"prompt\": \"string\"\n}") .asString(); ``` ```php request('POST', 'https://api.elevenlabs.io/v1/music/plan', [ 'body' => '{ "prompt": "string" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/music/plan"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"prompt\": \"string\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["prompt": "string"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/music/plan")! 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() ``` -------------------------------- ### Get Subscription SDK Examples Source: https://elevenlabs.io/docs/api-reference/user/subscription/get Examples for retrieving subscription data using official SDKs. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.user.subscription.get(); } main(); ``` ```python from elevenlabs import ElevenLabs client = ElevenLabs() client.user.subscription.get() ``` -------------------------------- ### Create Tool Approval HTTP Client Examples Source: https://elevenlabs.io/docs/eleven-agents/api-reference/mcp/approval-policies/create Implementation examples using various language-specific HTTP clients. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/mcp-servers/mcp_server_id/tool-approvals" payload := strings.NewReader("{\n \"tool_name\": \"tool_name\",\n \"tool_description\": \"tool_description\"\n}") req, _ := http.NewRequest("POST", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/convai/mcp-servers/mcp_server_id/tool-approvals") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"tool_name\": \"tool_name\",\n \"tool_description\": \"tool_description\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.elevenlabs.io/v1/convai/mcp-servers/mcp_server_id/tool-approvals") .header("Content-Type", "application/json") .body("{\n \"tool_name\": \"tool_name\",\n \"tool_description\": \"tool_description\"\n}") .asString(); ``` ```php request('POST', 'https://api.elevenlabs.io/v1/convai/mcp-servers/mcp_server_id/tool-approvals', [ 'body' => '{ "tool_name": "tool_name", "tool_description": "tool_description" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/mcp-servers/mcp_server_id/tool-approvals"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"tool_name\": \"tool_name\",\n \"tool_description\": \"tool_description\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Agents HTTP Requests Source: https://elevenlabs.io/docs/api-reference/knowledge-base/get-agents Examples of making direct HTTP GET requests to the agents endpoint. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/knowledge-base/documentation_id/dependent-agents" req, _ := http.NewRequest("GET", url, nil) 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.elevenlabs.io/v1/convai/knowledge-base/documentation_id/dependent-agents") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/convai/knowledge-base/documentation_id/dependent-agents") .asString(); ``` ```php request('GET', 'https://api.elevenlabs.io/v1/convai/knowledge-base/documentation_id/dependent-agents'); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/knowledge-base/documentation_id/dependent-agents"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/knowledge-base/documentation_id/dependent-agents")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ``` -------------------------------- ### Create Test Folder HTTP Client Examples Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tests/test-folders/create Implementation examples for creating a test folder using various programming languages and HTTP clients. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/agent-testing/folders" payload := strings.NewReader("{\n \"name\": \"name\"\n}") req, _ := http.NewRequest("POST", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/convai/agent-testing/folders") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"name\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.elevenlabs.io/v1/convai/agent-testing/folders") .header("Content-Type", "application/json") .body("{\n \"name\": \"name\"\n}") .asString(); ``` ```php request('POST', 'https://api.elevenlabs.io/v1/convai/agent-testing/folders', [ 'body' => '{ "name": "name" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/agent-testing/folders"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"name\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["name": "name"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/agent-testing/folders")! 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() ``` -------------------------------- ### Get Agent Link SDK Examples Source: https://elevenlabs.io/docs/eleven-agents/api-reference/agents/get-link Examples using the official ElevenLabs SDKs for TypeScript and Python. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.conversationalAi.agents.link.get("agent_3701k3ttaq12ewp8b7qv5rfyszkz"); } main(); ``` ```python from elevenlabs import ElevenLabs client = ElevenLabs() client.conversational_ai.agents.link.get( agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", ) ``` -------------------------------- ### Initialize Project and Install Dependencies Source: https://elevenlabs.io/docs/eleven-agents/guides/quickstarts/java-script Commands to create the project directory and install the necessary Vite and ElevenLabs client packages. ```bash mkdir elevenlabs-conversational-ai cd elevenlabs-conversational-ai ``` ```bash npm init -y npm install vite @elevenlabs/client ``` -------------------------------- ### Create Batch Call HTTP Client Examples Source: https://elevenlabs.io/docs/api-reference/batch-calling/create Implementation examples using standard HTTP libraries in various languages. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/batch-calling/submit" payload := strings.NewReader("{\n \"call_name\": \"string\",\n \"agent_id\": \"string\",\n \"recipients\": [\n {}\n ]\n}") req, _ := http.NewRequest("POST", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/convai/batch-calling/submit") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"call_name\": \"string\",\n \"agent_id\": \"string\",\n \"recipients\": [\n {}\n ]\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.elevenlabs.io/v1/convai/batch-calling/submit") .header("Content-Type", "application/json") .body("{\n \"call_name\": \"string\",\n \"agent_id\": \"string\",\n \"recipients\": [\n {}\n ]\n}") .asString(); ``` ```php request('POST', 'https://api.elevenlabs.io/v1/convai/batch-calling/submit', [ 'body' => '{ "call_name": "string", "agent_id": "string", "recipients": [ {} ] }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/batch-calling/submit"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"call_name\": \"string\",\n \"agent_id\": \"string\",\n \"recipients\": [\n {}\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [ "call_name": "string", "agent_id": "string", "recipients": [[]] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/batch-calling/submit")! 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() ``` -------------------------------- ### Get Tool Executions SDK Examples Source: https://elevenlabs.io/docs/api-reference/tools/get-executions Implementation examples using the official TypeScript and Python SDKs. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.conversationalAi.tools.executions.get("tool_id", {}); } main(); ``` ```python from elevenlabs import ElevenLabs client = ElevenLabs() client.conversational_ai.tools.executions.get( tool_id="tool_id", ) ``` -------------------------------- ### Convert Project HTTP Client Examples Source: https://elevenlabs.io/docs/api-reference/studio/convert-project Examples for triggering a project conversion using standard HTTP libraries. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/studio/projects/project_id/convert" req, _ := http.NewRequest("POST", url, nil) 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.elevenlabs.io/v1/studio/projects/project_id/convert") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.elevenlabs.io/v1/studio/projects/project_id/convert") .asString(); ``` ```php request('POST', 'https://api.elevenlabs.io/v1/studio/projects/project_id/convert'); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/studio/projects/project_id/convert"); var request = new RestRequest(Method.POST); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/studio/projects/project_id/convert")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" 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() ``` -------------------------------- ### Get SIP Messages SDK Examples Source: https://elevenlabs.io/docs/api-reference/conversations/get-sip-messages Implementation examples using the ElevenLabs TypeScript and Python SDKs. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.conversationalAi.conversations.getSipMessages("conversation_id", {}); } main(); ``` ```python from elevenlabs import ElevenLabs client = ElevenLabs() client.conversational_ai.conversations.get_sip_messages( conversation_id="conversation_id", ) ``` -------------------------------- ### HTTP Client Implementation Examples Source: https://elevenlabs.io/docs/api-reference/workspace/analytics/requests/get Examples for fetching workspace analytics using various programming language HTTP clients. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/workspace/analytics/requests" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/workspace/analytics/requests") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.elevenlabs.io/v1/workspace/analytics/requests") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://api.elevenlabs.io/v1/workspace/analytics/requests', [ 'body' => '{}', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/workspace/analytics/requests"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/workspace/analytics/requests")! 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() ``` -------------------------------- ### Get Agent Link SDK Examples Source: https://elevenlabs.io/docs/api-reference/agents/get-link Examples for retrieving an agent link using official SDKs. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.conversationalAi.agents.link.get("agent_id"); } main(); ``` ```python from elevenlabs import ElevenLabs client = ElevenLabs() client.conversational_ai.agents.link.get( agent_id="agent_id", ) ``` -------------------------------- ### Add Chapter HTTP Examples Source: https://elevenlabs.io/docs/api-reference/studio/add-chapter Implementation examples using standard HTTP libraries in various languages. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/studio/projects/project_id/chapters" payload := strings.NewReader("{\n \"name\": \"Chapter 1\"\n}") req, _ := http.NewRequest("POST", url, payload) 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 require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/studio/projects/project_id/chapters") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"Chapter 1\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.elevenlabs.io/v1/studio/projects/project_id/chapters") .header("Content-Type", "application/json") .body("{\n \"name\": \"Chapter 1\"\n}") .asString(); ``` ```php request('POST', 'https://api.elevenlabs.io/v1/studio/projects/project_id/chapters', [ 'body' => '{ "name": "Chapter 1" }', 'headers' => [ 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/studio/projects/project_id/chapters"); var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"Chapter 1\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Content-Type": "application/json"] let parameters = ["name": "Chapter 1"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/studio/projects/project_id/chapters")! 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() ``` -------------------------------- ### Get Chapter SDK Examples Source: https://elevenlabs.io/docs/api-reference/studio/get-chapter Implementation examples for retrieving a chapter using the official TypeScript and Python SDKs. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.studio.projects.chapters.get("chapter_id", "project_id"); } main(); ``` ```python from elevenlabs import ElevenLabs client = ElevenLabs() client.studio.projects.chapters.get( chapter_id="chapter_id", project_id="project_id", ) ``` -------------------------------- ### HTTP Client Implementation Examples Source: https://elevenlabs.io/docs/api-reference/studio/get-chapter-snapshots Examples for retrieving snapshots using standard HTTP libraries in various programming languages. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id/snapshots" req, _ := http.NewRequest("GET", url, nil) 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.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id/snapshots") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id/snapshots") .asString(); ``` ```php request('GET', 'https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id/snapshots'); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id/snapshots"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id/snapshots")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ``` -------------------------------- ### System prompt guidance examples Source: https://elevenlabs.io/docs/eleven-agents/customization/voice/expressive-mode Examples of system prompt instructions to guide agent tone and emotional delivery. ```text You are a customer support agent. When a user sounds frustrated or upset, respond in a calm, reassuring tone. When delivering good news, allow your tone to reflect genuine warmth. Maintain a professional but approachable delivery throughout. ``` ```text You are a conversational AI agent with expressive speech capabilities. Tone guidelines: - When a user expresses frustration, use a calm and empathetic tone - When explaining technical steps, use a clear and measured pace - When a user shares good news, respond with warmth and enthusiasm - When handling complaints, remain composed and solution-oriented ``` -------------------------------- ### Get Chapter HTTP Requests Source: https://elevenlabs.io/docs/api-reference/studio/get-chapter Examples of how to perform a GET request to the chapter endpoint using various programming languages. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id" req, _ := http.NewRequest("GET", url, nil) 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.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id") .asString(); ``` ```php request('GET', 'https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id'); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/studio/projects/project_id/chapters/chapter_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" 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() ``` -------------------------------- ### Setup virtual environment Source: https://elevenlabs.io/docs/eleven-agents/guides/integrations/raspberry-pi-voice-assistant Create and activate a Python virtual environment. ```bash python -m venv .venv # Only required the first time you set up the project source .venv/bin/activate ```