POST Flash Call
This endpoint is used to initiate a flash call. The Flash Call triggers a verification call to a phone number. The system generates a unique caller ID and initiates a call that will end automatically before the recipient answers, leaving the caller ID visible for verification purposes.
Configure the API Endpoint
https://api.betatel.com/api/v1/connect-hub/call/flash
- Method:
POST
Set Up the Headers
Param | Value | Description |
---|---|---|
Content-type | application/json | Specifies the payload format. |
x-api-key | {{x-api-key}} | API key for authorization. |
x-user-id | {{x-user-id}} | User identifier for added security and tracking. |
Craft the Request Body
Design the JSON payload to include the call type, recipient number, and optional parameters.
Example of body
{
"callType": "flash",
"callee": "38761444555",
"maxRingTime": 5
}
Field | Type | Required | Description |
---|---|---|---|
callType | string | Yes | Type of call to be initiated ("flash"). |
callee | string | Yes | The number to which the call will be made. |
caller | string | No | The caller ID (the number that makes the call) is used as a verification token. |
maxRingTime | integer | No | Maximum ring time for the call (default: 5). |
Code Snippets
- cUrl
- Python
- Node.js
- PHP
- Java
- C#
Example - cURL
curl --location 'https://api.betatel.com/api/v1/connect-hub/call/flash' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-user-id: YOUR_USER_ID' \
--data '{
"callType":"flash",
"callee":"38761444555",
"maxRingTime": 5
}'
Example - Python
import http.client
import json
conn = http.client.HTTPSConnection("api.betatel.com")
payload = json.dumps({
"callType": "flash",
"callee": "38761444555",
"maxRingTime": 5
})
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-user-id': 'YOUR_USER_ID'
}
conn.request("POST", "/api/v1/connect-hub/call/flash", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example - Node.js
const axios = require('axios');
let data = JSON.stringify({
"callType": "flash",
"callee": "38761444555",
"maxRingTime": 5
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.betatel.com/api/v1/connect-hub/call/flash',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY',
'x-user-id': 'YOUR_USER_ID'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Example - PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.betatel.com/api/v1/connect-hub/call/flash',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{"callType":"flash", "callee":"38761444555", "maxRingTime": 5}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'x-api-key: YOUR_API_KEY',
'x-user-id: YOUR_USER_ID'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Example - Java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.betatel.com/api/v1/connect-hub/call/flash")
.header("Content-Type", "application/json")
.header("x-api-key", "YOUR_API_KEY")
.header("x-user-id", "YOUR_USER_ID")
.body("{\"callType\":\"flash\", \"callee\":\"38761444555\", \"maxRingTime\": 5}")
.asString();
Example - C#
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.betatel.com/api/v1/connect-hub/call/flash");
request.Headers.Add("x-api-key", "YOUR_API_KEY");
request.Headers.Add("x-user-id", "YOUR_USER_ID");
var content = new StringContent("{\"callType\":\"flash\", \"callee\":\"38761444555\", \"maxRingTime\": 5}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Understanding the Response
Once the API processes your request, it returns a response containing the unique identifier for the flash call and call details.
JSON Schema:
{
"uuid": "01JV5V54KPYK9GB29265EQRZ2P",
"caller": "96530165239",
"callee": "38761444555"
}
uuid
: The unique identifier for the flash call.caller
: The caller ID displayed to the recipient.callee
: The recipient's phone number.
Error Handling
- 400 - Bad Request: Invalid parameters or malformed request
- 401 - Unauthorized: Authentication failed
- 500 - Internal Server Error: An unexpected error occurred on the server