JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const phoneNumber = await client.phoneNumbers.release('pn_01j9a43avnfqzbjfch6pygv1td');
console.log(phoneNumber.id);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
phone_number = client.phone_numbers.release(
"pn_01j9a43avnfqzbjfch6pygv1td",
)
print(phone_number.id)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
phoneNumber, err := client.PhoneNumbers.Release(context.TODO(), "pn_01j9a43avnfqzbjfch6pygv1td")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", phoneNumber.ID)
}
require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
phone_number = surge.phone_numbers.release("pn_01j9a43avnfqzbjfch6pygv1td")
puts(phone_number)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$phoneNumber = $client->phoneNumbers->release(
'pn_01j9a43avnfqzbjfch6pygv1td'
);
var_dump($phoneNumber);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request DELETE \
--url https://api.surge.app/phone_numbers/{id} \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.delete("https://api.surge.app/phone_numbers/{id}")
.header("Authorization", "Bearer <token>")
.asString();{
"campaign": {
"attachment_status": "attached",
"id": "cpn_01jjnn7s0zfx5tdcsxjfy93et2"
},
"campaign_id": "cpn_01jjnn7s0zfx5tdcsxjfy93et2",
"id": "pn_01jsjwe4d9fx3tpymgtg958d9w",
"name": "(801) 555-1234",
"number": "+18015551234",
"type": "local"
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Phone numbers
Release phone number
Releases a phone number from the account.
DELETE
/
phone_numbers
/
{id}
JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const phoneNumber = await client.phoneNumbers.release('pn_01j9a43avnfqzbjfch6pygv1td');
console.log(phoneNumber.id);import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
phone_number = client.phone_numbers.release(
"pn_01j9a43avnfqzbjfch6pygv1td",
)
print(phone_number.id)package main
import (
"context"
"fmt"
"github.com/stainless-sdks/surge-go"
"github.com/stainless-sdks/surge-go/option"
)
func main() {
client := surge.NewClient(
option.WithAPIKey("My API Key"),
)
phoneNumber, err := client.PhoneNumbers.Release(context.TODO(), "pn_01j9a43avnfqzbjfch6pygv1td")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", phoneNumber.ID)
}
require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
phone_number = surge.phone_numbers.release("pn_01j9a43avnfqzbjfch6pygv1td")
puts(phone_number)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Surge\Client;
use Surge\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API Key');
try {
$phoneNumber = $client->phoneNumbers->release(
'pn_01j9a43avnfqzbjfch6pygv1td'
);
var_dump($phoneNumber);
} catch (APIException $e) {
echo $e->getMessage();
}curl --request DELETE \
--url https://api.surge.app/phone_numbers/{id} \
--header 'Authorization: Bearer <token>'HttpResponse<String> response = Unirest.delete("https://api.surge.app/phone_numbers/{id}")
.header("Authorization", "Bearer <token>")
.asString();{
"campaign": {
"attachment_status": "attached",
"id": "cpn_01jjnn7s0zfx5tdcsxjfy93et2"
},
"campaign_id": "cpn_01jjnn7s0zfx5tdcsxjfy93et2",
"id": "pn_01jsjwe4d9fx3tpymgtg958d9w",
"name": "(801) 555-1234",
"number": "+18015551234",
"type": "local"
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the phone number to release.
Example:
"pn_01j9a43avnfqzbjfch6pygv1td"
Response
Released phone number
A phone number that can be used to send and receive messages and calls
Campaign attachment details for domestic local numbers, or null for other types of numbers and local numbers without a campaign
Show child attributes
Show child attributes
Example:
{
"attachment_status": "attached",
"id": "cpn_01jjnn7s0zfx5tdcsxjfy93et2"
}
Deprecated. The unique identifier of the campaign this phone number is attached to, if any
Unique identifier for the phone number
A human-readable name for the phone number
The phone number in E.164 format
Pattern:
^\+[1-9]\d{6,14}$Example:
"+18015551234"
Whether the phone number is local, toll-free, or short code
Available options:
local, short_code, toll_free