OmniStream Docs
  • Panduan Pengguna
  • Developer
  • API Reference
Information
Auth
    Login with email and passwordpostGet current agent profilegetLogout (clears cookie)postIssue a fresh JWT for the current sessiongetRegister a new tenant organizationpost
Conversations
    List conversationsgetGet a single conversationgetAssign or unassign an agentpatchUpdate conversation statuspatchMark conversation as readpostExpire stale conversationspostUpdate conversation tagspatchTakeover a conversationpostBulk conversation actionspost
Messages
    List messages in a conversationgetSend an outbound messagepostSearch messages across conversationsget
Contacts
    List contactsgetGet a contact by IDgetUpdate a contactpatchList conversations for a contactget
Agents
    List all agentsgetCreate a new agentpostGet an agent by IDgetDelete an agentdeleteUpdate an agentpatchToggle agent online/offline statuspatch
Notes
    List notes for a conversationgetCreate a notepostDelete a notedeleteUpdate a notepatch
Quick Replies
    List all quick repliesgetCreate a quick replypostDelete a quick replydeleteUpdate a quick replypatchExport quick replies as CSVgetImport quick replies from CSVpostRecord usage of a quick replypostAdd quick reply to favoritespostRemove quick reply from favoritesdelete
Analytics
    Dashboard overview KPIsgetConversation and message trendsgetPer-agent workload metricsgetPer-channel metricsgetCSAT analyticsgetWhatsApp message analyticsgetWhatsApp conversation analyticsgetWhatsApp template analyticsget
Media
    Upload a media filepostDownload or proxy a media filegetUpload a file to S3/MinIOpost
Divisions
    List divisionsgetCreate a divisionpostGet a division with agentsgetDelete a divisiondeleteUpdate a divisionpatchList agents in a divisiongetAssign agents to a divisionpostRemove agents from a divisiondelete
Transfers
    Transfer a conversationpostList transfer history for a conversationget
Scheduled Messages
    Schedule a message for future deliverypostList scheduled messages for a conversationgetCancel a scheduled messagedelete
CSAT
    Get CSAT survey for a conversationgetCreate a CSAT survey for a conversationpostSubmit a CSAT ratingpatchCSAT analyticsget
SLA
    List SLA policiesgetCreate an SLA policypostDelete an SLA policydeleteUpdate an SLA policypatchList SLA breaches for a policygetGet SLA status for a conversationget
Outgoing Webhooks
    List outgoing webhooksgetCreate an outgoing webhookpostList available webhook event typesgetDelete an outgoing webhookdeleteUpdate an outgoing webhookpatchList deliveries for a webhookgetSend a test event to the webhookpost
Campaigns
    List campaignsgetCreate a new campaign (draft)postGet a campaigngetDelete a draft campaigndeleteUpdate a draft campaignpatchList campaign recipientsgetAdd recipients to a campaignpostClear all recipients from a campaigndeleteSend or schedule a campaignpostCancel a campaignpost
Integrations
    List all channel integrationsgetGet a single integration by channelgetCreate or update an integration (upsert)putDelete an integrationdeleteList integration accountsgetCreate an integration accountpostGet an integration account by IDgetDelete an integration accountdeleteUpdate an integration accountpatchSet an integration account as the default for its channelpostFetch WhatsApp account health from Meta Graph APIgetGet WhatsApp Embedded Signup configgetComplete WhatsApp Embedded SignuppostGet Instagram OAuth app configgetConnect Instagram account via OAuthpostGet Messenger OAuth app configgetConnect Messenger via Facebook Login OAuthpostSubscribe selected Facebook Pages to Messenger webhookspostDisconnect a Messenger pagepostGet Messenger persistent menugetSet or delete Messenger persistent menupost
Activity Logs
    List activity logsget
WA Templates
    List WhatsApp message templatesgetCreate a WhatsApp message templatepostSync templates from MetapostGet a WhatsApp template by IDgetDelete a WhatsApp template (local only)deleteUpdate template header media URLpatch
Webhooks
    Meta webhook verificationgetReceive Meta webhook (WhatsApp + Instagram)postReceive inbound email webhookpostMeta webhook verification for MessengergetReceive Messenger inbound webhook eventspostMeta webhook verification for InstagramgetReceive Instagram inbound webhook eventspost
Roles
    List all roles with permissionsgetCreate a custom rolepostGet a single role with permissionsgetDelete a custom roledeleteUpdate a rolepatchList all available permissionsget
API Keys
    List caller's API keysgetCreate a new API keypostRevoke an API keydelete
Health
    API Gateway health checkget
Automation
    List automation rulesgetCreate an automation rulepostList snoozed automation rulesgetSnooze multiple automation rulespostAutomation stats overviewgetAutomation stats time seriesgetAutomation alert statsgetDry-run an automation rule against a test payloadpostGet an automation rule by IDgetDelete an automation ruledeleteUpdate an automation rulepatchToggle automation rule active statepostSnooze an automation rule until a given timepostUnsnooze an automation rulepostGet stats for a specific automation rulegetGet time series stats for a specific automation rulegetGet the effective state of an automation rulegetUpdate alert settings for an automation rulepatchUpdate schedule settings for an automation rulepatchUpdate rollout percentage for an automation rulepatchPreview upcoming schedule windows for an automation rulegetGet global automation control stategetUpdate global automation control statepatchList automation rule runsgetExport automation runs as CSVgetList automation runs for a specific rulegetList automation runs for a specific eventgetGet a single automation run by IDgetGet replay context for an automation rungetList automation event queue itemsgetAutomation event queue statsgetExport automation events as CSVgetRetry all failed automation eventspostClean up old failed automation eventspostList automation events for a conversationgetList automation events for a rulegetList automation events by payload fingerprintgetGet a single automation event by IDgetRetry a single automation eventpostReprocess an automation event with the current rule setpostGet automation worker metricsget
Chat Expiration
    List chat expiration rulesgetUpsert a chat expiration rule for a channelput
