Buy a phone number
curl --request POST \
--url https://api.getmalakai.com/callers/buy-phone-number \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-access-token: <x-access-token>' \
--data '
{
"phone_number": "<string>",
"address_sid": "<string>",
"bundle_sid": "<string>"
}
'import requests
url = "https://api.getmalakai.com/callers/buy-phone-number"
payload = {
"phone_number": "<string>",
"address_sid": "<string>",
"bundle_sid": "<string>"
}
headers = {
"Authorization": "<authorization>",
"x-access-token": "<x-access-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<authorization>',
'x-access-token': '<x-access-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({phone_number: '<string>', address_sid: '<string>', bundle_sid: '<string>'})
};
fetch('https://api.getmalakai.com/callers/buy-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.getmalakai.com/callers/buy-phone-number",
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>',
'address_sid' => '<string>',
'bundle_sid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-access-token: <x-access-token>"
],
]);
$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://api.getmalakai.com/callers/buy-phone-number"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\",\n \"address_sid\": \"<string>\",\n \"bundle_sid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("x-access-token", "<x-access-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://api.getmalakai.com/callers/buy-phone-number")
.header("Authorization", "<authorization>")
.header("x-access-token", "<x-access-token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\",\n \"address_sid\": \"<string>\",\n \"bundle_sid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmalakai.com/callers/buy-phone-number")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["x-access-token"] = '<x-access-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"<string>\",\n \"address_sid\": \"<string>\",\n \"bundle_sid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": [
{}
]
}Callers
Buy a phone number
Buy a phone number to call from
POST
callers
/
buy-phone-number
Buy a phone number
curl --request POST \
--url https://api.getmalakai.com/callers/buy-phone-number \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--header 'x-access-token: <x-access-token>' \
--data '
{
"phone_number": "<string>",
"address_sid": "<string>",
"bundle_sid": "<string>"
}
'import requests
url = "https://api.getmalakai.com/callers/buy-phone-number"
payload = {
"phone_number": "<string>",
"address_sid": "<string>",
"bundle_sid": "<string>"
}
headers = {
"Authorization": "<authorization>",
"x-access-token": "<x-access-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<authorization>',
'x-access-token': '<x-access-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({phone_number: '<string>', address_sid: '<string>', bundle_sid: '<string>'})
};
fetch('https://api.getmalakai.com/callers/buy-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.getmalakai.com/callers/buy-phone-number",
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>',
'address_sid' => '<string>',
'bundle_sid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json",
"x-access-token: <x-access-token>"
],
]);
$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://api.getmalakai.com/callers/buy-phone-number"
payload := strings.NewReader("{\n \"phone_number\": \"<string>\",\n \"address_sid\": \"<string>\",\n \"bundle_sid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("x-access-token", "<x-access-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://api.getmalakai.com/callers/buy-phone-number")
.header("Authorization", "<authorization>")
.header("x-access-token", "<x-access-token>")
.header("Content-Type", "application/json")
.body("{\n \"phone_number\": \"<string>\",\n \"address_sid\": \"<string>\",\n \"bundle_sid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getmalakai.com/callers/buy-phone-number")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["x-access-token"] = '<x-access-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone_number\": \"<string>\",\n \"address_sid\": \"<string>\",\n \"bundle_sid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": [
{}
]
}Headers
string
required
Your API key for authentication. Prefix with
Bearer .string
required
Your access token for authentication.
Body
The request body must contain aphone_number.
string
required
The phone number to be bought.
string
The geographical prefix for the number to be bought. This can be fetched from the GetTwilioAddress api (only in the case of UK number)
string
The bundle sid that can be fetched from GetTwilioBundle api (only in the case of UK number)
Request Example
{
"phone_number": "+17123123123",
"address_sid": "",
"bundle_sid": ""
}
Response
string
Status of the request in the form of a short message.
object[]
Information related to the phone number returned
⌘I