### List Tools via HTTP GET Request (Swift) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tools/list This Swift example demonstrates making an HTTP GET request using URLSession to fetch a list of tools from the Eleven Labs API. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/tools?search=search&page_size=1&show_only_owned_documents=true&created_by_user_id=created_by_user_id&types=%5B%22webhook%22%5D&sort_direction=asc&sort_by=name&cursor=cursor")! 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() ``` -------------------------------- ### List Tools via HTTP GET Request (Java) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tools/list Example of making an HTTP GET request in Java to list conversational AI tools using the Unirest library for simplified HTTP calls. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/convai/tools?search=search&page_size=1&show_only_owned_documents=true&created_by_user_id=created_by_user_id&types=%5B%22webhook%22%5D&sort_direction=asc&sort_by=name&cursor=cursor") .asString(); ``` -------------------------------- ### List Invocations with PHP Guzzle Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tests/test-invocations/list Use the Guzzle HTTP client in PHP to make a GET request to the Eleven Labs API. This example assumes Guzzle is installed via Composer and shows how to retrieve the response body. ```php request('GET', 'https://api.elevenlabs.io/v1/convai/test-invocations?agent_id=agent_id&page_size=1&cursor=cursor'); echo $response->getBody(); ``` -------------------------------- ### Initialize npm Project and Install Packages Source: https://elevenlabs.io/docs/eleven-agents/guides/quickstarts/java-script Initialize a new npm project and install Vite and the ElevenLabs client library. ```bash npm init -y npm install vite @elevenlabs/client ``` -------------------------------- ### Start Development Server Source: https://elevenlabs.io/docs/eleven-agents/guides/quickstarts/next-js Run the Next.js development server to view your application. ```bash npm run dev ``` -------------------------------- ### List Phone Numbers via HTTP Request (PHP) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/phone-numbers/list Employ the Guzzle HTTP client in PHP to send a GET request to the Eleven Labs API for listing phone numbers. This example assumes Guzzle is installed via Composer. ```php request('GET', 'https://api.elevenlabs.io/v1/convai/phone-numbers'); echo $response->getBody(); ``` -------------------------------- ### Get Phone Number Details (C#) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/phone-numbers/get Use RestSharp to make a GET request for phone number details. This example initializes RestClient and executes a GET request. ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/phone-numbers/TeaqRRdTcIfIu2i7BYfT"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Navigate to Project Directory Source: https://elevenlabs.io/docs/eleven-agents/guides/quickstarts/next-js Change into the newly created project directory. ```bash cd my-conversational-agent ``` -------------------------------- ### Get WebRTC Token with TypeScript SDK Source: https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/get-webrtc-token Use the ElevenLabsClient to get a WebRTC token. Ensure the SDK is installed and imported. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.conversationalAi.conversations.getWebrtcToken({ agentId: "agent_3701k3ttaq12ewp8b7qv5rfyszkz", participantName: "participant_name", branchId: "branch_id", environment: "environment", }); } main(); ``` -------------------------------- ### Create Project Directory and Virtual Environment Source: https://elevenlabs.io/docs/eleven-agents/guides/integrations/raspberry-pi-voice-assistant Set up a new project directory and activate a Python virtual environment for managing dependencies. ```bash mkdir eleven-voice-assistant cd eleven-voice-assistant python -m venv .venv # Only required the first time you set up the project source .venv/bin/activate ``` -------------------------------- ### Install Tailwind CSS Source: https://elevenlabs.io/docs/eleven-agents/libraries/web-sockets Install Tailwind CSS for styling your Next.js application. Follow the official guide for Next.js integration. ```bash npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p ``` -------------------------------- ### Create Next.js App Source: https://elevenlabs.io/docs/eleven-agents/guides/quickstarts/next-js Initialize a new Next.js project. Follow the default suggestions during setup. ```bash npm create next-app my-conversational-agent ``` -------------------------------- ### Get Dashboard Settings (C#) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/workspace/dashboard/get Retrieve dashboard settings in C# using the RestSharp library. This example shows how to execute a GET request. ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/settings/dashboard"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Set up ngrok for public URL Source: https://elevenlabs.io/docs/eleven-agents/customization/llm/custom-llm Use ngrok to create a public URL for your local server. Replace `.ngrok.app` with your desired ngrok subdomain. ```shell ngrok http --url=.ngrok.app 8013 ``` -------------------------------- ### Get Signed URL with TypeScript SDK Source: https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/get-signed-url Use the ElevenLabsClient SDK to get a signed URL for a conversation. Ensure you have the SDK installed and initialized. ```typescript import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js"; async function main() { const client = new ElevenLabsClient(); await client.conversationalAi.conversations.getSignedUrl({ agentId: "agent_3701k3ttaq12ewp8b7qv5rfyszkz", includeConversationId: true, branchId: "branch_id", environment: "environment", }); } main(); ``` -------------------------------- ### Basic Usage Example Source: https://elevenlabs.io/docs/eleven-agents/libraries/react A minimal example demonstrating how to connect to an agent and manage a voice conversation using the React SDK. ```APIDOC ## Usage Here is a minimal working example that connects to an agent and lets the user start and end a voice conversation: ```tsx import { ConversationProvider, useConversationControls, useConversationStatus, } from "@elevenlabs/react"; function App() { return ( ); } function Agent() { const { startSession, endSession } = useConversationControls(); const { status } = useConversationStatus(); if (status === "connected") { return ; } return ( ); } ``` ``` -------------------------------- ### Create Agent Deployment (Swift) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/agents/deployments/create Example of creating a new agent deployment using Swift's URLSession. Ensure you have the correct API key and headers set. ```swift let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/agents/agent_3701k3ttaq12ewp8b7qv5rfyszkz/deployments")! 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 WhatsApp Account (C#) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/whats-app/accounts/get Fetch WhatsApp account details using the RestSharp library in C#. This example demonstrates a basic GET request. ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/whatsapp-accounts/phone_number_id"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Get Environment Variable (Ruby) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/environment-variables/get Retrieve an environment variable via an HTTP GET request in Ruby. This example uses the Net::HTTP library. ```ruby require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/convai/environment-variables/env_var_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 ``` -------------------------------- ### List Tools via HTTP GET Request (Ruby) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tools/list This Ruby example demonstrates how to fetch a list of conversational AI tools using Ruby's Net::HTTP library for making GET requests. ```ruby require 'uri' require 'net/http' url = URI("https://api.elevenlabs.io/v1/convai/tools?search=search&page_size=1&show_only_owned_documents=true&created_by_user_id=created_by_user_id&types=%5B%22webhook%22%5D&sort_direction=asc&sort_by=name&cursor=cursor") 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 ``` -------------------------------- ### Recommended: Explicit Format in Parameter Description for Tool Source: https://elevenlabs.io/docs/eleven-agents/best-practices/prompting-guide This example demonstrates an effective way to describe tool parameters by including explicit format requirements and examples, ensuring the LLM provides data in the correct structure. ```mdx ## `lookupAccount` tool parameters - `email` (required): "The user's email in standard email format, e.g. 'john@gmail.com'." - `phone` (required): "The user's phone number as digits only, e.g. '5551234567'." - `confirmation_code` (required): "The user's confirmation code as a single alphanumeric string without spaces, e.g. 'ABC123'." ``` -------------------------------- ### Get Batch Call Results (Swift) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/batch-calling/get Retrieve batch call results using URLSession in Swift. This example demonstrates a basic GET request. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/batch-calling/batch_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() ``` -------------------------------- ### Install Debian Dependencies Source: https://elevenlabs.io/docs/eleven-agents/guides/integrations/raspberry-pi-voice-assistant Install necessary audio and development libraries on Debian-based systems using apt-get. ```bash sudo apt-get update sudo apt-get install libportaudio2 libportaudiocpp0 portaudio19-dev libasound-dev sndfile1-dev -y ``` -------------------------------- ### Get WebRTC Token with C# RestSharp Source: https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/get-webrtc-token Obtain a WebRTC token using the RestSharp library in C#. This example demonstrates a simple GET request. ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/conversation/token?agent_id=agent_3701k3ttaq12ewp8b7qv5rfyszkz&participant_name=participant_name&branch_id=branch_id&environment=environment"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Install voice-stream Package Source: https://elevenlabs.io/docs/eleven-agents/libraries/web-sockets Install the voice-stream package for microphone input handling and audio encoding. ```bash npm install voice-stream ``` -------------------------------- ### Get Live Count (Go) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/analytics/get Retrieve the live count of an agent via an HTTP GET request. This example demonstrates direct HTTP interaction. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/analytics/live-count?agent_id=agent_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)) } ``` -------------------------------- ### Get Dependent Agents cURL Example Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tools/get-dependent-agents Example using cURL to fetch agents dependent on a tool, with optional cursor and page size parameters. ```bash $ curl -G https://api.elevenlabs.io/v1/convai/tools/tool_id/dependent-agents \ -d cursor=cursor \ -d page_size=1 ``` -------------------------------- ### Create Knowledge Base Document from File (Python) Source: https://elevenlabs.io/docs/eleven-agents/customization/knowledge-base Create a knowledge base document by uploading a file. Supported formats include PDF, TXT, DOCX, HTML, and EPUB. ```python # Or create a document from a file knowledge_base_document_file = elevenlabs.conversational_ai.knowledge_base.documents.create_from_file( file=open("/path/to/unladen-swallow-facts.txt", "rb"), name="Unladen Swallow Facts", ) ``` -------------------------------- ### Run the Connector Application Source: https://elevenlabs.io/docs/eleven-agents/phone-numbers/telephony/vonage Start the Node.js WebSocket connector application to bridge Vonage and ElevenLabs. ```bash node elevenlabs-agent-ws-connector.cjs ``` -------------------------------- ### Get WhatsApp Account (Swift) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/whats-app/accounts/get Retrieve WhatsApp account information using Swift's URLSession. This example shows how to set up and execute a GET request. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/whatsapp-accounts/phone_number_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() ``` -------------------------------- ### Configure Play Keypad Touch Tone System Tool in Python Source: https://elevenlabs.io/docs/eleven-agents/customization/tools/system-tools/play-keypad-touch-tone This Python code demonstrates how to initialize the ElevenLabs client and configure the play_keypad_touch_tone system tool for an agent. It shows how to create the tool configuration with optional custom descriptions and integrate it into the agent's conversational configuration. ```python from elevenlabs import ( ConversationalConfig, ElevenLabs, AgentConfig, PromptAgent, PromptAgentInputToolsItem_System, SystemToolConfigInputParams_PlayKeypadTouchTone, ) # Initialize the client elevenlabs = ElevenLabs(api_key="YOUR_API_KEY") # Create the keypad touch tone tool configuration keypad_tool = PromptAgentInputToolsItem_System( type="system", name="play_keypad_touch_tone", description="Play DTMF tones to interact with automated phone systems.", # Optional custom description params=SystemToolConfigInputParams_PlayKeypadTouchTone( system_tool_type="play_keypad_touch_tone" ) ) # Create the agent configuration conversation_config = ConversationalConfig( agent=AgentConfig( prompt=PromptAgent( prompt="You are a helpful assistant that can interact with phone systems.", first_message="Hi, I can help you navigate phone systems. How can I assist you today?", tools=[keypad_tool], ) ) ) ``` -------------------------------- ### Get WhatsApp Account (Go) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/whats-app/accounts/get Direct HTTP GET request to retrieve WhatsApp account details. This example shows how to construct the URL and handle the response. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/whatsapp-accounts/phone_number_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)) } ``` -------------------------------- ### Get WebRTC Token with Swift URLSession Source: https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/get-webrtc-token Retrieve a WebRTC token using Swift's URLSession. This example shows how to perform an asynchronous GET request. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/conversation/token?agent_id=agent_3701k3ttaq12ewp8b7qv5rfyszkz&participant_name=participant_name&branch_id=branch_id&environment=environment")! 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 Live Count (Java) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/analytics/get Use the Unirest library to perform an HTTP GET request for live agent analytics. This example requires the Unirest dependency. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.elevenlabs.io/v1/convai/analytics/live-count?agent_id=agent_id") .asString(); ``` -------------------------------- ### Initiate Outbound Call with Go HTTP Request Source: https://elevenlabs.io/docs/eleven-agents/api-reference/exotel/outbound-call This Go example demonstrates making a direct HTTP POST request to initiate an outbound call via Exotel. It includes setting the correct URL, payload, and headers. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/exotel/outbound-call" payload := strings.NewReader("{\n \"agent_id\": \"agent_id\",\n \"agent_phone_number_id\": \"agent_phone_number_id\",\n \"to_number\": \"to_number\"\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)) } ``` -------------------------------- ### List Agents via HTTP GET Request (Java) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/agents/list Example of making an HTTP GET request in Java to list agents using the Unirest library. This code demonstrates how to execute the request and get the response 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?page_size=1&search=search&archived=true&show_only_owned_agents=true&created_by_user_id=created_by_user_id&sort_direction=asc&sort_by=name&cursor=cursor") .asString(); ``` -------------------------------- ### Move Agents (Go) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tests/test-folders/move This Go example demonstrates how to make a POST request to the bulk-move API endpoint using the standard http library. It includes setting the correct URL, payload, and headers. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/agent-testing/bulk-move" payload := strings.NewReader("{\n \"entity_ids\": [\n \"entity_ids\" ] }") 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)) } ``` -------------------------------- ### Initiate Outbound Call with Go HTTP Client Source: https://elevenlabs.io/docs/eleven-agents/api-reference/sip-trunk/outbound-call This Go example demonstrates making a POST request to the outbound call API endpoint using the standard net/http package. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/sip-trunk/outbound-call" payload := strings.NewReader("{\n \"agent_id\": \"agent_id\",\n \"agent_phone_number_id\": \"agent_phone_number_id\",\n \"to_number\": \"to_number\"\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)) } ``` -------------------------------- ### Get Dashboard Settings (Swift) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/workspace/dashboard/get Make a GET request for dashboard settings in Swift using URLSession. This example includes basic error handling and response printing. ```swift import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/settings/dashboard")! 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 WhatsApp Account (PHP) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/whats-app/accounts/get Use Guzzle HTTP client in PHP to make a GET request for WhatsApp account information. Ensure the Guzzle library is installed. ```php request('GET', 'https://api.elevenlabs.io/v1/convai/whatsapp-accounts/phone_number_id'); echo $response->getBody(); ``` -------------------------------- ### Create Project Directory Source: https://elevenlabs.io/docs/eleven-agents/guides/quickstarts/java-script Use this command to create a new directory for your project and navigate into it. ```bash mkdir elevenlabs-conversational-ai cd elevenlabs-conversational-ai ``` -------------------------------- ### Get Conversation Topics (Ruby) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/topics/get Retrieve conversation topics using a direct HTTP GET request in Ruby. This example shows how to set headers and make the request. ```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) request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` -------------------------------- ### List available agent templates Source: https://elevenlabs.io/docs/eleven-agents/operate/cli Lists all available pre-built templates for creating ElevenLabs agents. ```bash elevenlabs agents templates list ``` -------------------------------- ### Get Conversation Topics (Go) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/conversations/topics/get Retrieve conversation topics using a direct HTTP GET request in Go. This example demonstrates setting the necessary headers and payload. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/agents/agent_id/topics" 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)) } ``` -------------------------------- ### Start Next.js Development Server Source: https://elevenlabs.io/docs/eleven-agents/guides/integrations/upstash-redis Run this command in your terminal to start the Next.js development server for local testing. ```bash pnpm dev ``` -------------------------------- ### Get Environment Variable (Go) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/environment-variables/get Fetch an environment variable using a direct HTTP GET request in Go. This example demonstrates setting headers and reading the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.elevenlabs.io/v1/convai/environment-variables/env_var_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)) } ``` -------------------------------- ### Install ElevenLabs React SDK Source: https://elevenlabs.io/docs/eleven-agents/libraries/react Install the ElevenLabs React SDK using npm, yarn, or pnpm. ```shell npm install @elevenlabs/react ``` ```shell # or yarn add @elevenlabs/react ``` ```shell # or pnpm install @elevenlabs/react ``` -------------------------------- ### System Tool Configuration Example Source: https://elevenlabs.io/docs/eleven-agents/api-reference/agents/update This snippet shows the configuration for a system tool, including its name, parameters, type, description, and assignments. It is used to define agent behavior for specific system events. ```json { "system_tool_type": "end_call" } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` ```json { "name": "end_call", "params": { "system_tool_type": "end_call" }, "type": "system", "description": "", "assignments": [ { "dynamic_variable": "user_name", "value_path": "user.name", "source": "response", "sanitize": false, "preserve_native_type": false } ] } ``` -------------------------------- ### Get Agent Summaries with C# RestSharp Source: https://elevenlabs.io/docs/eleven-agents/api-reference/agents/get-summaries Employ the RestSharp library in C# to execute a GET request for agent summaries. This example demonstrates setting up the client and request. ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/agents/summaries?agent_ids=%5B%22agent_ids%22%5D"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### List Tools via HTTP GET Request (C#) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/tools/list An example in C# using the RestSharp library to perform an HTTP GET request for listing conversational AI tools. ```csharp using RestSharp; var client = new RestClient("https://api.elevenlabs.io/v1/convai/tools?search=search&page_size=1&show_only_owned_documents=true&created_by_user_id=created_by_user_id&types=%5B%22webhook%22%5D&sort_direction=asc&sort_by=name&cursor=cursor"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Example: System Prompt Hardening Source: https://elevenlabs.io/docs/eleven-agents/best-practices/guardrails Use the `# Guardrails` heading in your system prompt to provide explicit instructions about allowed and disallowed agent behavior. Models pay extra attention to this section for critical rules. ```mdx ```mdx # Guardrails - Do not discuss pricing. - Do not offer discounts. - Do not engage in conversations about politics. ``` ``` -------------------------------- ### Manual URL Construction Steps Source: https://elevenlabs.io/docs/eleven-agents/customization/personalization/dynamic-variables Step-by-step guide for manually constructing public talk-to URLs using both base64-encoded JSON and individual parameter methods. ```text # Base64-encoded method 1. Create JSON: {"user_name": "John", "account_type": "premium"} 2. Encode to base64: eyJ1c2VyX25hbWUiOiJKb2huIiwiYWNjb3VudF90eXBlIjoicHJlbWl1bSJ9 3. Add to URL: https://elevenlabs.io/app/talk-to?agent_id=agent_7101k5zvyjhmfg983brhmhkd98n6&vars=eyJ1c2VyX25hbWUiOiJKb2huIiwiYWNjb3VudF90eXBlIjoicHJlbWl1bSJ9 # Individual parameters method 1. Add each variable with var_ prefix 2. URL encode values if needed 3. Final URL: https://elevenlabs.io/app/talk-to?agent_id=agent_7101k5zvyjhmfg983brhmhkd98n6&var_user_name=John&var_account_type=premium ``` -------------------------------- ### Get Dashboard Settings (PHP) Source: https://elevenlabs.io/docs/eleven-agents/api-reference/workspace/dashboard/get Use Guzzle HTTP client in PHP to make a GET request for dashboard settings. Ensure you have the Guzzle library installed via Composer. ```php request('GET', 'https://api.elevenlabs.io/v1/convai/settings/dashboard'); echo $response->getBody(); ```