AI Agents
    List all AI agentsgetCreate a new AI agentpostGet an AI agent by IDgetUpdate an AI agentputDelete an AI agentdeleteToggle AI agent active stateputList AI agent assignmentsgetCreate an AI agent assignmentpostUpdate an AI agent assignmentputDelete an AI agent assignmentdeleteList handoff rules for an AI agentgetCreate a handoff rulepostUpdate a handoff ruleputDelete a handoff ruledeleteGet daily usage stats for an AI agentgetList knowledge sources for an AI agentgetAdd a knowledge sourcepostDelete a knowledge sourcedeleteReprocess a knowledge sourcepostList QnA pairs for a knowledge sourcegetAdd a QnA pairpostDelete a QnA pairdeleteList products for an AI agentgetCreate a productpostBulk import productspostUpdate a productputDelete a productdeleteList orchestration rulesgetCreate an orchestration rulepostUpdate an orchestration ruleputDelete an orchestration ruledeleteList evaluations for an AI agentgetCreate an AI response evaluationpostUpdate an AI evaluationputDelete an AI evaluationdeleteGet aggregated AI usage summarygetSend a test message to an AI agentpost
Working Hours
    List global working hoursgetUpsert global working hoursputList division working hoursgetUpsert division working hours overrideputDelete division working hours overridedeleteGet tenant timezonegetUpdate tenant timezoneputCheck working hours status (public)get
Super Admin
    Super-admin loginpostList all tenant organizationsgetProvision a new tenantpostGet a tenant organizationgetSuspend a tenant organizationdeleteUpdate a tenant organizationpatchImpersonate a tenant adminpostList all tenants with usage statisticsgetSystem health checkgetList super-admin accountsgetCreate a super-admin accountpostDelete a super-admin accountdeleteReset a super-admin's passwordpostList tenant usersgetReset a tenant user's passwordpostSuspend a tenant userpostActivate a tenant userpostImpersonate a tenant userpost
Billing Admin
    List all billing plansgetCreate a billing planpostGet a billing plan by IDgetDelete a billing plandeleteUpdate a billing planpatchList all couponsgetCreate a couponpostDelete a coupondeleteUpdate a couponpatchList all add-onsgetCreate an add-onpostDelete an add-ondeleteUpdate an add-onpatchCombined analytics dashboardgetMonthly recurring revenue summarygetRevenue breakdown by plangetMonthly revenue over time (last 12 months)getChurn metrics for current monthgetRefund an invoicepost
Billing
    Get current subscription and plangetList available billing plansgetSubscribe to a planpostUpgrade or downgrade subscription planpostCancel subscriptionpostGet current month's usagegetList invoicesgetDownload invoice PDFgetList payment methodsgetAdd a payment methodpostDelete a payment methoddeleteValidate a coupon codepostList available add-onsgetList attached add-onsgetAttach an add-on to subscriptionpostDetach an add-on from subscriptiondelete
Schemas
OmniStream CRM API
OmniStream CRM API

AI Agents

Endpoint

AI agent configuration, assignments, handoff rules, knowledge, products, orchestration, evaluations, and testing


List all AI agents

GET
https://api-chat.bara.my.id
/api/ai-agents

List all AI agents › Responses

200

Array of AI agents

​object[]
id
​string · uuid · required
name
​string · required
system_prompt
​string · required
model
​string · required
temperature
​number · double · required
max_tokens
​integer · required
is_active
​boolean · required
created_at
​string · date-time · required
updated_at
​string · date-time · required
welcome_message
​string
parent_agent_id
​string · uuid
daily_token_limit
​integer
max_conversation_turns
​integer
GET/api/ai-agents
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents
Example Responses
[ { "id": "00000000-0000-0000-0000-000000000000", "name": "name", "system_prompt": "system_prompt", "model": "model", "temperature": 0, "max_tokens": 0, "welcome_message": "welcome_message", "is_active": true, "parent_agent_id": "00000000-0000-0000-0000-000000000000", "daily_token_limit": 0, "max_conversation_turns": 0, "created_at": "2024-08-25T15:00:00Z", "updated_at": "2024-08-25T15:00:00Z" } ]
application/json

Create a new AI agent

POST
https://api-chat.bara.my.id
/api/ai-agents

Requires settings.manage permission.

Create a new AI agent › Request Body

name
​string · required
system_prompt
​string
model
​string
temperature
​number · double
max_tokens
​integer
welcome_message
​string
parent_agent_id
​string · uuid
daily_token_limit
​integer
max_conversation_turns
​integer

Create a new AI agent › Responses

Created AI agent

id
​string · uuid · required
name
​string · required
system_prompt
​string · required
model
​string · required
temperature
​number · double · required
max_tokens
​integer · required
is_active
​boolean · required
created_at
​string · date-time · required
updated_at
​string · date-time · required
welcome_message
​string
parent_agent_id
​string · uuid
daily_token_limit
​integer
max_conversation_turns
​integer
POST/api/ai-agents
curl --request POST \ --url https://api-chat.bara.my.id/api/ai-agents \ --header 'Content-Type: application/json' \ --data ' { "name": "name", "system_prompt": "system_prompt", "model": "model", "temperature": 0, "max_tokens": 0, "welcome_message": "welcome_message", "parent_agent_id": "00000000-0000-0000-0000-000000000000", "daily_token_limit": 0, "max_conversation_turns": 0 } '
Example Request Body
{
  "name": "name",
  "system_prompt": "system_prompt",
  "model": "model",
  "temperature": 0,
  "max_tokens": 0,
  "welcome_message": "welcome_message",
  "parent_agent_id": "00000000-0000-0000-0000-000000000000",
  "daily_token_limit": 0,
  "max_conversation_turns": 0
}
Example Responses
{ "id": "00000000-0000-0000-0000-000000000000", "name": "name", "system_prompt": "system_prompt", "model": "model", "temperature": 0, "max_tokens": 0, "welcome_message": "welcome_message", "is_active": true, "parent_agent_id": "00000000-0000-0000-0000-000000000000", "daily_token_limit": 0, "max_conversation_turns": 0, "created_at": "2024-08-25T15:00:00Z", "updated_at": "2024-08-25T15:00:00Z" }
application/json

Get an AI agent by ID

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}

Get an AI agent by ID › path Parameters

id
​string · uuid · required

Get an AI agent by ID › Responses

AI agent details

