Skip to content
ProductBlogOpen console
API

Create or resume a chat session

POST
/chats
curl --request POST \
--url https://mw.omazy.ai/api/v1/chats \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "app_id": "example", "bot_profile_id": "example", "channel": "example", "initial_attachments": [ "example" ] }'

Session parameters

Media typeapplication/json
object
app_id
string
bot_profile_id
string
channel
string
initial_attachments
Array<string>
Examplegenerated
{
"app_id": "example",
"bot_profile_id": "example",
"channel": "example",
"initial_attachments": [
"example"
]
}

OK

Media typeapplication/json
object
data
error
object
code
string
message
string
meta
object
next_cursor
string
page
integer
per_page
integer
total
integer
success
boolean
data
object
app_id
string
bot_profile_id
string
branched_at_message_id
string
channel_switch_count
integer
context_id
string
context_summary
string
conversation_id
string
created_at
string
customer_id

Customer_id (migration 000067) — the CRM contact this session resolves to once identity is captured. Required here so SELECT * scans cleanly.

string
dispatch_channel
string
dispatch_identity_id
string
first_response_at
string
id
string
is_mev_ai
boolean
last_message
string
last_message_at
string
last_message_sender
string
last_switch_at
string
message_count
integer
meta
Array<integer>
origin_channel
string
origin_identity_id
string
parent_session_id

Branch fork columns added by migration 000036. parent_session_id is the source session a branch was forked from; branched_at_message_id is the cut-off ULID — every source row with id <= this lives in the new session as a copy. Both nullable; populated only on sessions created via POST /ouchat/sessions/branch.

string
priority
string
reference_code
string
resolved_at
string
routing_reason

