Check or reserve template-message balance
このページは 日本語 ではまだ利用できません。デフォルトの言語 (English) で表示しています。
Check or reserve template-message balance
https://api.cekat.ai/api/templates/lock-balanceReturns the billing details for sending one template message to a phone number and, on prepaid credit-line inboxes, reserves the estimated cost against message_id.
POST /templates/send and campaigns already do this for you, so you only need this endpoint if you send templates through your own WhatsApp integration and bill through Cekat. Calling it with the same message_id again returns the existing reservation.
Authorization
Your Cekat API key, from Settings → Developers & API in the Cekat dashboard.
Alternative to api_key: send the same key as Bearer YOUR_API_KEY.
Body application/jsonrequired
Your unique ID for the message. The reservation is tied to it.
Recipient's number, digits only with country code. Used to price the message.
Optional conversation to bill against. Found from the phone number if left out.
Response
Billing details for the message.
Show child attributes
How the message is billed, for example credit_card or credit_line_prepaid.
True when balance was reserved for this message.
A required field is missing or invalid, or there is not enough balance.
Show child attributes
Request ID. Include it when contacting Cekat support.
The API key is missing or invalid.
Show child attributes
Request ID. Include it when contacting Cekat support.
The template or inbox was not found.
Show child attributes
Request ID. Include it when contacting Cekat support.
Rate limit exceeded. Wait and retry.
curl --request POST \
--url 'https://api.cekat.ai/api/templates/lock-balance' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number": "6281234567890",
"inbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wa_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}'
const response = await fetch('https://api.cekat.ai/api/templates/lock-balance', {
method: 'POST',
headers: { 'api_key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number": "6281234567890",
"inbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wa_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.cekat.ai/api/templates/lock-balance"
headers = {"api_key": "YOUR_API_KEY"}
payload = {
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number": "6281234567890",
"inbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wa_template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.cekat.ai/api/templates/lock-balance',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['api_key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'message_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'phone_number' => '6281234567890',
'inbox_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'wa_template_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"success": true,
"data": {
"billing_mode": "<string>",
"is_balance_locked": true,
"estimated_price": 10000,
"currency_code": "<string>",
"to_country_code": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_category": "<string>",
"inbox_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"wa_business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"billing_settlement_status": "<string>",
"billing_lock_reference_type": "<string>",
"billing_lock_reference_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"message": "<string>"
}