id
​string · uuid · required
name
​string · required
system_prompt
​string · required
model
​string · required
temperature
​number · double · required
max_tokens
​integer · required
is_active
​boolean · required
created_at
​string · date-time · required
updated_at
​string · date-time · required
welcome_message
​string
parent_agent_id
​string · uuid
daily_token_limit
​integer
max_conversation_turns
​integer
GET/api/ai-agents/{id}
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id
Example Responses
{ "id": "00000000-0000-0000-0000-000000000000", "name": "name", "system_prompt": "system_prompt", "model": "model", "temperature": 0, "max_tokens": 0, "welcome_message": "welcome_message", "is_active": true, "parent_agent_id": "00000000-0000-0000-0000-000000000000", "daily_token_limit": 0, "max_conversation_turns": 0, "created_at": "2024-08-25T15:00:00Z", "updated_at": "2024-08-25T15:00:00Z" }
application/json

Update an AI agent

PUT
https://api-chat.bara.my.id
/api/ai-agents/{id}

Requires settings.manage permission.

Update an AI agent › path Parameters

id
​string · uuid · required

Update an AI agent › Request Body

name
​string
system_prompt
​string
model
​string
temperature
​number · double
max_tokens
​integer
welcome_message
​string
is_active
​boolean
parent_agent_id
​string · uuid
daily_token_limit
​integer
max_conversation_turns
​integer

Update an AI agent › Responses

Updated AI agent

id
​string · uuid · required
name
​string · required
system_prompt
​string · required
model
​string · required
temperature
​number · double · required
max_tokens
​integer · required
is_active
​boolean · required
created_at
​string · date-time · required
updated_at
​string · date-time · required
welcome_message
​string
parent_agent_id
​string · uuid
daily_token_limit
​integer
max_conversation_turns
​integer
PUT/api/ai-agents/{id}
curl --request PUT \ --url https://api-chat.bara.my.id/api/ai-agents/:id \ --header 'Content-Type: application/json' \ --data ' { "name": "name", "system_prompt": "system_prompt", "model": "model", "temperature": 0, "max_tokens": 0, "welcome_message": "welcome_message", "is_active": true, "parent_agent_id": "00000000-0000-0000-0000-000000000000", "daily_token_limit": 0, "max_conversation_turns": 0 } '
Example Request Body
{
  "name": "name",
  "system_prompt": "system_prompt",
  "model": "model",
  "temperature": 0,
  "max_tokens": 0,
  "welcome_message": "welcome_message",
  "is_active": true,
  "parent_agent_id": "00000000-0000-0000-0000-000000000000",
  "daily_token_limit": 0,
  "max_conversation_turns": 0
}
Example Responses
{ "id": "00000000-0000-0000-0000-000000000000", "name": "name", "system_prompt": "system_prompt", "model": "model", "temperature": 0, "max_tokens": 0, "welcome_message": "welcome_message", "is_active": true, "parent_agent_id": "00000000-0000-0000-0000-000000000000", "daily_token_limit": 0, "max_conversation_turns": 0, "created_at": "2024-08-25T15:00:00Z", "updated_at": "2024-08-25T15:00:00Z" }
application/json

Delete an AI agent

DELETE
https://api-chat.bara.my.id
/api/ai-agents/{id}

Requires settings.manage permission.

Delete an AI agent › path Parameters

id
​string · uuid · required

Delete an AI agent › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai-agents/{id}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai-agents/:id
Example Responses
{
  "deleted": true
}
application/json

Toggle AI agent active state

PUT
https://api-chat.bara.my.id
/api/ai-agents/{id}/toggle

Flips is_active to the opposite value. Requires settings.manage permission.

Toggle AI agent active state › path Parameters

id
​string · uuid · required

Toggle AI agent active state › Responses

Updated AI agent with toggled state

id
​string · uuid · required
name
​string · required
system_prompt
​string · required
model
​string · required
temperature
​number · double · required
max_tokens
​integer · required
is_active
​boolean · required
created_at
​string · date-time · required
updated_at
​string · date-time · required
welcome_message
​string
parent_agent_id
​string · uuid
daily_token_limit
​integer
max_conversation_turns
​integer
PUT/api/ai-agents/{id}/toggle
curl --request PUT \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/toggle
Example Responses
{ "id": "00000000-0000-0000-0000-000000000000", "name": "name", "system_prompt": "system_prompt", "model": "model", "temperature": 0, "max_tokens": 0, "welcome_message": "welcome_message", "is_active": true, "parent_agent_id": "00000000-0000-0000-0000-000000000000", "daily_token_limit": 0, "max_conversation_turns": 0, "created_at": "2024-08-25T15:00:00Z", "updated_at": "2024-08-25T15:00:00Z" }
application/json

List AI agent assignments

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/assignments

List AI agent assignments › path Parameters

id
​string · uuid · required

AI agent ID

List AI agent assignments › Responses

200

Array of assignments

​object[]
id
​string · uuid · required
ai_agent_id
​string · uuid · required
priority
​integer · required
is_active
​boolean · required
channel
​string · enum
Enum values:
whatsapp
instagram
email
messenger
division_id
​string · uuid
GET/api/ai-agents/{id}/assignments
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/assignments
Example Responses
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "ai_agent_id": "00000000-0000-0000-0000-000000000000",
    "channel": "whatsapp",
    "division_id": "00000000-0000-0000-0000-000000000000",
    "priority": 0,
    "is_active": true
  }
]
application/json

Create an AI agent assignment

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/assignments

Requires settings.manage permission. Valid channels are whatsapp, instagram, email, messenger.

Create an AI agent assignment › path Parameters

id
​string · uuid · required

AI agent ID

Create an AI agent assignment › Request Body

channel
​string · enum
Enum values:
whatsapp
instagram
email
messenger
division_id
​string · uuid
priority
​integer

Create an AI agent assignment › Responses

Created assignment

