Quick Start
Make your first outbound call in 3 steps.
This guide assumes you have a Twenty2 account and at least one published assistant.
Step 1 — Get Your API Key
Generate your API key from the Twenty2 dashboard.
-
Go to Profile → Integrations → Build with Twenty2 API
-
Click API Keys → Create New
-
Copy and save your key securely
Store your API Key in an environment variable like TWENTY2_API_KEY — never hardcode it in your source code.
Step 2 — Publish an Assistant
Build and publish an assistant inside the Twenty2 dashboard before making API calls.
-
Go to the Assistants section in your dashboard
-
Build your assistant — set its voice, language, and call script
-
Click Publish
-
Copy the
assistant_idfrom the assistant detail page — you'll need it in the next step
Step 3 — Trigger Your First Call
Use the POST /calls endpoint to trigger an outbound call.
curl -X POST "https://api.twentytwo.in/api/agent/trigger-outbound-call" \
-H "Content-Type: application/json" \
-H "x-workspace-id: 69b671241b2dacf0c0f15885" \
-H "Authorization: Basic YOUR_CREDENTIALS" \
-d '{
"agent_id": "69de483c68b23495c853b43a",
"callee_phone": "9999999999",
"caller_phone": "9999999999",
"input_parameters": {
"agentName": "Rohit"
}
}'
import requests
import json
url = "https://api.twentytwo.in/api/agent/trigger-outbound-call"
headers = {
"Content-Type": "application/json",
"x-workspace-id": "69b671241b2dacf0c0f15885",
"Authorization": "Basic YOUR_CREDENTIALS"
}
data = {
"agent_id": "69de483c68b23495c853b43a",
"callee_phone": "9999999999",
"caller_phone": "9999999999",
"input_parameters": {
"agentName": "Rohit"
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.twentytwo.in/api/agent/trigger-outbound-call", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-workspace-id": "69b671241b2dacf0c0f15885",
"Authorization": "Basic YOUR_CREDENTIALS"
},
body: JSON.stringify({
"agent_id": "69de483c68b23495c853b43a",
"callee_phone": "9999999999",
"caller_phone": "9999999999",
"input_parameters": {
"agentName": "Rohit"
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"agent_id": "69de483c68b23495c853b43a",
"callee_phone": "9999999999",
"caller_phone": "9999999999",
"input_parameters": {
"agentName": "Rohit"
}
}`)
req, err := http.NewRequest("POST", "https://api.twentytwo.in/api/agent/trigger-outbound-call", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-workspace-id", "69b671241b2dacf0c0f15885")
req.Header.Set("Authorization", "Basic YOUR_CREDENTIALS")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.twentytwo.in/api/agent/trigger-outbound-call')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['x-workspace-id'] = '69b671241b2dacf0c0f15885'
request['Authorization'] = 'Basic YOUR_CREDENTIALS'
request.body = '{
"agent_id": "69de483c68b23495c853b43a",
"callee_phone": "9999999999",
"caller_phone": "9999999999",
"input_parameters": {
"agentName": "Rohit"
}
}'
response = http.request(request)
puts response.body
What You'll Get Back
If the call is queued successfully, you'll receive this response:
{
"success": true,
"call_id": "call_9c4d7e12ab",
"status": "initiated",
"message": "Call queued successfully."
}
Calls are non-blocking. The API returns immediately once the call is queued.
Use the call_id to track the outcome via GET /history/calls/{call_id} or
listen for the call.completed webhook event.
Next Steps
Last updated 1 day ago
Built with Documentation.AI