Chats API

List chats

GET/v1/chats

Newest first. Messages are left out of the list; fetch one chat for them.

Query parameters

agent_idstring
statusstring
limitinteger

Default 50

pagination_keystring

Returns

200 with the fields below.

chatsarray<object>required

Chats, newest first. Messages are left out; fetch one chat to read them.

15 properties
idstringrequired

The chat's id. Same as `chat_id`.

chat_idstringrequired

The chat's id.

chat_typestringrequired

Always `api_chat`: a chat started through the API.

chat_statusstringrequired

`ongoing` or `ended`.

agent_idstringrequired

The agent the chat is with.

agent_versionintegerrequired

The agent version the chat runs. 0 is the live draft.

metadataobjectrequired

The JSON object you attached to the chat. Empty when you attached none.

dynamic_variablesobjectrequired

The values that fill `{{name}}` placeholders in the agent's prompt for this chat.

message_countintegerrequired

How many user and agent messages the chat holds.

transcriptstringrequired

The conversation as plain text, one line per message.

Show 5 more parameters
start_timestampinteger

Start time in milliseconds since the Unix epoch.

end_timestampinteger

End time in milliseconds since the Unix epoch. Null while the chat is ongoing.

end_reasonstring

Why the chat ended, such as `user_ended` or `agent_ended`. Null while it is ongoing.

analysisobject

The post-chat analysis, with `call_summary`, `user_sentiment`, `call_successful` and your custom fields under `variables`. Null until analysis has run.

chat_costobject

What the chat has cost. Hidden (null) for dashboard users with the member role, since spend is visible to owners and admins only.

2 properties
combined_costintegerrequired

What the chat has cost so far, in units of $0.0001.

reply_countintegerrequired

How many agent replies were billed.

has_morebooleanrequired

True when more chats follow this page.

pagination_keystring

Pass this as `pagination_key` to fetch the next page. Null on the last page.

curl "https://api.dialgem.com/v1/chats" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "chats": [
    {
      "id": "string",
      "chat_id": "chat_123",
      "chat_type": "string",
      "chat_status": "string",
      "agent_id": "agent_123",
      "agent_version": 0,
      "metadata": {},
      "dynamic_variables": {},
      "start_timestamp": 0,
      "end_timestamp": 0,
      "end_reason": "string",
      "message_count": 0
    }
  ],
  "has_more": false,
  "pagination_key": "string"
}

Create chat

POST/v1/chats

Start a chat. If the agent has a first message it is already in `messages`.

Request body application/json

agent_idstringrequired
agent_versioninteger
metadataobject
dynamic_variablesobject

Returns

201 with the fields below.

idstringrequired

The chat's id. Same as `chat_id`.

chat_idstringrequired

The chat's id.

chat_typestringrequired

Always `api_chat`: a chat started through the API.

chat_statusstringrequired

`ongoing` or `ended`.

agent_idstringrequired

The agent the chat is with.

agent_versionintegerrequired

The agent version the chat runs. 0 is the live draft.

metadataobjectrequired

The JSON object you attached to the chat. Empty when you attached none.

dynamic_variablesobjectrequired

The values that fill `{{name}}` placeholders in the agent's prompt for this chat.

message_countintegerrequired

How many user and agent messages the chat holds.

transcriptstringrequired

The conversation as plain text, one line per message.

Show 6 more parameters
messagesarray<object>required

Every message in order, including tool calls and their results.

4 properties
message_idstringrequired

The message's id.

rolestringrequired

`user`, `agent`, `tool_call_invocation` or `tool_call_result`.

contentstringrequired

The message text. Empty for a tool call invocation.

created_timestampintegerrequired

When the message was created, in milliseconds since the Unix epoch.

start_timestampinteger

Start time in milliseconds since the Unix epoch.

end_timestampinteger

End time in milliseconds since the Unix epoch. Null while the chat is ongoing.

end_reasonstring

Why the chat ended, such as `user_ended` or `agent_ended`. Null while it is ongoing.

analysisobject