id
​string · uuid · required
ai_agent_id
​string · uuid · required
priority
​integer · required
is_active
​boolean · required
channel
​string · enum
Enum values:
whatsapp
instagram
email
messenger
division_id
​string · uuid
POST/api/ai-agents/{id}/assignments
curl --request POST \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/assignments \
  --header 'Content-Type: application/json' \
  --data '
{
  "channel": "whatsapp",
  "division_id": "00000000-0000-0000-0000-000000000000",
  "priority": 0
}
'
Example Request Body
{
  "channel": "whatsapp",
  "division_id": "00000000-0000-0000-0000-000000000000",
  "priority": 0
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "ai_agent_id": "00000000-0000-0000-0000-000000000000",
  "channel": "whatsapp",
  "division_id": "00000000-0000-0000-0000-000000000000",
  "priority": 0,
  "is_active": true
}
application/json

Update an AI agent assignment

PUT
https://api-chat.bara.my.id
/api/ai-agents/{id}/assignments/{aid}

Requires settings.manage permission.

Update an AI agent assignment › path Parameters

id
​string · uuid · required

AI agent ID

aid
​string · uuid · required

Assignment ID

Update an AI agent assignment › Request Body

channel
​string · enum
Enum values:
whatsapp
instagram
email
messenger
division_id
​string · uuid
priority
​integer
is_active
​boolean

Update an AI agent assignment › Responses

Updated assignment

id
​string · uuid · required
ai_agent_id
​string · uuid · required
priority
​integer · required
is_active
​boolean · required
channel
​string · enum
Enum values:
whatsapp
instagram
email
messenger
division_id
​string · uuid
PUT/api/ai-agents/{id}/assignments/{aid}
curl --request PUT \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/assignments/:aid \
  --header 'Content-Type: application/json' \
  --data '
{
  "channel": "whatsapp",
  "division_id": "00000000-0000-0000-0000-000000000000",
  "priority": 0,
  "is_active": true
}
'
Example Request Body
{
  "channel": "whatsapp",
  "division_id": "00000000-0000-0000-0000-000000000000",
  "priority": 0,
  "is_active": true
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "ai_agent_id": "00000000-0000-0000-0000-000000000000",
  "channel": "whatsapp",
  "division_id": "00000000-0000-0000-0000-000000000000",
  "priority": 0,
  "is_active": true
}
application/json

Delete an AI agent assignment

DELETE
https://api-chat.bara.my.id
/api/ai-agents/{id}/assignments/{aid}

Requires settings.manage permission.

Delete an AI agent assignment › path Parameters

id
​string · uuid · required

AI agent ID

aid
​string · uuid · required

Assignment ID

Delete an AI agent assignment › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai-agents/{id}/assignments/{aid}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/assignments/:aid
Example Responses
{
  "deleted": true
}
application/json

List handoff rules for an AI agent

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/handoff-rules

List handoff rules for an AI agent › path Parameters

id
​string · uuid · required

AI agent ID

List handoff rules for an AI agent › Responses

200

Array of handoff rules

​object[]
id
​string · uuid · required
ai_agent_id
​string · uuid · required
rule_type
​string · enum · required
Enum values:
keyword
message_count
sentiment
explicit_request
location
topic
config
​object · required

Rule-specific configuration (e.g. keywords list, threshold)

stop_ai_after_handoff
​boolean · required
is_active
​boolean · required
target_division_id
​string · uuid
GET/api/ai-agents/{id}/handoff-rules
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/handoff-rules
Example Responses
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "ai_agent_id": "00000000-0000-0000-0000-000000000000",
    "rule_type": "keyword",
    "config": {},
    "target_division_id": "00000000-0000-0000-0000-000000000000",
    "stop_ai_after_handoff": true,
    "is_active": true
  }
]
application/json

Create a handoff rule

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/handoff-rules

Requires settings.manage permission. Valid rule types are: keyword, message_count, sentiment, explicit_request, location, topic.

Create a handoff rule › path Parameters

id
​string · uuid · required

AI agent ID

Create a handoff rule › Request Body

rule_type
​string · enum · required
Enum values:
keyword
message_count
sentiment
explicit_request
location
topic
config
​object
target_division_id
​string · uuid
stop_ai_after_handoff
​boolean

Create a handoff rule › Responses

Created handoff rule

id
​string · uuid · required
ai_agent_id
​string · uuid · required
rule_type
​string · enum · required
Enum values:
keyword
message_count
sentiment
explicit_request
location
topic
config
​object · required

Rule-specific configuration (e.g. keywords list, threshold)

stop_ai_after_handoff
​boolean · required
is_active
​boolean · required
target_division_id
​string · uuid
POST/api/ai-agents/{id}/handoff-rules
curl --request POST \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/handoff-rules \
  --header 'Content-Type: application/json' \
  --data '
{
  "rule_type": "keyword",
  "config": {},
  "target_division_id": "00000000-0000-0000-0000-000000000000",
  "stop_ai_after_handoff": true
}
'
Example Request Body
{
  "rule_type": "keyword",
  "config": {},
  "target_division_id": "00000000-0000-0000-0000-000000000000",
  "stop_ai_after_handoff": true
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "ai_agent_id": "00000000-0000-0000-0000-000000000000",
  "rule_type": "keyword",
  "config": {},
  "target_division_id": "00000000-0000-0000-0000-000000000000",
  "stop_ai_after_handoff": true,
  "is_active": true
}
application/json

Update a handoff rule

PUT
https://api-chat.bara.my.id
/api/ai-agents/{id}/handoff-rules/{hid}

Requires settings.manage permission.

Update a handoff rule › path Parameters

id
​string · uuid · required

AI agent ID

hid
​string · uuid · required

Handoff rule ID

Update a handoff rule › Request Body

rule_type
​string · enum
Enum values:
keyword
message_count
sentiment
explicit_request
location
topic
config
​object
target_division_id
​string · uuid
stop_ai_after_handoff
​boolean
is_active
​boolean

Update a handoff rule › Responses

Updated handoff rule

id
​string · uuid · required
ai_agent_id
​string · uuid · required
rule_type
​string · enum · required
Enum values:
keyword
message_count
sentiment
explicit_request
location
topic
config
​object · required

Rule-specific configuration (e.g. keywords list, threshold)

