Portal Community

API Endpoints

MethodPathDescription
GET/api/octopus/episodesList episodes for the authenticated user, paginated
GET/api/octopus/episodes/{id}Get a specific episode by ID (with full messages if active)
GET/api/octopus/episodes?agentId=&userId=Filter by agent and user (admin only)
POST/api/octopus/episodes/searchSemantic search across episodes
DELETE/api/octopus/episodes/{id}Delete a specific episode (GDPR erasure)
DELETE/api/octopus/users/{userId}/episodesErase all episodes for a user

List Episodes

GET /api/octopus/episodes?page=1&pageSize=20&agentId={guid}
Authorization: Bearer {token}

// Response
{
  "items": [
    {
      "id": "3f2a...",
      "sessionId": "9b1c...",
      "agentId": "5e7d...",
      "agentDisplayName": "HR Agent",
      "startedAt": "2025-05-20T09:14:22Z",
      "endedAt": "2025-05-20T09:28:10Z",
      "messageCount": 12,
      "summary": "User inquired about annual leave policy...",
      "isArchived": false
    }
  ],
  "totalCount": 47,
  "page": 1,
  "pageSize": 20
}

Semantic Episode Search

POST /api/octopus/episodes/search
Authorization: Bearer {token}
Content-Type: application/json

{
  "query": "annual leave balance",
  "agentId": "5e7d...",
  "topK": 5,
  "includeArchived": false
}

// Response
{
  "results": [
    {
      "episodeId": "3f2a...",
      "summary": "User inquired about annual leave policy...",
      "date": "2025-05-20T09:14:22Z",
      "relevanceScore": 0.91,
      "isArchived": false
    }
  ]
}

TypeScript Client Example

// Fetching conversation history in chat-app
interface EpisodeListItem {
  id: string;
  agentDisplayName: string;
  startedAt: string;
  messageCount: number;
  summary: string;
}

async function getConversationHistory(
  agentId: string, token: string
): Promise<EpisodeListItem[]> {
  const res = await fetch(
    `/api/octopus/episodes?agentId=${agentId}&pageSize=10`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  const data = await res.json();
  return data.items;
}