The post-chat analysis, with `call_summary`, `user_sentiment`, `call_successful` and your custom fields under `variables`. Null until analysis has run.

chat_costobject

What the chat has cost. Hidden (null) for dashboard users with the member role, since spend is visible to owners and admins only.

2 properties
combined_costintegerrequired

What the chat has cost so far, in units of $0.0001.

reply_countintegerrequired

How many agent replies were billed.

curl -X POST "https://api.dialgem.com/v1/chats" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_123"
  }'
Response 201
{
  "id": "string",
  "chat_id": "chat_123",
  "chat_type": "string",
  "chat_status": "string",
  "agent_id": "agent_123",
  "agent_version": 0,
  "metadata": {},
  "dynamic_variables": {},
  "start_timestamp": 0,
  "end_timestamp": 0,
  "end_reason": "string",
  "message_count": 0
}

Get chat

GET/v1/chats/{chat_id}

Path parameters

chat_idstringrequired

Returns

200 with the fields below.

idstringrequired

The chat's id. Same as `chat_id`.

chat_idstringrequired

The chat's id.

chat_typestringrequired

Always `api_chat`: a chat started through the API.

chat_statusstringrequired

`ongoing` or `ended`.

agent_idstringrequired

The agent the chat is with.

agent_versionintegerrequired

The agent version the chat runs. 0 is the live draft.

metadataobjectrequired

The JSON object you attached to the chat. Empty when you attached none.

dynamic_variablesobjectrequired

The values that fill `{{name}}` placeholders in the agent's prompt for this chat.

message_countintegerrequired

How many user and agent messages the chat holds.

transcriptstringrequired

The conversation as plain text, one line per message.

Show 6 more parameters
messagesarray<object>required

Every message in order, including tool calls and their results.

4 properties
message_idstringrequired

The message's id.

rolestringrequired

`user`, `agent`, `tool_call_invocation` or `tool_call_result`.

contentstringrequired

The message text. Empty for a tool call invocation.

created_timestampintegerrequired

When the message was created, in milliseconds since the Unix epoch.

start_timestampinteger

Start time in milliseconds since the Unix epoch.

end_timestampinteger

End time in milliseconds since the Unix epoch. Null while the chat is ongoing.

end_reasonstring

Why the chat ended, such as `user_ended` or `agent_ended`. Null while it is ongoing.

analysisobject

The post-chat analysis, with `call_summary`, `user_sentiment`, `call_successful` and your custom fields under `variables`. Null until analysis has run.

chat_costobject

What the chat has cost. Hidden (null) for dashboard users with the member role, since spend is visible to owners and admins only.

2 properties
combined_costintegerrequired

What the chat has cost so far, in units of $0.0001.

reply_countintegerrequired

How many agent replies were billed.

curl "https://api.dialgem.com/v1/chats/CHAT_ID" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "id": "string",
  "chat_id": "chat_123",
  "chat_type": "string",
  "chat_status": "string",
  "agent_id": "agent_123",
  "agent_version": 0,
  "metadata": {},
  "dynamic_variables": {},
  "start_timestamp": 0,
  "end_timestamp": 0,
  "end_reason": "string",
  "message_count": 0
}

Update chat

PATCH/v1/chats/{chat_id}

Replace the chat's metadata (the whole object, like a call's).

Path parameters

chat_idstringrequired

Request body application/json

metadataobject

Returns

200 with the fields below.

idstringrequired

The chat's id. Same as `chat_id`.

chat_idstringrequired

The chat's id.

chat_typestringrequired

Always `api_chat`: a chat started through the API.

chat_statusstringrequired

`ongoing` or `ended`.

agent_idstringrequired

The agent the chat is with.

agent_versionintegerrequired

The agent version the chat runs. 0 is the live draft.

metadataobjectrequired

The JSON object you attached to the chat. Empty when you attached none.

dynamic_variablesobjectrequired

The values that fill `{{name}}` placeholders in the agent's prompt for this chat.

message_countintegerrequired

How many user and agent messages the chat holds.

