Conversations API
Read and manage conversations between your characters and players. Each unique player_id + character_id pair creates a persistent conversation with full memory.
Base path: /api/agents/{agent_id}/players
agent_id = character_id
The agent_id in the URL path is the same id returned by the Characters API.
Get Conversation Stats
GET /api/agents/{agent_id}/players/stats
Returns aggregate statistics for all conversations with a character.
Response
{
"totalConversations": 156,
"totalMessages": 4230,
"firstActivity": "2026-01-15T10:30:00",
"lastActivity": "2026-03-01T14:22:00"
}
| Field | Type | Description |
|---|---|---|
totalConversations | integer | Total number of player conversations |
totalMessages | integer | Total messages across all conversations |
firstActivity | string | null | ISO 8601 timestamp of earliest conversation |
lastActivity | string | null | ISO 8601 timestamp of most recent activity |
Example
curl https://api.estuary-ai.com/api/agents/550e8400-e29b-41d4-a716-446655440000/players/stats \
-H "X-API-Key: est_your_api_key"
List Conversations
GET /api/agents/{agent_id}/players
Returns a paginated list of player conversations for a character.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 50 | Results per page (1-100) |
offset | integer | 0 | Number of results to skip |
sort_by | string | "last_activity" | Sort field: "last_activity", "created_at", "message_count", "player_id" |
sort_order | string | "desc" | "asc" or "desc" |
player_search | string | — | Filter by player_id (partial match) |
min_messages | integer | — | Only include conversations with at least this many messages |
Response
{
"conversations": [
{
"id": "conv_abc123",
"characterId": "550e8400-e29b-41d4-a716-446655440000",
"playerId": "player_xyz",
"messageCount": 42,
"createdAt": "2026-01-20T09:00:00",
"lastActivity": "2026-03-01T14:22:00"
}
],
"total": 156,
"limit": 50,
"offset": 0,
"sortBy": "last_activity",
"sortOrder": "desc"
}
Example
curl "https://api.estuary-ai.com/api/agents/550e8400-e29b-41d4-a716-446655440000/players?limit=10&sort_by=message_count&sort_order=desc" \
-H "X-API-Key: est_your_api_key"
const agentId = "550e8400-e29b-41d4-a716-446655440000";
const res = await fetch(
`https://api.estuary-ai.com/api/agents/${agentId}/players?limit=10&min_messages=5`,
{ headers: { "X-API-Key": "est_your_api_key" } }
);
const data = await res.json();
console.log(`${data.total} conversations found`);
Get a Conversation
GET /api/agents/{agent_id}/players/{player_id}
Returns details for a specific player's conversation.
Example
curl https://api.estuary-ai.com/api/agents/550e8400-e29b-41d4-a716-446655440000/players/player_xyz \
-H "X-API-Key: est_your_api_key"
Get Messages
GET /api/agents/{agent_id}/players/{player_id}/messages
Returns messages for a player conversation, ordered chronologically (newest page first, messages within each page in chronological order).
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 100 | Messages per page |
page | integer | 1 | Page number (1-indexed) |
Response
{
"messages": [
{
"id": "msg_001",
"role": "user",
"content": "Hey, remember what we talked about last time?",
"timestamp": "2026-03-01T14:20:00"
},
{
"id": "msg_002",
"role": "assistant",
"content": "Of course! You were telling me about your hiking trip to Rocky Mountain National Park.",
"timestamp": "2026-03-01T14:20:05"
}
],
"pagination": {
"page": 1,
"limit": 100,
"total": 42,
"hasMore": false
}
}
Example
curl "https://api.estuary-ai.com/api/agents/550e8400-e29b-41d4-a716-446655440000/players/player_xyz/messages?limit=50&page=1" \
-H "X-API-Key: est_your_api_key"
Delete a Conversation
DELETE /api/agents/{agent_id}/players/{player_id}
Permanently deletes a conversation, all its messages, and all associated memories for this player-character pair.
Response
{
"message": "Player conversation deleted"
}
Example
curl -X DELETE https://api.estuary-ai.com/api/agents/550e8400-e29b-41d4-a716-446655440000/players/player_xyz \
-H "X-API-Key: est_your_api_key"