Obter números de telefone disponíveis
curl --request GET \
--url https://app.mayahub.ai/api/user/assistants/phone-numbers \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.mayahub.ai/api/user/assistants/phone-numbers"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.mayahub.ai/api/user/assistants/phone-numbers', 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.mayahub.ai/api/user/assistants/phone-numbers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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"
"net/http"
"io"
)
func main() {
url := "https://app.mayahub.ai/api/user/assistants/phone-numbers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.mayahub.ai/api/user/assistants/phone-numbers")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.mayahub.ai/api/user/assistants/phone-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": 45,
"phone_number": "+1234567890",
"country_code": "US",
"type_label": "Normal",
"is_available": true
},
{
"id": 46,
"phone_number": "+1234567891",
"country_code": "US",
"type_label": "SIP",
"is_available": false
},
{
"id": 47,
"phone_number": "+441234567890",
"country_code": "GB",
"type_label": "Caller ID",
"is_available": true
}
]
Assistentes
Obter números de telefone disponíveis
Recuperar todos os números de telefone disponíveis para atribuição a assistentes
GET
/
user
/
assistants
/
phone-numbers
Obter números de telefone disponíveis
curl --request GET \
--url https://app.mayahub.ai/api/user/assistants/phone-numbers \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.mayahub.ai/api/user/assistants/phone-numbers"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.mayahub.ai/api/user/assistants/phone-numbers', 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.mayahub.ai/api/user/assistants/phone-numbers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <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"
"net/http"
"io"
)
func main() {
url := "https://app.mayahub.ai/api/user/assistants/phone-numbers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.mayahub.ai/api/user/assistants/phone-numbers")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.mayahub.ai/api/user/assistants/phone-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": 45,
"phone_number": "+1234567890",
"country_code": "US",
"type_label": "Normal",
"is_available": true
},
{
"id": 46,
"phone_number": "+1234567891",
"country_code": "US",
"type_label": "SIP",
"is_available": false
},
{
"id": 47,
"phone_number": "+441234567890",
"country_code": "GB",
"type_label": "Caller ID",
"is_available": true
}
]
Este endpoint retorna uma lista de números de telefone pertencentes ao usuário autenticado que podem ser atribuídos a assistentes, com filtragem opcional por tipo de assistente.
Parâmetros de consulta
string
Filtrar números de telefone pelo tipo de assistente. Opções: inbound, outbound
Campos de resposta
array
Show Propriedades
Show Propriedades
integer
O identificador único do número de telefone
string
O número de telefone no formato E.164
string
O código do país do número de telefone
string
O rótulo de tipo legível para o número de telefone
boolean
Se o número de telefone está disponível para atribuição (não está atualmente atribuído a um assistente inbound)
[
{
"id": 45,
"phone_number": "+1234567890",
"country_code": "US",
"type_label": "Normal",
"is_available": true
},
{
"id": 46,
"phone_number": "+1234567891",
"country_code": "US",
"type_label": "SIP",
"is_available": false
},
{
"id": 47,
"phone_number": "+441234567890",
"country_code": "GB",
"type_label": "Caller ID",
"is_available": true
}
]
Observações
- Apenas números de telefone pertencentes ao usuário autenticado são retornados.
- Quando type=inbound é especificado, números de identificação de chamadas (caller ID) e números já atribuídos são filtrados.
- O campo is_available indica se o número pode ser atribuído a um novo assistente inbound.
- Números de telefone são retornados no formato de coleção values (array indexado).
- Utilize o campo id ao atribuir números de telefone a assistentes.