Routing audit columns added by migration 000039 (mw#259, RFC 2204 §5). RoutingReason records why this session landed on this app: explicit — caller specified the app and it was active no_app — caller provided no app; routed to OU AI app_not_found — caller specified an unknown app; routed to OU AI app_suspended — caller’s app is suspended; routed to OU AI app_deleted — caller’s app is deleted; routed to OU AI Set at insert time, never updated. Existing sessions stay on their original app even if its status flips later.

string
segment_seq
integer
sla_due_at
string
status
string
tags
Array<string>
team_id
string
topic

Topic is a short subject line shown in the recent-chats list. Seeded from the first user message (see message_service); stays frozen unless explicitly overwritten by a future summariser job.

string
transferred_to_session_id
string
type
string
updated_at
string
user_id
string
widget_deployment_id

Widget_deployment_id (migration 000072) — denormalized deployment link for deployment-scoped feeds. Required here or FindActiveSession’s SELECT * fails “missing destination name widget_deployment_id” → widget boot 500s.

string
ws_connected
boolean
ws_session_id
string
Examplegenerated
{
"data": {
"app_id": "example",
"bot_profile_id": "example",
"branched_at_message_id": "example",
"channel_switch_count": 1,
"context_id": "example",
"context_summary": "example",
"conversation_id": "example",
"created_at": "example",
"customer_id": "example",
"dispatch_channel": "example",
"dispatch_identity_id": "example",
"first_response_at": "example",
"id": "example",
"is_mev_ai": true,
"last_message": "example",
"last_message_at": "example",
"last_message_sender": "example",
"last_switch_at": "example",
"message_count": 1,
"meta": [
1
],
"origin_channel": "example",
"origin_identity_id": "example",
"parent_session_id": "example",
"priority": "example",
"reference_code": "example",
"resolved_at": "example",
"routing_reason": "example",
"segment_seq": 1,
"sla_due_at": "example",
"status": "example",
"tags": [
"example"
],
"team_id": "example",
"topic": "example",
"transferred_to_session_id": "example",
"type": "example",
"updated_at": "example",
"user_id": "example",
"widget_deployment_id": "example",
"ws_connected": true,
"ws_session_id": "example"
},
"error": {
"code": "example",
"message": "example"
},
"meta": {
"next_cursor": "example",
"page": 1,
"per_page": 1,
"total": 1
},
"success": true
}

Created

Media typeapplication/json
object
data
error
object
code
string
message
string
meta
object
next_cursor
string
page
integer
per_page
integer
total
integer
success
boolean
data
object
app_id
string
bot_profile_id
string
branched_at_message_id
string
channel_switch_count
integer
context_id
string
context_summary
string
conversation_id
string
created_at
string
customer_id

Customer_id (migration 000067) — the CRM contact this session resolves to once identity is captured. Required here so SELECT * scans cleanly.

string
dispatch_channel
string
dispatch_identity_id
string
first_response_at
string
id
string
is_mev_ai
boolean
last_message
string
last_message_at
string
last_message_sender
string
last_switch_at
string
message_count
integer
meta
Array<integer>
origin_channel
string
origin_identity_id
string
parent_session_id

Branch fork columns added by migration 000036. parent_session_id is the source session a branch was forked from; branched_at_message_id is the cut-off ULID — every source row with id <= this lives in the new session as a copy. Both nullable; populated only on sessions created via POST /ouchat/sessions/branch.

string
priority
string
reference_code
string
resolved_at
string
routing_reason

Routing audit columns added by migration 000039 (mw#259, RFC 2204 §5). RoutingReason records why this session landed on this app: explicit — caller specified the app and it was active no_app — caller provided no app; routed to OU AI app_not_found — caller specified an unknown app; routed to OU AI app_suspended — caller’s app is suspended; routed to OU AI app_deleted — caller’s app is deleted; routed to OU AI Set at insert time, never updated. Existing sessions stay on their original app even if its status flips later.

string
segment_seq
integer
sla_due_at
string
status
string
tags
Array<string>
team_id
string
topic

Topic is a short subject line shown in the recent-chats list. Seeded from the first user message (see message_service); stays frozen unless explicitly overwritten by a future summariser job.

string
transferred_to_session_id
string
type
string
updated_at
string
user_id
string
widget_deployment_id

Widget_deployment_id (migration 000072) — denormalized deployment link for deployment-scoped feeds. Required here or FindActiveSession’s SELECT * fails “missing destination name widget_deployment_id” → widget boot 500s.

string
ws_connected
boolean
ws_session_id
string
Examplegenerated
{
"data": {
"app_id": "example",
"bot_profile_id": "example",
"branched_at_message_id": "example",
"channel_switch_count": 1,
"context_id": "example",
"context_summary": "example",
"conversation_id": "example",
"created_at": "example",
"customer_id": "example",
"dispatch_channel": "example",
"dispatch_identity_id": "example",
"first_response_at": "example",
"id": "example",
"is_mev_ai": true,
"last_message": "example",
"last_message_at": "example",
"last_message_sender": "example",
"last_switch_at": "example",
"message_count": 1,
"meta": [
1
],
"origin_channel": "example",
"origin_identity_id": "example",
"parent_session_id": "example",
"priority": "example",
"reference_code": "example",
"resolved_at": "example",
"routing_reason": "example",
"segment_seq": 1,
"sla_due_at": "example",
"status": "example",
"tags": [
"example"
],
"team_id": "example",
"topic": "example",
"transferred_to_session_id": "example",
"type": "example",
"updated_at": "example",
"user_id": "example",
"widget_deployment_id": "example",
"ws_connected": true,
"ws_session_id": "example"
},
"error": {
"code": "example",
"message": "example"
},
"meta": {
"next_cursor": "example",
"page": 1,
"per_page": 1,
"total": 1
},
"success": true
}

Bad Request

Media typeapplication/json
object
data
error
object
code
string
message
string
meta
object
next_cursor
string
page
integer
per_page
integer
total
integer
success
boolean
error
object
code
string
message
string
Examplegenerated
{
"data": "example",
"error": {
"code": "example",
"message": "example"
},
"meta": {
"next_cursor": "example",
"page": 1,
"per_page": 1,
"total": 1
},
"success": true
}

Unauthorized

Media typeapplication/json
object
data
error
object
code
string
message
string
meta
object
next_cursor
string
page
integer
per_page
integer
total
integer
success
boolean
error
object
code
string
message
string
Examplegenerated
{
"data": "example",
"error": {
"code": "example",
"message": "example"
},
"meta": {
"next_cursor": "example",
"page": 1,
"per_page": 1,
"total": 1
},
"success": true
}