Release a phone number
curl --request DELETE \
--url https://api.talkpilot.io/v1/agents/{agentId}/phone-number \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.talkpilot.io/v1/agents/{agentId}/phone-number"
headers = {"X-API-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.talkpilot.io/v1/agents/{agentId}/phone-number', 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.talkpilot.io/v1/agents/{agentId}/phone-number",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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.talkpilot.io/v1/agents/{agentId}/phone-number"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.talkpilot.io/v1/agents/{agentId}/phone-number")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.talkpilot.io/v1/agents/{agentId}/phone-number")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key",
"request_id": "req_abc123"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Nummern-Freigabe nur mit Dashboard-Login (JWT), nicht per API-Key",
"request_id": "req_abc123"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Agent has no phone number",
"request_id": "req_abc123"
}
}{
"error": {
"code": "NOT_POOL_NUMBER",
"message": "Only pool numbers can be released via the API",
"request_id": "req_abc123"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Try again in 60 seconds.",
"request_id": "req_abc123"
}
}Agents
Release a phone number
Releases the agent’s pool number: the agent loses the number from the
next call on, and the number goes into a 90-day quarantine before it
returns to the pool. The agent_phone_number of the agent’s employees
and forwarding slots is cleared as well.
Dashboard login only: requires a JWT of a super_admin or dev_admin.
API keys are rejected with 403 FORBIDDEN, even with agents:write.
Only numbers assigned from the pool can be released. A number that was
provisioned individually for the agent is rejected with
409 NOT_POOL_NUMBER; an agent without a number gets 404 NOT_FOUND.
The Agent Builder calls this when a session is cancelled after the test call, so the number does not stay bound to an unfinished agent.
DELETE
/
v1
/
agents
/
{agentId}
/
phone-number
Release a phone number
curl --request DELETE \
--url https://api.talkpilot.io/v1/agents/{agentId}/phone-number \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.talkpilot.io/v1/agents/{agentId}/phone-number"
headers = {"X-API-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.talkpilot.io/v1/agents/{agentId}/phone-number', 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.talkpilot.io/v1/agents/{agentId}/phone-number",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$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.talkpilot.io/v1/agents/{agentId}/phone-number"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.talkpilot.io/v1/agents/{agentId}/phone-number")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.talkpilot.io/v1/agents/{agentId}/phone-number")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing API key",
"request_id": "req_abc123"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "Nummern-Freigabe nur mit Dashboard-Login (JWT), nicht per API-Key",
"request_id": "req_abc123"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Agent has no phone number",
"request_id": "req_abc123"
}
}{
"error": {
"code": "NOT_POOL_NUMBER",
"message": "Only pool numbers can be released via the API",
"request_id": "req_abc123"
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "Rate limit exceeded. Try again in 60 seconds.",
"request_id": "req_abc123"
}
}