stop_ai_after_handoff
​boolean · required
is_active
​boolean · required
target_division_id
​string · uuid
PUT/api/ai-agents/{id}/handoff-rules/{hid}
curl --request PUT \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/handoff-rules/:hid \
  --header 'Content-Type: application/json' \
  --data '
{
  "rule_type": "keyword",
  "config": {},
  "target_division_id": "00000000-0000-0000-0000-000000000000",
  "stop_ai_after_handoff": true,
  "is_active": true
}
'
Example Request Body
{
  "rule_type": "keyword",
  "config": {},
  "target_division_id": "00000000-0000-0000-0000-000000000000",
  "stop_ai_after_handoff": true,
  "is_active": true
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "ai_agent_id": "00000000-0000-0000-0000-000000000000",
  "rule_type": "keyword",
  "config": {},
  "target_division_id": "00000000-0000-0000-0000-000000000000",
  "stop_ai_after_handoff": true,
  "is_active": true
}
application/json

Delete a handoff rule

DELETE
https://api-chat.bara.my.id
/api/ai-agents/{id}/handoff-rules/{hid}

Requires settings.manage permission.

Delete a handoff rule › path Parameters

id
​string · uuid · required

AI agent ID

hid
​string · uuid · required

Handoff rule ID

Delete a handoff rule › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai-agents/{id}/handoff-rules/{hid}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/handoff-rules/:hid
Example Responses
{
  "deleted": true
}
application/json

Get daily usage stats for an AI agent

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/usage

Requires settings.manage permission.

Get daily usage stats for an AI agent › path Parameters

id
​string · uuid · required

AI agent ID

Get daily usage stats for an AI agent › query Parameters

from
​string · date

Start date (YYYY-MM-DD)

to
​string · date

End date (YYYY-MM-DD)

Get daily usage stats for an AI agent › Responses

200

Array of daily usage summaries

​object[]
date
​string · date · required
prompt_tokens
​integer · int64 · required
completion_tokens
​integer · int64 · required
total_tokens
​integer · int64 · required
total_cost
​string · decimal · required

Estimated cost in USD

request_count
​integer · int64 · required
GET/api/ai-agents/{id}/usage
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/usage
Example Responses
[
  {
    "date": "2024-08-25",
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "total_cost": "total_cost",
    "request_count": 0
  }
]
application/json

List knowledge sources for an AI agent

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/knowledge

List knowledge sources for an AI agent › path Parameters

id
​string · uuid · required

AI agent ID

List knowledge sources for an AI agent › Responses

200

Array of knowledge sources

​object[]
id
​string · uuid · required
ai_agent_id
​string · uuid · required
name
​string · required
source_type
​string · enum · required
Enum values:
text
file
website
qna
product
chunk_count
​integer · required
status
​string · enum · required
Enum values:
pending
processing
ready
failed
created_at
​string · date-time · required
content
​string
file_url
​string
original_filename
​string
website_url
​string
status_message
​string
GET/api/ai-agents/{id}/knowledge
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/knowledge
Example Responses
[ { "id": "00000000-0000-0000-0000-000000000000", "ai_agent_id": "00000000-0000-0000-0000-000000000000", "name": "name", "source_type": "text", "content": "content", "file_url": "file_url", "original_filename": "original_filename", "website_url": "website_url", "chunk_count": 0, "status": "pending", "status_message": "status_message", "created_at": "2024-08-25T15:00:00Z" } ]
application/json

Add a knowledge source

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/knowledge

Requires settings.manage permission. Valid source types are: text, file, website, qna, product.

Add a knowledge source › path Parameters

id
​string · uuid · required

AI agent ID

Add a knowledge source › Request Body

name
​string · required
source_type
​string · enum · required
Enum values:
text
file
website
qna
product
content
​string
file_url
​string
original_filename
​string
website_url
​string

Add a knowledge source › Responses

Created knowledge source (status=pending)

id
​string · uuid · required
ai_agent_id
​string · uuid · required
name
​string · required
source_type
​string · enum · required
Enum values:
text
file
website
qna
product
chunk_count
​integer · required
status
​string · enum · required
Enum values:
pending
processing
ready
failed
created_at
​string · date-time · required
content
​string
file_url
​string
original_filename
​string
website_url
​string
status_message
​string
POST/api/ai-agents/{id}/knowledge
curl --request POST \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/knowledge \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "name",
  "source_type": "text",
  "content": "content",
  "file_url": "file_url",
  "original_filename": "original_filename",
  "website_url": "website_url"
}
'
Example Request Body
{
  "name": "name",
  "source_type": "text",
  "content": "content",
  "file_url": "file_url",
  "original_filename": "original_filename",
  "website_url": "website_url"
}
Example Responses
{ "id": "00000000-0000-0000-0000-000000000000", "ai_agent_id": "00000000-0000-0000-0000-000000000000", "name": "name", "source_type": "text", "content": "content", "file_url": "file_url", "original_filename": "original_filename", "website_url": "website_url", "chunk_count": 0, "status": "pending", "status_message": "status_message", "created_at": "2024-08-25T15:00:00Z" }
application/json

Delete a knowledge source

DELETE
https://api-chat.bara.my.id
/api/ai-agents/{id}/knowledge/{kid}

Requires settings.manage permission.

Delete a knowledge source › path Parameters

id
​string · uuid · required

AI agent ID

kid
​string · uuid · required

Knowledge source ID

Delete a knowledge source › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai-agents/{id}/knowledge/{kid}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/knowledge/:kid
Example Responses
{
  "deleted": true
}
application/json

Reprocess a knowledge source

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/knowledge/{kid}/reprocess

Resets status to pending for re-processing. Requires settings.manage permission.

Reprocess a knowledge source › path Parameters

id
​string · uuid · required

AI agent ID

kid
​string · uuid · required

Knowledge source ID

Reprocess a knowledge source › Responses

Knowledge source reset to pending

id
​string · uuid · required
ai_agent_id
​string · uuid · required
name
​string · required
source_type
​string · enum · required
Enum values:
text
file
website
qna
product
chunk_count
​integer · required
status
​string · enum · required
Enum values:
pending
processing
ready
failed
created_at
​string · date-time · required
content
​string
file_url
​string
original_filename
​string
website_url
​string
status_message
​string
POST/api/ai-agents/{id}/knowledge/{kid}/reprocess
curl --request POST \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/knowledge/:kid/reprocess
Example Responses
{ "id": "00000000-0000-0000-0000-000000000000", "ai_agent_id": "00000000-0000-0000-0000-000000000000", "name": "name", "source_type": "text", "content": "content", "file_url": "file_url", "original_filename": "original_filename", "website_url": "website_url", "chunk_count": 0, "status": "pending", "status_message": "status_message", "created_at": "2024-08-25T15:00:00Z" }
application/json

