> ## Documentation Index
> Fetch the complete documentation index at: https://api.infer.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> Step by Step guide to build your first AI Voice Agent

In this guide, we will show how to integrate Infer API with phone call using Twilio. If you would like to integrate to other platforms, reach out to [us](mailto:vaibhav@infer.so).

**1. Buy a phone number from Twilio (skip it, if you have one from Twilio)**

Go [here](https://www.twilio.com/login) and create an account and buy a phone number from Twilio. If you're creating a new account Twilio will give you \$15 to get started and hence it won't put a hole in your pocket.

**2. Get Twilio Auth Token and Account SID**

Visit the [Twilio Console API Keys page](https://console.twilio.com/us1/account/keys-credentials/api-keys) to obtain your Twilio Auth Token and Account SID. These details are essential for setting up the Twilio voice webhook, which enables Twilio to determine the appropriate destination for handling your incoming and outgoing calls linked to your Twilio number.

**3. Infer API key**

You can either email us at [vaibhav@infer.so](mailto:vaibhav@infer.so) to get the API key or use the API key that we provided you to get started.

**4. Create Your First Voice Agent 🤖**

Follow the following steps to build your first voice agent. You can also build your first voice agent by directly going [here](https://api.infer.so/api-reference/voice-agent/create-voice-agent.md) and playing with parameters to make more customized voice agent and understanding different parameters:

```javascript createVoiceAgent.js
const options = {
  method: 'POST',
  headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
  body: '{"initial_text":"Welcome to our service. I am an AI voice agent, how can I assist you today?","prompt":"You are a virtual assistant speaking with Infer who can answer queries about any topic.","responsiveness":0.2,"voice_id":"Alice (female)","voice_agent_expressiveness":0.28,"end_call_on_goodbye":true,"end_call_on_silence":30,"hipaa_compliance":true,"twilio_config":{"auth_token":"<string>","account_sid":"<string>","number":"<string>","update_webhook":true,"record":true},"custom_llm":{"url":"<string>","api_key":"<string>","model":"<string>"},"actions":{"transfer_calls":{"number_dict":{},"user_message":"<string>"},"google_sheet":true,"hangup_call":true}}'
};

fetch('https://voiceagent.infers.co/api/agent/create_new_agent', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

```python create-voice-agent.py
import requests

url = "https://voiceagent.infers.co/api/agent/create_new_agent"

payload = {
    "initial_text": "Welcome to our service. I am an AI voice agent, how can I assist you today?",
    "prompt": "You are a virtual assistant speaking with Infer who can answer queries about any topic.",
    "responsiveness": 0.2,
    "voice_id": "Alice (female)",
    "voice_agent_expressiveness": 0.28,
    "end_call_on_goodbye": True,
    "end_call_on_silence": 30,
    "hipaa_compliance": True,
    "twilio_config": {
        "auth_token": "<string>",
        "account_sid": "<string>",
        "number": "<string>",
        "update_webhook": True,
        "record": True
    },
    "custom_llm": {
        "url": "<string>",
        "api_key": "<string>",
        "model": "<string>"
    },
    "actions": {
        "transfer_calls": {
            "number_dict": {},
            "user_message": "<string>"
        },
        "google_sheet": True,
        "hangup_call": True
    }
}
headers = {
    "Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

```java CreateVoiceAgent.java
HttpResponse<String> response = Unirest.post("https://voiceagent.infers.co/api/agent/create_new_agent")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n  \"initial_text\": \"Welcome to our service. I am an AI voice agent, how can I assist you today?\",\n  \"prompt\": \"You are a virtual assistant speaking with Infer who can answer queries about any topic.\",\n  \"responsiveness\": 0.2,\n  \"voice_id\": \"Alice (female)\",\n  \"voice_agent_expressiveness\": 0.28,\n  \"end_call_on_goodbye\": true,\n  \"end_call_on_silence\": 30,\n  \"hipaa_compliance\": true,\n  \"twilio_config\": {\n    \"auth_token\": \"<string>\",\n    \"account_sid\": \"<string>\",\n    \"number\": \"<string>\",\n    \"update_webhook\": true,\n    \"record\": true\n  },\n  \"custom_llm\": {\n    \"url\": \"<string>\",\n    \"api_key\": \"<string>\",\n    \"model\": \"<string>\"\n  },\n  \"actions\": {\n    \"transfer_calls\": {\n      \"number_dict\": {},\n      \"user_message\": \"<string>\"\n    },\n    \"google_sheet\": true,\n    \"hangup_call\": true\n  }\n}")
.asString();
```

Make sure to copy the voice\_agent\_id from the response. If you face any issues, send us an email [here](mailto:vaibhav@infer.so).

You can create multiple voice agents for different purposes like one for Outbound Lead Generation another one for handling inbound calls only etc.

**5. Initiate your first outbound call 📞**

Using the voice\_agent\_id from the last step and after understanding the parameters [here](https://api.infer.so/api-reference/calls/start-outbound-phone-call.md) run the following code which will initiate the call to the specific number:

```javascript outboundCall.js
const options = {
  method: 'POST',
  headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
  body: '{"voice_agent_id":"<string>","initial_text":"Hello, this is your virtual assistant calling. How can I assist you today?","prompt_values":{"name":"John Doe"},"to_phone":"+1234567890"}'
};

fetch('https://voiceagent.infers.co/api/calls/start_outbound_call', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
```

```python outbound-call.py
import requests

url = "https://voiceagent.infers.co/api/calls/start_outbound_call"

payload = {
    "voice_agent_id": "<string>",
    "initial_text": "Hello, this is your virtual assistant calling. How can I assist you today?",
    "prompt_values": {"name": "John Doe"},
    "to_phone": "+1234567890"
}
headers = {
    "Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)
```

```java OutboundCall.java
HttpResponse<String> response = Unirest.post("https://voiceagent.infers.co/api/calls/start_outbound_call")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n  \"voice_agent_id\": \"<string>\",\n  \"initial_text\": \"Hello, this is your virtual assistant calling. How can I assist you today?\",\n  \"prompt_values\": {\n    \"name\": \"John Doe\"\n  },\n  \"to_phone\": \"+1234567890\"\n}")
.asString();
```

**6. Initiate your first inbound call 📞**

To initiate an inbound call, you don't have to change anything. Follow the steps below:

1. Call the Twilio number you configured in Step 1.
2. You should hear your AI Voice Agent respond, using the initial text and following the prompt you set in Step 4.
3. Interact with the AI voice agent to ensure it's working as expected.

Monitor your inbound calls to ensure your AI Voice Agent is performing correctly. If you need to make adjustments, you can modify your voice agent settings using the API as described in the earlier steps. If you encounter any issues or need assistance, don't hesitate to reach out to us.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.