Phone Numbers
Get Agent Number Binding
Check which phone numbers are attached to an agent and whether each one answers on the production or staging environment.
GET
/
v2
/
agents
/
{agent_id}
/
inbound
Get Agent Number Binding
curl --request GET \
--url https://api.bland.ai/v2/agents/{agent_id}/inbound \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/inbound"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v2/agents/{agent_id}/inbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bland.ai/v2/agents/{agent_id}/inbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/inbound"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bland.ai/v2/agents/{agent_id}/inbound")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/inbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": {
"agent_id": "680817f5-147a-4e7f-9d25-eac973e693a5",
"persona_id": "a308a95d-854d-435a-ae2a-b3d113b59054",
"pathway_id": "48e86cb8-4d1a-4be6-a85a-4c277255eeb4",
"numbers": [
{
"phone_number": "+18005551234",
"agent_env_type": "staging"
},
{
"phone_number": "+18005556789",
"agent_env_type": null
}
],
"staging_attach_supported": true
},
"errors": null
}
{
"data": {
"agent_id": "818cab80-86c9-46fc-93d8-a7f548b18d7e",
"persona_id": null,
"pathway_id": null,
"numbers": [],
"staging_attach_supported": true
},
"errors": null
}
Overview
Returns the agent’s inbound number binding.persona_id is null until the first successful Attach Numbers to Agent call. numbers lists the numbers attached to the agent and the environment each one answers on. An unknown agent ID returns persona_id: null rather than 404.
Headers
Path Parameters
Response
ID of the persona that attached numbers route through. Bland creates it on the first attach and keeps it afterwards, so it stays set even after every number is detached.
null if numbers have never been attached to this agent.ID of the pathway Bland compiles from the agent for its attached numbers. Text conversations that the agent handles on these numbers record this ID as their pathway ID. Like
persona_id, it stays set after every number is detached. Setting a migration split above 0 for this agent also creates it, so it can be set while persona_id is null. null until one of these happens.false when your account runs on dedicated infrastructure, where numbers can’t be attached to staging. Attaching to staging also requires an enterprise plan, which this field does not check.{
"data": {
"agent_id": "680817f5-147a-4e7f-9d25-eac973e693a5",
"persona_id": "a308a95d-854d-435a-ae2a-b3d113b59054",
"pathway_id": "48e86cb8-4d1a-4be6-a85a-4c277255eeb4",
"numbers": [
{
"phone_number": "+18005551234",
"agent_env_type": "staging"
},
{
"phone_number": "+18005556789",
"agent_env_type": null
}
],
"staging_attach_supported": true
},
"errors": null
}
{
"data": {
"agent_id": "818cab80-86c9-46fc-93d8-a7f548b18d7e",
"persona_id": null,
"pathway_id": null,
"numbers": [],
"staging_attach_supported": true
},
"errors": null
}
Docs for agents: llms.txt
Was this page helpful?
⌘I
Get Agent Number Binding
curl --request GET \
--url https://api.bland.ai/v2/agents/{agent_id}/inbound \
--header 'authorization: <authorization>'import requests
url = "https://api.bland.ai/v2/agents/{agent_id}/inbound"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://api.bland.ai/v2/agents/{agent_id}/inbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bland.ai/v2/agents/{agent_id}/inbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bland.ai/v2/agents/{agent_id}/inbound"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.bland.ai/v2/agents/{agent_id}/inbound")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v2/agents/{agent_id}/inbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"data": {
"agent_id": "680817f5-147a-4e7f-9d25-eac973e693a5",
"persona_id": "a308a95d-854d-435a-ae2a-b3d113b59054",
"pathway_id": "48e86cb8-4d1a-4be6-a85a-4c277255eeb4",
"numbers": [
{
"phone_number": "+18005551234",
"agent_env_type": "staging"
},
{
"phone_number": "+18005556789",
"agent_env_type": null
}
],
"staging_attach_supported": true
},
"errors": null
}
{
"data": {
"agent_id": "818cab80-86c9-46fc-93d8-a7f548b18d7e",
"persona_id": null,
"pathway_id": null,
"numbers": [],
"staging_attach_supported": true
},
"errors": null
}