List QnA pairs for a knowledge source

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/knowledge/{kid}/qna

List QnA pairs for a knowledge source › path Parameters

id
​string · uuid · required

AI agent ID

kid
​string · uuid · required

Knowledge source ID

List QnA pairs for a knowledge source › Responses

Array of QnA pairs

​object[]
id
​string · uuid · required
knowledge_source_id
​string · uuid · required
question
​string · required
answer
​string · required
GET/api/ai-agents/{id}/knowledge/{kid}/qna
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/knowledge/:kid/qna
Example Responses
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "knowledge_source_id": "00000000-0000-0000-0000-000000000000",
    "question": "question",
    "answer": "answer"
  }
]
application/json

Add a QnA pair

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/knowledge/{kid}/qna

Requires settings.manage permission.

Add a QnA pair › path Parameters

id
​string · uuid · required

AI agent ID

kid
​string · uuid · required

Knowledge source ID

Add a QnA pair › Request Body

question
​string · required
answer
​string · required

Add a QnA pair › Responses

Created QnA pair

id
​string · uuid · required
knowledge_source_id
​string · uuid · required
question
​string · required
answer
​string · required
POST/api/ai-agents/{id}/knowledge/{kid}/qna
curl --request POST \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/knowledge/:kid/qna \
  --header 'Content-Type: application/json' \
  --data '
{
  "question": "question",
  "answer": "answer"
}
'
Example Request Body
{
  "question": "question",
  "answer": "answer"
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "knowledge_source_id": "00000000-0000-0000-0000-000000000000",
  "question": "question",
  "answer": "answer"
}
application/json

Delete a QnA pair

DELETE
https://api-chat.bara.my.id
/api/ai-agents/{id}/knowledge/{kid}/qna/{qid}

Requires settings.manage permission.

Delete a QnA pair › path Parameters

id
​string · uuid · required

AI agent ID

kid
​string · uuid · required

Knowledge source ID

qid
​string · uuid · required

QnA pair ID

Delete a QnA pair › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai-agents/{id}/knowledge/{kid}/qna/{qid}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/knowledge/:kid/qna/:qid
Example Responses
{
  "deleted": true
}
application/json

List products for an AI agent

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/products

List products for an AI agent › path Parameters

id
​string · uuid · required

AI agent ID

List products for an AI agent › Responses

200

Array of products

​object[]
id
​string · uuid · required
ai_agent_id
​string · uuid · required
name
​string · required
metadata
​object · required

Arbitrary JSON metadata for the product

is_active
​boolean · required
created_at
​string · date-time · required
description
​string
price
​string · decimal

Product price as a decimal string

weight
​string · decimal

Product weight as a decimal string

GET/api/ai-agents/{id}/products
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/products
Example Responses
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "ai_agent_id": "00000000-0000-0000-0000-000000000000",
    "name": "name",
    "description": "description",
    "price": "price",
    "weight": "weight",
    "metadata": {},
    "is_active": true,
    "created_at": "2024-08-25T15:00:00Z"
  }
]
application/json

Create a product

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/products

Requires settings.manage permission.

Create a product › path Parameters

id
​string · uuid · required

AI agent ID

Create a product › Request Body

name
​string · required
description
​string
price
​string · decimal
weight
​string · decimal
metadata
​object

Create a product › Responses

Created product

id
​string · uuid · required
ai_agent_id
​string · uuid · required
name
​string · required
metadata
​object · required

Arbitrary JSON metadata for the product

is_active
​boolean · required
created_at
​string · date-time · required
description
​string
price
​string · decimal

Product price as a decimal string

weight
​string · decimal

Product weight as a decimal string

POST/api/ai-agents/{id}/products
curl --request POST \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/products \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "name",
  "description": "description",
  "price": "price",
  "weight": "weight",
  "metadata": {}
}
'
Example Request Body
{
  "name": "name",
  "description": "description",
  "price": "price",
  "weight": "weight",
  "metadata": {}
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "ai_agent_id": "00000000-0000-0000-0000-000000000000",
  "name": "name",
  "description": "description",
  "price": "price",
  "weight": "weight",
  "metadata": {},
  "is_active": true,
  "created_at": "2024-08-25T15:00:00Z"
}
application/json

Bulk import products

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/products/import

Import an array of products in one request. Requires settings.manage permission.

Bulk import products › path Parameters

id
​string · uuid · required

AI agent ID

Bulk import products › Request Body

​object[]
name
​string · required
description
​string
price
​string · decimal
weight
​string · decimal
metadata
​object

Bulk import products › Responses

Array of created products

​object[]
id
​string · uuid · required
ai_agent_id
​string · uuid · required
name
​string · required
metadata
​object · required

Arbitrary JSON metadata for the product

is_active
​boolean · required
created_at
​string · date-time · required
description
​string
price
​string · decimal

Product price as a decimal string

weight
​string · decimal

Product weight as a decimal string

POST/api/ai-agents/{id}/products/import
curl --request POST \ --url https://api-chat.bara.my.id/api/ai-agents/:id/products/import \ --header 'Content-Type: application/json' \ --data ' [ { "name": "name", "description": "description", "price": "price", "weight": "weight", "metadata": {} } ] '
Example Request Body
[
  {
    "name": "name",
    "description": "description",
    "price": "price",
    "weight": "weight",
    "metadata": {}
  }
]
Example Responses
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "ai_agent_id": "00000000-0000-0000-0000-000000000000",
    "name": "name",
    "description": "description",
    "price": "price",
    "weight": "weight",
    "metadata": {},
    "is_active": true,
    "created_at": "2024-08-25T15:00:00Z"
  }
]
application/json

Update a product

PUT
https://api-chat.bara.my.id
/api/ai-agents/{id}/products/{pid}

Requires settings.manage permission.

Update a product › path Parameters

id
​string · uuid · required

AI agent ID

pid
​string · uuid · required

Product ID

