Check or reserve template-message balance

이 페이지는 아직 한국어 언어로 제공되지 않습니다. 기본 언어(English)로 표시합니다.

Check or reserve template-message balance

POSThttps://api.cekat.ai/api/templates/lock-balance

Returns 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

api_keystringheaderrequired

Your Cekat API key, from Settings → Developers & API in the Cekat dashboard.

Authorizationstringheader

Alternative to api_key: send the same key as Bearer YOUR_API_KEY.

Body application/jsonrequired

message_idstringrequired

Your unique ID for the message. The reservation is tied to it.

phone_numberstringrequired

Recipient's number, digits only with country code. Used to price the message.

inbox_idstring<uuid>required
wa_template_idstringrequired
conversation_idstring<uuid>

Optional conversation to bill against. Found from the phone number if left out.

Response

200
400
401
404
429

Billing details for the message.

successboolean
dataTemplateBilling
Show child attributes
billing_modestring

How the message is billed, for example credit_card or credit_line_prepaid.

is_balance_lockedboolean

True when balance was reserved for this message.

estimated_pricenumber
currency_codestring
to_country_codestring | null
template_idstring
template_categorystring
inbox_idstring<uuid>
wa_business_idstring | null
billing_settlement_statusstring | null
billing_lock_reference_typestring | null
billing_lock_reference_idstring | null

A required field is missing or invalid, or there is not enough balance.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

The API key is missing or invalid.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

The template or inbox was not found.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

Rate limit exceeded. Wait and retry.

messagestring
POST/api/templates/lock-balance
cURL
JavaScript
Python
PHP
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;
Response
200
400
401
404
429
{
  "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>"
}