Generate an AI response (beta)
Halaman ini belum tersedia dalam Bahasa Indonesia. Menampilkan bahasa default (English).
Generate an AI response (beta)
https://api.cekat.ai/api/ai_response/betaRuns one of your AI agents on a chat history you provide and returns its reply, without sending anything to a contact. Use it to test an AI agent or to generate replies for your own channel.
The history must end with a message from the user. Each reply reports the AI credits it used. This endpoint is in beta and may change.
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
The chat history, oldest first. The last message must be from the user.
Show child attributes
user, assistantData the AI agent collected earlier in this chat. Send back the chat_data from the previous response to continue the same chat.
Response
The AI agent's reply.
The reply, plus system notes when the AI agent ran tools.
Show child attributes
assistant, systemAI credits used for this reply.
ai_agent_id is missing, messages is not an array, or there is no user message.
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.
Rate limit exceeded. Wait and retry.
The AI service is unavailable. Retry later.
Show child attributes
Request ID. Include it when contacting Cekat support.
curl --request POST \
--url 'https://api.cekat.ai/api/ai_response/beta' \
--header 'api_key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"messages": [
{
"role": "user",
"message": "<string>",
"created_at": "2026-01-15T09:30:00Z"
}
]
}'
const response = await fetch('https://api.cekat.ai/api/ai_response/beta', {
method: 'POST',
headers: { 'api_key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
"ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"messages": [
{
"role": "user",
"message": "<string>",
"created_at": "2026-01-15T09:30:00Z"
}
]
})
});
const data = await response.json();
console.log(data);
import requests
url = "https://api.cekat.ai/api/ai_response/beta"
headers = {"api_key": "YOUR_API_KEY"}
payload = {
"ai_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"messages": [
{
"role": "user",
"message": "<string>",
"created_at": "2026-01-15T09:30:00Z"
}
]
}
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/ai_response/beta',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['api_key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'ai_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'messages' => [[
'role' => 'user',
'message' => '<string>',
'created_at' => '2026-01-15T09:30:00Z'
]]
]),
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
{
"success": true,
"messages": [
{
"role": "assistant",
"content": "<string>",
"credits_used": 10000
}
],
"chat_data": {}
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}
{
"message": "<string>"
}
{
"success": true,
"message": "<string>",
"statusCode": 1,
"error": {
"message": "<string>"
},
"correlationId": "<string>"
}