Update a product › Request Body

name
​string
description
​string
price
​string · decimal
weight
​string · decimal
metadata
​object
is_active
​boolean

Update a product › Responses

Updated product

id
​string · uuid · required
ai_agent_id
​string · uuid · required
name
​string · required
metadata
​object · required

Arbitrary JSON metadata for the product

is_active
​boolean · required
created_at
​string · date-time · required
description
​string
price
​string · decimal

Product price as a decimal string

weight
​string · decimal

Product weight as a decimal string

PUT/api/ai-agents/{id}/products/{pid}
curl --request PUT \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/products/:pid \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "name",
  "description": "description",
  "price": "price",
  "weight": "weight",
  "metadata": {},
  "is_active": true
}
'
Example Request Body
{
  "name": "name",
  "description": "description",
  "price": "price",
  "weight": "weight",
  "metadata": {},
  "is_active": true
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "ai_agent_id": "00000000-0000-0000-0000-000000000000",
  "name": "name",
  "description": "description",
  "price": "price",
  "weight": "weight",
  "metadata": {},
  "is_active": true,
  "created_at": "2024-08-25T15:00:00Z"
}
application/json

Delete a product

DELETE
https://api-chat.bara.my.id
/api/ai-agents/{id}/products/{pid}

Requires settings.manage permission.

Delete a product › path Parameters

id
​string · uuid · required

AI agent ID

pid
​string · uuid · required

Product ID

Delete a product › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai-agents/{id}/products/{pid}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/products/:pid
Example Responses
{
  "deleted": true
}
application/json

List orchestration rules

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/orchestration

List orchestration rules › path Parameters

id
​string · uuid · required

Parent AI agent ID

List orchestration rules › Responses

200

Array of orchestration rules

​object[]
id
​string · uuid · required
parent_agent_id
​string · uuid · required
target_agent_id
​string · uuid · required
condition_prompt
​string · required

Prompt evaluated to decide whether to route to target agent

priority
​integer · required
is_active
​boolean · required
GET/api/ai-agents/{id}/orchestration
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/orchestration
Example Responses
[
  {
    "id": "00000000-0000-0000-0000-000000000000",
    "parent_agent_id": "00000000-0000-0000-0000-000000000000",
    "target_agent_id": "00000000-0000-0000-0000-000000000000",
    "condition_prompt": "condition_prompt",
    "priority": 0,
    "is_active": true
  }
]
application/json

Create an orchestration rule

POST
https://api-chat.bara.my.id
/api/ai-agents/{id}/orchestration

Requires settings.manage permission.

Create an orchestration rule › path Parameters

id
​string · uuid · required

Parent AI agent ID

Create an orchestration rule › Request Body

target_agent_id
​string · uuid · required
condition_prompt
​string · required
priority
​integer

Create an orchestration rule › Responses

Created orchestration rule

id
​string · uuid · required
parent_agent_id
​string · uuid · required
target_agent_id
​string · uuid · required
condition_prompt
​string · required

Prompt evaluated to decide whether to route to target agent

priority
​integer · required
is_active
​boolean · required
POST/api/ai-agents/{id}/orchestration
curl --request POST \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/orchestration \
  --header 'Content-Type: application/json' \
  --data '
{
  "target_agent_id": "00000000-0000-0000-0000-000000000000",
  "condition_prompt": "condition_prompt",
  "priority": 0
}
'
Example Request Body
{
  "target_agent_id": "00000000-0000-0000-0000-000000000000",
  "condition_prompt": "condition_prompt",
  "priority": 0
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "parent_agent_id": "00000000-0000-0000-0000-000000000000",
  "target_agent_id": "00000000-0000-0000-0000-000000000000",
  "condition_prompt": "condition_prompt",
  "priority": 0,
  "is_active": true
}
application/json

Update an orchestration rule

PUT
https://api-chat.bara.my.id
/api/ai-agents/{id}/orchestration/{rid}

Requires settings.manage permission.

Update an orchestration rule › path Parameters

id
​string · uuid · required

Parent AI agent ID

rid
​string · uuid · required

Orchestration rule ID

Update an orchestration rule › Request Body

target_agent_id
​string · uuid
condition_prompt
​string
priority
​integer
is_active
​boolean

Update an orchestration rule › Responses

Updated orchestration rule

id
​string · uuid · required
parent_agent_id
​string · uuid · required
target_agent_id
​string · uuid · required
condition_prompt
​string · required

Prompt evaluated to decide whether to route to target agent

priority
​integer · required
is_active
​boolean · required
PUT/api/ai-agents/{id}/orchestration/{rid}
curl --request PUT \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/orchestration/:rid \
  --header 'Content-Type: application/json' \
  --data '
{
  "target_agent_id": "00000000-0000-0000-0000-000000000000",
  "condition_prompt": "condition_prompt",
  "priority": 0,
  "is_active": true
}
'
Example Request Body
{
  "target_agent_id": "00000000-0000-0000-0000-000000000000",
  "condition_prompt": "condition_prompt",
  "priority": 0,
  "is_active": true
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "parent_agent_id": "00000000-0000-0000-0000-000000000000",
  "target_agent_id": "00000000-0000-0000-0000-000000000000",
  "condition_prompt": "condition_prompt",
  "priority": 0,
  "is_active": true
}
application/json

Delete an orchestration rule

DELETE
https://api-chat.bara.my.id
/api/ai-agents/{id}/orchestration/{rid}

Requires settings.manage permission.

Delete an orchestration rule › path Parameters

id
​string · uuid · required

Parent AI agent ID

rid
​string · uuid · required

Orchestration rule ID

Delete an orchestration rule › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai-agents/{id}/orchestration/{rid}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/orchestration/:rid
Example Responses
{
  "deleted": true
}
application/json

List evaluations for an AI agent

GET
https://api-chat.bara.my.id
/api/ai-agents/{id}/evaluations

List evaluations for an AI agent › path Parameters

id
​string · uuid · required

AI agent ID

List evaluations for an AI agent › Responses

200

Array of evaluations

​object[]
id
​string · uuid · required
conversation_id
​string · uuid · required
message_id
​string · required

MongoDB message ID

original_response
​string · required
corrected_response
​string · required
context_message_ids
​string[] · required

