Check or reserve service-message balance
Halaman ini belum tersedia dalam Bahasa Indonesia. Menampilkan bahasa default (English).
Check or reserve service-message balance
https://api.cekat.ai/api/messages/lock-balanceReturns the billing details for sending one free-form WhatsApp message in a conversation and, on prepaid credit-line inboxes, reserves the cost against message_id.
POST /messages/whatsapp already does this for you, so you only need this endpoint if you send WhatsApp messages through your own integration and bill through Cekat.
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.
Response
Billing details for the message.
A field is missing or invalid, the conversation is not on WhatsApp, or there isn't 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 conversation 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/messages/lock-balance' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}'
const response = await fetch('https://api.cekat.ai/api/messages/lock-balance', {
method: 'POST',
headers: { 'api_key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.cekat.ai/api/messages/lock-balance"
headers = {"api_key": "YOUR_API_KEY"}
payload = {
"message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"conversation_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/messages/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',
'conversation_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"success": true,
"data": {}
}
{
"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>"
}