curl --request POST \
--url https://api.telegent.com/v1.0/subscriptions/thresholds/add \
--header 'Content-Type: application/json' \
--data '
{
"AccountId": "AID-1234567",
"ThresholdName": "80% Data Alert",
"ThresholdType": "Data",
"ThresholdAmount": 80,
"ThresholdUnit": "MB",
"ThresholdAction": "Alert"
}
'import requests
url = "https://api.telegent.com/v1.0/subscriptions/thresholds/add"
payload = {
"AccountId": "AID-1234567",
"ThresholdName": "80% Data Alert",
"ThresholdType": "Data",
"ThresholdAmount": 80,
"ThresholdUnit": "MB",
"ThresholdAction": "Alert"
}
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({
AccountId: 'AID-1234567',
ThresholdName: '80% Data Alert',
ThresholdType: 'Data',
ThresholdAmount: 80,
ThresholdUnit: 'MB',
ThresholdAction: 'Alert'
})
};
fetch('https://api.telegent.com/v1.0/subscriptions/thresholds/add', 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.telegent.com/v1.0/subscriptions/thresholds/add",
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([
'AccountId' => 'AID-1234567',
'ThresholdName' => '80% Data Alert',
'ThresholdType' => 'Data',
'ThresholdAmount' => 80,
'ThresholdUnit' => 'MB',
'ThresholdAction' => 'Alert'
]),
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.telegent.com/v1.0/subscriptions/thresholds/add"
payload := strings.NewReader("{\n \"AccountId\": \"AID-1234567\",\n \"ThresholdName\": \"80% Data Alert\",\n \"ThresholdType\": \"Data\",\n \"ThresholdAmount\": 80,\n \"ThresholdUnit\": \"MB\",\n \"ThresholdAction\": \"Alert\"\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.telegent.com/v1.0/subscriptions/thresholds/add")
.header("Content-Type", "application/json")
.body("{\n \"AccountId\": \"AID-1234567\",\n \"ThresholdName\": \"80% Data Alert\",\n \"ThresholdType\": \"Data\",\n \"ThresholdAmount\": 80,\n \"ThresholdUnit\": \"MB\",\n \"ThresholdAction\": \"Alert\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/subscriptions/thresholds/add")
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 \"AccountId\": \"AID-1234567\",\n \"ThresholdName\": \"80% Data Alert\",\n \"ThresholdType\": \"Data\",\n \"ThresholdAmount\": 80,\n \"ThresholdUnit\": \"MB\",\n \"ThresholdAction\": \"Alert\"\n}"
response = http.request(request)
puts response.read_body{
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"AccountId": "AID-1234567",
"ThresholdName": "80% Data Alert",
"ThresholdType": "Data",
"ThresholdAmount": 80,
"ThresholdUnit": "MB",
"ThresholdAction": "Alert",
"Active": true
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}Create Threshold
Create a new usage threshold that can be assigned to subscriptions. A threshold specifies a resource type, a trigger amount, and the action to take when that amount is reached — such as sending an alert or pausing service.
What this does: Returns the new ThresholdId and full threshold record. After creating a threshold, assign it to one or more subscriptions using POST /v1.0/subscriptions/thresholds/assignments/add.
Next steps:
- Assign the threshold to a subscription —
POST /v1.0/subscriptions/thresholds/assignments/add - View threshold details —
GET /v1.0/subscriptions/thresholds
curl --request POST \
--url https://api.telegent.com/v1.0/subscriptions/thresholds/add \
--header 'Content-Type: application/json' \
--data '
{
"AccountId": "AID-1234567",
"ThresholdName": "80% Data Alert",
"ThresholdType": "Data",
"ThresholdAmount": 80,
"ThresholdUnit": "MB",
"ThresholdAction": "Alert"
}
'import requests
url = "https://api.telegent.com/v1.0/subscriptions/thresholds/add"
payload = {
"AccountId": "AID-1234567",
"ThresholdName": "80% Data Alert",
"ThresholdType": "Data",
"ThresholdAmount": 80,
"ThresholdUnit": "MB",
"ThresholdAction": "Alert"
}
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({
AccountId: 'AID-1234567',
ThresholdName: '80% Data Alert',
ThresholdType: 'Data',
ThresholdAmount: 80,
ThresholdUnit: 'MB',
ThresholdAction: 'Alert'
})
};
fetch('https://api.telegent.com/v1.0/subscriptions/thresholds/add', 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.telegent.com/v1.0/subscriptions/thresholds/add",
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([
'AccountId' => 'AID-1234567',
'ThresholdName' => '80% Data Alert',
'ThresholdType' => 'Data',
'ThresholdAmount' => 80,
'ThresholdUnit' => 'MB',
'ThresholdAction' => 'Alert'
]),
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.telegent.com/v1.0/subscriptions/thresholds/add"
payload := strings.NewReader("{\n \"AccountId\": \"AID-1234567\",\n \"ThresholdName\": \"80% Data Alert\",\n \"ThresholdType\": \"Data\",\n \"ThresholdAmount\": 80,\n \"ThresholdUnit\": \"MB\",\n \"ThresholdAction\": \"Alert\"\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.telegent.com/v1.0/subscriptions/thresholds/add")
.header("Content-Type", "application/json")
.body("{\n \"AccountId\": \"AID-1234567\",\n \"ThresholdName\": \"80% Data Alert\",\n \"ThresholdType\": \"Data\",\n \"ThresholdAmount\": 80,\n \"ThresholdUnit\": \"MB\",\n \"ThresholdAction\": \"Alert\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telegent.com/v1.0/subscriptions/thresholds/add")
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 \"AccountId\": \"AID-1234567\",\n \"ThresholdName\": \"80% Data Alert\",\n \"ThresholdType\": \"Data\",\n \"ThresholdAmount\": 80,\n \"ThresholdUnit\": \"MB\",\n \"ThresholdAction\": \"Alert\"\n}"
response = http.request(request)
puts response.read_body{
"ThresholdId": "THID-a1b2c3d4-0000-0000-0000-000000000001",
"AccountId": "AID-1234567",
"ThresholdName": "80% Data Alert",
"ThresholdType": "Data",
"ThresholdAmount": 80,
"ThresholdUnit": "MB",
"ThresholdAction": "Alert",
"Active": true
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}{
"StatusCode": 123,
"Message": "<string>"
}Body
Threshold object
Your Telegent account identifier (AID-). Scopes the threshold to this account.
"AID-1234567"
Human-readable name for this threshold.
"80% Data Alert"
Resource the threshold applies to. Supported values: Data, SMS, Voice.
"Data"
Numeric limit at which the threshold triggers (e.g. 80 for 80 MB).
80
Unit of measurement for ThresholdAmount. Supported values: MB, GB, Count.
"MB"
Action taken when the threshold is reached. Supported values: Alert, Pause, Restrict.
"Alert"
Response
Success — returns the new threshold ID and record
The response is of type object.