Comprar número de telefone
curl --request POST \
--url https://suasofia.online/api/user/phone-numbers/purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>"
}
'import requests
url = "https://suasofia.online/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://suasofia.online/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://suasofia.online/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://suasofia.online/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://suasofia.online/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://suasofia.online/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": "Número de telefone comprado com sucesso.",
"data": {
"id": 123,
"phone_number": "+14155551234",
"country_code": "US",
"type": "normal",
"sms_capable": true
}
}
{
"error": "Este número de telefone já está em uso."
}
{
"error": "Este número de telefone não está disponível para compra. Pesquise primeiro por números disponíveis."
}
{
"error": "Nenhum método de pagamento encontrado. Adicione um método de pagamento à sua conta."
}
{
"error": "Falha no pagamento. Atualize seu método de pagamento."
}
{
"error": "Não foi possível analisar o número de telefone. Forneça um número no formato E.164 válido."
}
{
"error": "Falha ao comprar número de telefone do provedor. Entre em contato com o suporte."
}
Números de Telefone
Comprar número de telefone
Comprar um número de telefone dedicado
POST
/
user
/
phone-numbers
/
purchase
Comprar número de telefone
curl --request POST \
--url https://suasofia.online/api/user/phone-numbers/purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone_number": "<string>"
}
'import requests
url = "https://suasofia.online/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://suasofia.online/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://suasofia.online/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://suasofia.online/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://suasofia.online/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://suasofia.online/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": "Número de telefone comprado com sucesso.",
"data": {
"id": 123,
"phone_number": "+14155551234",
"country_code": "US",
"type": "normal",
"sms_capable": true
}
}
{
"error": "Este número de telefone já está em uso."
}
{
"error": "Este número de telefone não está disponível para compra. Pesquise primeiro por números disponíveis."
}
{
"error": "Nenhum método de pagamento encontrado. Adicione um método de pagamento à sua conta."
}
{
"error": "Falha no pagamento. Atualize seu método de pagamento."
}
{
"error": "Não foi possível analisar o número de telefone. Forneça um número no formato E.164 válido."
}
{
"error": "Falha ao comprar número de telefone do provedor. Entre em contato com o suporte."
}
Este endpoint permite que você compre um número de telefone que foi encontrado usando o endpoint de busca. A plataforma gerencia automaticamente preços, cobrança e provisionamento.
Você deve ter um método de pagamento válido registrado antes de comprar um número de telefone. A compra cria uma assinatura mensal que será renovada automaticamente.
Corpo da Requisição
string
required
O número de telefone a ser comprado no formato E.164 (ex: +14155551234). Deve ser um número retornado pelo endpoint de busca.
Resposta
string
Mensagem de sucesso
object
{
"message": "Número de telefone comprado com sucesso.",
"data": {
"id": 123,
"phone_number": "+14155551234",
"country_code": "US",
"type": "normal",
"sms_capable": true
}
}
{
"error": "Este número de telefone já está em uso."
}
{
"error": "Este número de telefone não está disponível para compra. Pesquise primeiro por números disponíveis."
}
{
"error": "Nenhum método de pagamento encontrado. Adicione um método de pagamento à sua conta."
}
{
"error": "Falha no pagamento. Atualize seu método de pagamento."
}
{
"error": "Não foi possível analisar o número de telefone. Forneça um número no formato E.164 válido."
}
{
"error": "Falha ao comprar número de telefone do provedor. Entre em contato com o suporte."
}
Como Funciona
- Buscar - Primeiro use o endpoint de busca para encontrar números disponíveis
- Comprar - Envie o número de telefone que você deseja para este endpoint
- Processamento Automático - A plataforma:
- Valida se o número ainda está disponível
- Determina o preço correto baseado no país
- Cria uma assinatura mensal no seu método de pagamento
- Provisiona o número com nosso provedor de telefonia
- Cria o registro do número de telefone na sua conta
Compras de números de telefone não são reembolsáveis. A assinatura continuará até você liberar o número.
⌘I