transcriptstringrequired

The conversation as plain text, one line per message.

Show 6 more parameters
messagesarray<object>required

Every message in order, including tool calls and their results.

4 properties
message_idstringrequired

The message's id.

rolestringrequired

`user`, `agent`, `tool_call_invocation` or `tool_call_result`.

contentstringrequired

The message text. Empty for a tool call invocation.

created_timestampintegerrequired

When the message was created, in milliseconds since the Unix epoch.

start_timestampinteger

Start time in milliseconds since the Unix epoch.

end_timestampinteger

End time in milliseconds since the Unix epoch. Null while the chat is ongoing.

end_reasonstring

Why the chat ended, such as `user_ended` or `agent_ended`. Null while it is ongoing.

analysisobject

The post-chat analysis, with `call_summary`, `user_sentiment`, `call_successful` and your custom fields under `variables`. Null until analysis has run.

chat_costobject

What the chat has cost. Hidden (null) for dashboard users with the member role, since spend is visible to owners and admins only.

2 properties
combined_costintegerrequired

What the chat has cost so far, in units of $0.0001.

reply_countintegerrequired

How many agent replies were billed.

curl -X PATCH "https://api.dialgem.com/v1/chats/CHAT_ID" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
Response 200
{
  "id": "string",
  "chat_id": "chat_123",
  "chat_type": "string",
  "chat_status": "string",
  "agent_id": "agent_123",
  "agent_version": 0,
  "metadata": {},
  "dynamic_variables": {},
  "start_timestamp": 0,
  "end_timestamp": 0,
  "end_reason": "string",
  "message_count": 0
}

Delete chat

DELETE/v1/chats/{chat_id}

Path parameters

chat_idstringrequired

Returns

200 with the fields below.

deletedbooleanrequired

Always true on success.

idstringrequired

The id of the chat that was deleted.

curl -X DELETE "https://api.dialgem.com/v1/chats/CHAT_ID" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "deleted": false,
  "id": "string"
}

Send message

POST/v1/chats/{chat_id}/messages

Send the user's message and wait for the agent's reply.

Path parameters

chat_idstringrequired

Request body application/json

contentstringrequired

Returns

200 with the fields below.

chat_idstringrequired

The chat the message went to.

chat_statusstringrequired

`ongoing`, or `ended` if the agent ended the chat with this reply.

messagesarray<object>required

The new messages in order: yours, any tool use, then the agent's reply.

4 properties
message_idstringrequired

The message's id.

rolestringrequired

`user`, `agent`, `tool_call_invocation` or `tool_call_result`.

contentstringrequired

The message text. Empty for a tool call invocation.

created_timestampintegerrequired

When the message was created, in milliseconds since the Unix epoch.

curl -X POST "https://api.dialgem.com/v1/chats/CHAT_ID/messages" \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "string"
  }'
Response 200
{
  "chat_id": "chat_123",
  "chat_status": "string",
  "messages": [
    {
      "message_id": "message_123",
      "role": "string",
      "content": "string",
      "created_timestamp": 0
    }
  ]
}

End chat

POST/v1/chats/{chat_id}/end

End the chat. Ending twice is fine and changes nothing. The analysis arrives a moment later.

Path parameters

chat_idstringrequired

Returns

200 with the fields below.

idstringrequired

The chat's id. Same as `chat_id`.

chat_idstringrequired

The chat's id.

chat_typestringrequired

Always `api_chat`: a chat started through the API.

chat_statusstringrequired

`ongoing` or `ended`.

agent_idstringrequired

The agent the chat is with.

agent_versionintegerrequired

The agent version the chat runs. 0 is the live draft.

metadataobjectrequired

The JSON object you attached to the chat. Empty when you attached none.

dynamic_variablesobjectrequired

The values that fill `{{name}}` placeholders in the agent's prompt for this chat.

message_countintegerrequired

How many user and agent messages the chat holds.

transcriptstringrequired

The conversation as plain text, one line per message.

Show 6 more parameters
messagesarray<object>required

