Cancel a Reservation
Cancel an active phone number reservation. The reserved number will be released back to the available pool.
Endpoint
DELETE https://api.p.2chat.io/open/numbers/reservations/{uuid}
Authentication
Include your API key in the X-User-API-Key header. Learn more about authentication.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
uuid | string (path) | Yes | The reservation UUID (from the Reserve a Number or List Reservations endpoint) |
Invocation
- cURL
- Python
- JavaScript
- PHP
curl --location --request DELETE 'https://api.p.2chat.io/open/numbers/reservations/reservation-uuid-here' \
--header 'X-User-API-Key: your_api_key_here'
import requests
uuid = "reservation-uuid-here"
url = f"https://api.p.2chat.io/open/numbers/reservations/{uuid}"
headers = {
"X-User-API-Key": "your_api_key_here"
}
response = requests.delete(url, headers=headers)
print(response.json())
const axios = require('axios');
const uuid = 'reservation-uuid-here';
const response = await axios.delete(`https://api.p.2chat.io/open/numbers/reservations/${uuid}`, {
headers: {
'X-User-API-Key': 'your_api_key_here'
}
});
console.log(response.data);
<?php
$curl = curl_init();
$uuid = 'reservation-uuid-here';
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.p.2chat.io/open/numbers/reservations/$uuid",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => array(
'X-User-API-Key: your_api_key_here'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response
Success
{
"success": true,
"message": "Reservation reservation-uuid-here cancelled successfully"
}
Error
{
"success": false,
"error": true,
"error_message": "Description of what went wrong"
}