Check or reserve service-message balance

此页面暂无中文版本。显示默认语言(English)。

Check or reserve service-message balance

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

Returns 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

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_idstring<uuid>required

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

conversation_idstring<uuid>required

Response

200
400
401
404
429

Billing details for the message.

successboolean
dataobject

A field is missing or invalid, the conversation is not on WhatsApp, or there isn't 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 conversation 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/messages/lock-balance
cURL
JavaScript
Python
PHP
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;
Response
200
400
401
404
429
{
  "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>"
}