Every message in order, including tool calls and their results.

4 properties
message_idstringrequired

The message's id.

rolestringrequired

`user`, `agent`, `tool_call_invocation` or `tool_call_result`.

contentstringrequired

The message text. Empty for a tool call invocation.

created_timestampintegerrequired

When the message was created, in milliseconds since the Unix epoch.

start_timestampinteger

Start time in milliseconds since the Unix epoch.

end_timestampinteger

End time in milliseconds since the Unix epoch. Null while the chat is ongoing.

end_reasonstring

Why the chat ended, such as `user_ended` or `agent_ended`. Null while it is ongoing.

analysisobject

The post-chat analysis, with `call_summary`, `user_sentiment`, `call_successful` and your custom fields under `variables`. Null until analysis has run.

chat_costobject

What the chat has cost. Hidden (null) for dashboard users with the member role, since spend is visible to owners and admins only.

2 properties
combined_costintegerrequired

What the chat has cost so far, in units of $0.0001.

reply_countintegerrequired

How many agent replies were billed.

curl -X POST "https://api.dialgem.com/v1/chats/CHAT_ID/end" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "id": "string",
  "chat_id": "chat_123",
  "chat_type": "string",
  "chat_status": "string",
  "agent_id": "agent_123",
  "agent_version": 0,
  "metadata": {},
  "dynamic_variables": {},
  "start_timestamp": 0,
  "end_timestamp": 0,
  "end_reason": "string",
  "message_count": 0
}

Rerun chat analysis

POST/v1/chats/{chat_id}/rerun-analysis

Analyse an ended chat again with the agent's *current* analysis settings and return it.

Path parameters

chat_idstringrequired

Returns

200 with the fields below.

idstringrequired

The chat's id. Same as `chat_id`.

chat_idstringrequired

The chat's id.

chat_typestringrequired

Always `api_chat`: a chat started through the API.

chat_statusstringrequired

`ongoing` or `ended`.

agent_idstringrequired

The agent the chat is with.

agent_versionintegerrequired

The agent version the chat runs. 0 is the live draft.

metadataobjectrequired

The JSON object you attached to the chat. Empty when you attached none.

dynamic_variablesobjectrequired

The values that fill `{{name}}` placeholders in the agent's prompt for this chat.

message_countintegerrequired

How many user and agent messages the chat holds.

transcriptstringrequired

The conversation as plain text, one line per message.

Show 6 more parameters
messagesarray<object>required

Every message in order, including tool calls and their results.

4 properties
message_idstringrequired

The message's id.

rolestringrequired

`user`, `agent`, `tool_call_invocation` or `tool_call_result`.

contentstringrequired

The message text. Empty for a tool call invocation.

created_timestampintegerrequired

When the message was created, in milliseconds since the Unix epoch.

start_timestampinteger

Start time in milliseconds since the Unix epoch.

end_timestampinteger

End time in milliseconds since the Unix epoch. Null while the chat is ongoing.

end_reasonstring

Why the chat ended, such as `user_ended` or `agent_ended`. Null while it is ongoing.

analysisobject

The post-chat analysis, with `call_summary`, `user_sentiment`, `call_successful` and your custom fields under `variables`. Null until analysis has run.

chat_costobject

What the chat has cost. Hidden (null) for dashboard users with the member role, since spend is visible to owners and admins only.

2 properties
combined_costintegerrequired

What the chat has cost so far, in units of $0.0001.

reply_countintegerrequired

How many agent replies were billed.

curl -X POST "https://api.dialgem.com/v1/chats/CHAT_ID/rerun-analysis" \
  -H "X-API-Key: $DIALGEM_API_KEY"
Response 200
{
  "id": "string",
  "chat_id": "chat_123",
  "chat_type": "string",
  "chat_status": "string",
  "agent_id": "agent_123",
  "agent_version": 0,
  "metadata": {},
  "dynamic_variables": {},
  "start_timestamp": 0,
  "end_timestamp": 0,
  "end_reason": "string",
  "message_count": 0
}