Delete an ExoPhone
Release an ExoPhone from your account.
HTTP Request
DELETE /v2_beta/Accounts/<account_sid>/IncomingPhoneNumbers/<exophone_sid>
Path Parameters
| Parameter | Description |
|---|---|
exophone_sid | The unique SID of the ExoPhone to delete |
Code Examples
- cURL
- Python
- Node.js
- PHP
- Go
curl -u '<api_key>:<api_token>' -X DELETE 'https://api.exotel.com/v2_beta/Accounts/<account_sid>/IncomingPhoneNumbers/<exophone_sid>'
import requests
response = requests.delete(
'https://api.exotel.com/v2_beta/Accounts/<account_sid>/IncomingPhoneNumbers/<exophone_sid>',
auth=('<api_key>', '<api_token>')
)
print(response.status_code)
print(response.json())
const apiKey = '<api_key>';
const apiToken = '<api_token>';
const url = 'https://api.exotel.com/v2_beta/Accounts/<account_sid>/IncomingPhoneNumbers/<exophone_sid>';
const response = await fetch(url, {
method: 'DELETE',
headers: {
'Authorization': 'Basic ' + Buffer.from(`${apiKey}:${apiToken}`).toString('base64'),
},
});
const data = await response.json();
console.log(response.status, data);
<?php
$ch = curl_init('https://api.exotel.com/v2_beta/Accounts/<account_sid>/IncomingPhoneNumbers/<exophone_sid>');
curl_setopt($ch, CURLOPT_USERPWD, "<api_key>:<api_token>");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status . "\n" . $response;
?>
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
endpoint := "https://api.exotel.com/v2_beta/Accounts/<account_sid>/IncomingPhoneNumbers/<exophone_sid>"
req, err := http.NewRequest("DELETE", endpoint, nil)
if err != nil {
panic(err)
}
req.SetBasicAuth("<api_key>", "<api_token>")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
respBody, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(respBody))
}
Response
{
"Status": 202,
"Message": "Accepted"
}
warning
Deleting an ExoPhone is permanent. The number will be released and may be reassigned to another account. Ensure no active flows or campaigns are using this number before deleting.
HTTP Status Codes
| Code | Description |
|---|---|
202 | Request accepted, ExoPhone will be released |
400 | Bad request |
404 | ExoPhone not found |