IDs of messages used as evaluation context

evaluated_by
​string · uuid · required

Agent who performed the evaluation

created_at
​string · date-time · required
GET/api/ai-agents/{id}/evaluations
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai-agents/:id/evaluations
Example Responses
[ { "id": "00000000-0000-0000-0000-000000000000", "conversation_id": "00000000-0000-0000-0000-000000000000", "message_id": "message_id", "original_response": "original_response", "corrected_response": "corrected_response", "context_message_ids": [ "string" ], "evaluated_by": "00000000-0000-0000-0000-000000000000", "created_at": "2024-08-25T15:00:00Z" } ]
application/json

Create an AI response evaluation

POST
https://api-chat.bara.my.id
/api/ai/evaluate

Submit a human correction of an AI response. Requires settings.manage permission.

Create an AI response evaluation › Request Body

conversation_id
​string · uuid · required
message_id
​string · required
original_response
​string · required
corrected_response
​string · required
context_message_ids
​string[]

Create an AI response evaluation › Responses

Created evaluation

id
​string · uuid · required
conversation_id
​string · uuid · required
message_id
​string · required

MongoDB message ID

original_response
​string · required
corrected_response
​string · required
context_message_ids
​string[] · required

IDs of messages used as evaluation context

evaluated_by
​string · uuid · required

Agent who performed the evaluation

created_at
​string · date-time · required
POST/api/ai/evaluate
curl --request POST \ --url https://api-chat.bara.my.id/api/ai/evaluate \ --header 'Content-Type: application/json' \ --data ' { "conversation_id": "00000000-0000-0000-0000-000000000000", "message_id": "message_id", "original_response": "original_response", "corrected_response": "corrected_response", "context_message_ids": [ "string" ] } '
Example Request Body
{
  "conversation_id": "00000000-0000-0000-0000-000000000000",
  "message_id": "message_id",
  "original_response": "original_response",
  "corrected_response": "corrected_response",
  "context_message_ids": [
    "string"
  ]
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "conversation_id": "00000000-0000-0000-0000-000000000000",
  "message_id": "message_id",
  "original_response": "original_response",
  "corrected_response": "corrected_response",
  "context_message_ids": [
    "string"
  ],
  "evaluated_by": "00000000-0000-0000-0000-000000000000",
  "created_at": "2024-08-25T15:00:00Z"
}
application/json

Update an AI evaluation

PUT
https://api-chat.bara.my.id
/api/ai/evaluate/{eid}

Requires settings.manage permission.

Update an AI evaluation › path Parameters

eid
​string · uuid · required

Evaluation ID

Update an AI evaluation › Request Body

corrected_response
​string
context_message_ids
​string[]

Update an AI evaluation › Responses

Updated evaluation

id
​string · uuid · required
conversation_id
​string · uuid · required
message_id
​string · required

MongoDB message ID

original_response
​string · required
corrected_response
​string · required
context_message_ids
​string[] · required

IDs of messages used as evaluation context

evaluated_by
​string · uuid · required

Agent who performed the evaluation

created_at
​string · date-time · required
PUT/api/ai/evaluate/{eid}
curl --request PUT \
  --url https://api-chat.bara.my.id/api/ai/evaluate/:eid \
  --header 'Content-Type: application/json' \
  --data '
{
  "corrected_response": "corrected_response",
  "context_message_ids": [
    "string"
  ]
}
'
Example Request Body
{
  "corrected_response": "corrected_response",
  "context_message_ids": [
    "string"
  ]
}
Example Responses
{
  "id": "00000000-0000-0000-0000-000000000000",
  "conversation_id": "00000000-0000-0000-0000-000000000000",
  "message_id": "message_id",
  "original_response": "original_response",
  "corrected_response": "corrected_response",
  "context_message_ids": [
    "string"
  ],
  "evaluated_by": "00000000-0000-0000-0000-000000000000",
  "created_at": "2024-08-25T15:00:00Z"
}
application/json

Delete an AI evaluation

DELETE
https://api-chat.bara.my.id
/api/ai/evaluate/{eid}

Requires settings.manage permission.

Delete an AI evaluation › path Parameters

eid
​string · uuid · required

Evaluation ID

Delete an AI evaluation › Responses

Deletion confirmation

deleted
​boolean · required
DELETE/api/ai/evaluate/{eid}
curl --request DELETE \
  --url https://api-chat.bara.my.id/api/ai/evaluate/:eid
Example Responses
{
  "deleted": true
}
application/json

Get aggregated AI usage summary

GET
https://api-chat.bara.my.id
/api/ai/usage/summary

Aggregated daily usage across all AI agents. Requires settings.manage permission.

Get aggregated AI usage summary › query Parameters

from
​string · date
to
​string · date

Get aggregated AI usage summary › Responses

200

Array of daily usage summaries

​object[]
date
​string · date · required
prompt_tokens
​integer · int64 · required
completion_tokens
​integer · int64 · required
total_tokens
​integer · int64 · required
total_cost
​string · decimal · required

Estimated cost in USD

request_count
​integer · int64 · required
GET/api/ai/usage/summary
curl --request GET \
  --url https://api-chat.bara.my.id/api/ai/usage/summary
Example Responses
[
  {
    "date": "2024-08-25",
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "total_cost": "total_cost",
    "request_count": 0
  }
]
application/json

Send a test message to an AI agent

POST
https://api-chat.bara.my.id
/api/ai/test-chat

Test an AI agent's response using OpenAI, Anthropic, or Google Gemini depending on the agent's configured model. Requires settings.manage permission.

Send a test message to an AI agent › Request Body

​object[] · required
temperature
​number · double

Send a test message to an AI agent › Responses

AI agent reply

reply
​string
POST/api/ai/test-chat
curl --request POST \ --url https://api-chat.bara.my.id/api/ai/test-chat \ --header 'Content-Type: application/json' \ --data ' { "messages": [ { "role": "user", "content": "content" } ], "temperature": 0 } '
Example Request Body
{
  "messages": [
    {
      "role": "user",
      "content": "content"
    }
  ],
  "temperature": 0
}
Example Responses
{
  "reply": "reply"
}
application/json

Chat ExpirationWorking Hours