Purchase phone number
curl --request POST \
--url https://app.botrep.ai/api/user/phone-numbers/purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>"
}
'import requests
url = "https://app.botrep.ai/api/user/phone-numbers/purchase"
payload = { "phone_number": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone_number: '<string>'})
};
fetch('https://app.botrep.ai/api/user/phone-numbers/purchase', 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://app.botrep.ai/api/user/phone-numbers/purchase",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.botrep.ai/api/user/phone-numbers/purchase"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.botrep.ai/api/user/phone-numbers/purchase")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.botrep.ai/api/user/phone-numbers/purchase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Phone number purchased successfully.",
"data": {
"id": 123,
"phone_number": "+14155551234",
"country_code": "US",
"type": "normal",
"sms_capable": true
}
}
{
"error": "This phone number is already in use."
}
{
"error": "This phone number is not available for purchase. Please search for available numbers first."
}
{
"error": "No payment method found. Please add a payment method to your account."
}
{
"error": "Payment failed. Please update your payment method."
}
{
"error": "Unable to parse phone number. Please provide a valid E.164 format number."
}
{
"error": "Failed to purchase phone number from provider. Please contact support."
}
Phone Numbers
Purchase phone number
Purchase a dedicated phone number
POST
/
user
/
phone-numbers
/
purchase
Purchase phone number
curl --request POST \
--url https://app.botrep.ai/api/user/phone-numbers/purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>"
}
'import requests
url = "https://app.botrep.ai/api/user/phone-numbers/purchase"
payload = { "phone_number": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone_number: '<string>'})
};
fetch('https://app.botrep.ai/api/user/phone-numbers/purchase', 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://app.botrep.ai/api/user/phone-numbers/purchase",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone_number' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.botrep.ai/api/user/phone-numbers/purchase"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.botrep.ai/api/user/phone-numbers/purchase")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.botrep.ai/api/user/phone-numbers/purchase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Phone number purchased successfully.",
"data": {
"id": 123,
"phone_number": "+14155551234",
"country_code": "US",
"type": "normal",
"sms_capable": true
}
}
{
"error": "This phone number is already in use."
}
{
"error": "This phone number is not available for purchase. Please search for available numbers first."
}
{
"error": "No payment method found. Please add a payment method to your account."
}
{
"error": "Payment failed. Please update your payment method."
}
{
"error": "Unable to parse phone number. Please provide a valid E.164 format number."
}
{
"error": "Failed to purchase phone number from provider. Please contact support."
}
This endpoint allows you to purchase a phone number that was found using the search endpoint. The platform automatically handles pricing, billing, and provisioning.
You must have a valid payment method on file before purchasing a phone number. The purchase creates a monthly subscription that will auto-renew.
Request Body
The phone number to purchase in E.164 format (e.g., +14155551234). Must be a number returned from the search endpoint.
Response
Success message
The purchased phone number details
{
"message": "Phone number purchased successfully.",
"data": {
"id": 123,
"phone_number": "+14155551234",
"country_code": "US",
"type": "normal",
"sms_capable": true
}
}
{
"error": "This phone number is already in use."
}
{
"error": "This phone number is not available for purchase. Please search for available numbers first."
}
{
"error": "No payment method found. Please add a payment method to your account."
}
{
"error": "Payment failed. Please update your payment method."
}
{
"error": "Unable to parse phone number. Please provide a valid E.164 format number."
}
{
"error": "Failed to purchase phone number from provider. Please contact support."
}
How It Works
- Search - First use the search endpoint to find available numbers
- Purchase - Submit the phone number you want to this endpoint
- Automatic Processing - The platform:
- Validates the number is still available
- Determines the correct pricing based on country
- Creates a monthly subscription on your payment method
- Provisions the number with our telephony provider
- Creates the phone number record in your account
Phone number purchases are non-refundable. The subscription will continue until you release the number.
⌘I

