Chat
Send a customer message and get the AI employee's reply, with the business knowledge and rules applied.
POST/v1/chat
curl https://api.oryksa.com/v1/chat \
-H "Authorization: Bearer oryk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "Hi! What are your opening hours?"}'const res = await fetch("https://api.oryksa.com/v1/chat", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.ORYKSA_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ message: "Hi! What are your opening hours?" }),
});
const data = await res.json();
console.log(data.reply, data.conversation_id);import os, requests
r = requests.post(
"https://api.oryksa.com/v1/chat",
headers={"Authorization": f"Bearer {os.environ['ORYKSA_API_KEY']}"},
json={"message": "Hi! What are your opening hours?"},
timeout=60,
)
data = r.json()
print(data["reply"], data["conversation_id"])<?php
$ch = curl_init("https://api.oryksa.com/v1/chat");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ORYKSA_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(["message" => "Hi! What are your opening hours?"]),
]);
$data = json_decode(curl_exec($ch), true);
echo $data["reply"];import 'dart:convert';
import 'package:http/http.dart' as http;
final res = await http.post(
Uri.parse('https://api.oryksa.com/v1/chat'),
headers: {
'Authorization': 'Bearer $oryksaApiKey',
'Content-Type': 'application/json',
},
body: jsonEncode({'message': 'Hi! What are your opening hours?'}),
);
final data = jsonDecode(res.body);
print(data['reply']);val body = JSONObject(mapOf("message" to "Hi! What are your opening hours?")).toString()
val req = Request.Builder()
.url("https://api.oryksa.com/v1/chat")
.header("Authorization", "Bearer $oryksaApiKey")
.post(body.toRequestBody("application/json".toMediaType()))
.build()
OkHttpClient().newCall(req).execute().use { res ->
val data = JSONObject(res.body!!.string())
println(data.getString("reply"))
}var req = URLRequest(url: URL(string: "https://api.oryksa.com/v1/chat")!)
req.httpMethod = "POST"
req.setValue("Bearer \(oryksaApiKey)", forHTTPHeaderField: "Authorization")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
req.httpBody = try JSONSerialization.data(withJSONObject: ["message": "Hi! What are your opening hours?"])
let (data, _) = try await URLSession.shared.data(for: req)
let json = try JSONSerialization.jsonObject(with: data) as! [String: Any]
print(json["reply"] ?? "")Parameters
| Field | Type | Description |
|---|---|---|
message | string | Required. The customer's message, 1 to 2000 characters. |
conversation_id | string | Optional. Your id for this customer or thread (letters, digits, _ and -, max 64). Reuse it to keep the context. If omitted, a new id is created and returned. |
customer_name | string | Optional. Customer name, used by the agent to personalise replies. |
Response
{
"object": "chat_reply",
"conversation_id": "a073e8dba25845fe9153840e8bc787c8",
"status": "replied",
"reply": "We are open Monday to Friday, 9am to 7pm. Would you like to book a visit?"
}{
"object": "chat_reply",
"conversation_id": "a073e8dba25845fe9153840e8bc787c8",
"status": "pending",
"reply": null,
"hint": "The reply is still being generated. Read it with GET /v1/conversations/a073e8dba25845fe9153840e8bc787c8"
}Usually the reply arrives in 2 to 5 seconds and the API answers 200 with status: "replied". If the agent needs more than 40 seconds, the API answers 202 with status: "pending": read the reply later with GET /v1/conversations/{id} or receive it through the message.replied webhook.
Keeping the conversation
curl https://api.oryksa.com/v1/chat \
-H "Authorization: Bearer oryk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"conversation_id": "customer-4812",
"customer_name": "Ana",
"message": "Can I book for Saturday at 10am?"
}'await fetch("https://api.oryksa.com/v1/chat", {
method: "POST",
headers: { Authorization: "Bearer " + key, "Content-Type": "application/json" },
body: JSON.stringify({
conversation_id: "customer-4812", // your own id for this customer
customer_name: "Ana",
message: "Can I book for Saturday at 10am?",
}),
});requests.post(
"https://api.oryksa.com/v1/chat",
headers={"Authorization": f"Bearer {key}"},
json={
"conversation_id": "customer-4812", # your own id for this customer
"customer_name": "Ana",
"message": "Can I book for Saturday at 10am?",
},
)What the agent applies
The same engine as WhatsApp and the website chat: business profile, Brain knowledge, products, the owner's rules and safety guardrails, the message style and the plan limits. If the owner pauses the AI or turns it off for web channels, the API answers 503 agent_unavailable. Conversations created through the API show up in the owner's dashboard like any other chat.

