curl --request POST \
--url https://api.brilo.ai/v1/agent/onboarding/poll \
--header 'Content-Type: application/json' \
--data '
{
"device_code": "<string>"
}
'import requests
url = "https://api.brilo.ai/v1/agent/onboarding/poll"
payload = { "device_code": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({device_code: '<string>'})
};
fetch('https://api.brilo.ai/v1/agent/onboarding/poll', 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.brilo.ai/v1/agent/onboarding/poll",
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([
'device_code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.brilo.ai/v1/agent/onboarding/poll"
payload := strings.NewReader("{\n \"device_code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.brilo.ai/v1/agent/onboarding/poll")
.header("Content-Type", "application/json")
.body("{\n \"device_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brilo.ai/v1/agent/onboarding/poll")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"device_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCheck whether the user has finished, and collect the API key
Call this every interval seconds with the device_code from /start.
status is one of: pending (they have not finished yet), payment_failed (card declined, the same code still works), approved or provisioning (paid, the number is being set up), completed (done — this response carries api_key, phone_number and agent_id), denied, expired or failed (stop polling).
Every response says what it means and what to do next, in message and action. The API key is only ever returned on completed: before then there is no phone number behind it.
Polling faster than interval returns 429 with code: slow_down and retry_after (also sent as a Retry-After header). Wait that long, then poll again.
curl --request POST \
--url https://api.brilo.ai/v1/agent/onboarding/poll \
--header 'Content-Type: application/json' \
--data '
{
"device_code": "<string>"
}
'import requests
url = "https://api.brilo.ai/v1/agent/onboarding/poll"
payload = { "device_code": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({device_code: '<string>'})
};
fetch('https://api.brilo.ai/v1/agent/onboarding/poll', 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.brilo.ai/v1/agent/onboarding/poll",
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([
'device_code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://api.brilo.ai/v1/agent/onboarding/poll"
payload := strings.NewReader("{\n \"device_code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.brilo.ai/v1/agent/onboarding/poll")
.header("Content-Type", "application/json")
.body("{\n \"device_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.brilo.ai/v1/agent/onboarding/poll")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"device_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyBody
The device_code returned by /start. Send it on every poll. It is a bearer secret: it is what collects the API key, so keep it on the machine that asked for it and never show it to the user — the short user_code is the one they read.
