Skip to main content

Enterprise Search API

The Enterprise Search Service provides intelligent search capabilities across your organization’s data, enabling users to find information through natural language queries. The service consists of four main components:
  1. Conversation Management - Chat-style interactions with your data
  2. Agent Conversations - Specialized conversations with AI agents
  3. Agent Management - Manages AI agents and templates
  4. Semantic Search - Direct search queries across your content

Base URL

All endpoints are prefixed with /api/v1

Authentication

All endpoints require authentication via Bearer token:
Internal endpoints use scoped token authentication for service-to-service communication with specific scopes:
  • CONVERSATION_CREATE - For conversation creation
  • FETCH_CONFIG - For configuration updates

Architecture Overview

The Enterprise Search Service is built on a Node.js backend with MongoDB for data persistence. It leverages AI models to provide accurate responses and semantic search capabilities. The service integrates with:
  • AI Backend - Processes queries and generates responses
  • IAM Service - Handles user authentication and authorization
  • Configuration Manager - Manages application settings

Data Models

Conversations

Conversations represent chat sessions with the AI assistant, containing user queries, AI responses, and citations that reference source documents.

Agent Conversations

Specialized conversations with specific AI agents, inheriting from regular conversations with additional agent-specific metadata.

Citations

References to source documents that back the AI’s responses, including content snippets and comprehensive metadata.

Searches

Individual search queries and their results, including citations and metadata.

API Endpoints

The Conversation Management API enables chat-style interactions with your organizational data, including creating conversations, adding messages, sharing, and managing conversation lifecycle.
Start a new conversation thread.
Endpoint: POST /api/v1/conversations/createRequest Body Parameters:
Internal endpoint for service-to-service communication using scoped tokens.
Endpoint: POST /api/v1/conversations/internal/createAuthentication: Requires scoped token with CONVERSATION_CREATE scope.Request Body: Same structure as public create endpoint.
Create a conversation with real-time streaming responses via Server-Sent Events.
Endpoint: POST /api/v1/conversations/streamRequest Body: Same as Create Conversation
Add a new message to an existing conversation.
Endpoint: POST /api/v1/conversations/:conversationId/messagesPath Parameters:
  • conversationId: MongoDB ObjectId (24-character hex string)
Request Body Parameters:Note: previousConversations is automatically calculated from existing messages - do NOT include in request.
Internal endpoint for adding messages via service authentication.
Endpoint: POST /api/v1/conversations/internal/:conversationId/messagesAuthentication: Requires scoped token with CONVERSATION_CREATE scope.Request Body: Same structure as public add message endpoint.
Add a message with real-time streaming response.
Endpoint: POST /api/v1/conversations/:conversationId/messages/streamRequest Body: Same as Add Message (without previousConversations)Behavior:
  1. Adds user message to existing conversation
  2. Streams AI response in real-time
  3. Sends custom complete event with updated conversation
Retrieve all conversations for the authenticated user with pagination.
Endpoint: GET /api/v1/conversationsQuery Parameters:
Retrieve a specific conversation with paginated messages.
Endpoint: GET /api/v1/conversations/:conversationIdQuery Parameters:
  • sortBy: Field to sort messages by (createdAt, messageType, content)
  • sortOrder: Sort order (asc, desc)
  • page: Page number for message pagination
  • limit: Messages per page
Important: Message pagination works backwards - newer messages have higher indices. The API returns the most recent messages first and paginates backwards through older messages.
Soft delete a conversation and its associated citations.
Endpoint: DELETE /api/v1/conversations/:conversationIdAccess Control: Only conversation initiator or users with ‘write’ access can delete.
Share a conversation with other users in your organization.
Endpoint: POST /api/v1/conversations/:conversationId/shareAccess Control: Only conversation initiator can share.
Request Validation:
  • userIds: Array of MongoDB ObjectIds (24-character hex strings)
  • accessLevel: “read” or “write” (optional, defaults to “read”)
  • User existence is validated against IAM service
Remove sharing access for specific users.
Endpoint: POST /api/v1/conversations/:conversationId/unshare
Regenerate the last AI response in a conversation.
Endpoint: POST /api/v1/conversations/:conversationId/message/:messageId/regenerateConstraints:
  • Can only regenerate the last message in the conversation
  • Message must be of type bot_response
  • Requires at least 2 messages (user query + bot response)
Update the title of a conversation.
Endpoint: PATCH /api/v1/conversations/:conversationId/title
Validation:
  • title: Required, 1-200 characters
Provide feedback on an AI response.
Endpoint: POST /api/v1/conversations/:conversationId/message/:messageId/feedbackAccess Control: Conversation initiator, shared users, or publicly shared conversations.Restriction: Cannot provide feedback on user_query messages.
Categories:
  • incorrect_information, missing_information, irrelevant_information
  • unclear_explanation, poor_citations
  • excellent_answer, helpful_citations, well_explained, other
Archive a conversation.
Endpoint: PATCH /api/v1/conversations/:conversationId/archiveAccess Control: Conversation initiator or users with ‘write’ access.
Unarchive a conversation.
Endpoint: PATCH /api/v1/conversations/:conversationId/unarchive
Get all archived conversations with summary statistics.
Endpoint: GET /api/v1/conversations/show/archivesQuery Parameters: Same pagination and filtering as Get All Conversations
The Agent Conversation API enables interactions with specific AI agents. Agent conversations inherit all conversation properties but include additional agent-specific features.
Start a conversation with a specific agent.
Endpoint: POST /api/v1/agent/:agentKey/conversationsPath Parameters:
  • agentKey: Unique string identifier for the agent (from ArangoDB)
Request Body Parameters:
Create an agent conversation with streaming responses.
Endpoint: POST /api/v1/agent/:agentKey/conversations/streamRequest Body: Same as Create Agent Conversation
Add a message to an existing agent conversation.
Endpoint: POST /api/v1/agent/:agentKey/conversations/:conversationId/messagesRequest Body: Same structure as regular add message, without previousConversations (calculated automatically)
Add a streaming message to an agent conversation.
Endpoint: POST /api/v1/agent/:agentKey/conversations/:conversationId/messages/stream
Retrieve all conversations for a specific agent.
Endpoint: GET /api/v1/agent/:agentKey/conversationsQuery Parameters: Same as regular conversations
Retrieve a specific agent conversation.
Endpoint: GET /api/v1/agent/:agentKey/conversations/:conversationId
Delete an agent conversation.
Endpoint: DELETE /api/v1/agent/:agentKey/conversations/:conversationId
The Agent Management API provides endpoints for creating, managing, and configuring AI agents and their templates.
Create a new agent template.
Endpoint: POST /api/v1/agent/template
Retrieve a specific agent template.
Endpoint: GET /api/v1/agent/template/:templateId
Update an existing agent template.
Endpoint: PUT /api/v1/agent/template/:templateIdRequest Body: Same structure as create template
Delete an agent template.
Endpoint: DELETE /api/v1/agent/template/:templateId
Get all available agent templates.
Endpoint: GET /api/v1/agent/template
Create a new agent instance from a template.
Endpoint: POST /api/v1/agent/create
Retrieve agent details.
Endpoint: GET /api/v1/agent/:agentKey
Update agent configuration.
Endpoint: PUT /api/v1/agent/:agentKeyRequest Body: Agent configuration updates
Delete an agent.
Endpoint: DELETE /api/v1/agent/:agentKey
Get all available agents for the organization.
Endpoint: GET /api/v1/agent/
Retrieve all available tools for agents.
Endpoint: GET /api/v1/agent/tools/list
Get permissions for a specific agent.
Endpoint: GET /api/v1/agent/:agentKey/permissions
Share an agent with other users.
Endpoint: POST /api/v1/agent/:agentKey/share
Remove agent sharing.
Endpoint: POST /api/v1/agent/:agentKey/unshare
Update agent permissions.
Endpoint: PUT /api/v1/agent/:agentKey/permissionsRequest Body: Updated permission configuration
Direct search functionality across your organization’s content without creating conversations.
Perform a semantic search across indexed content.
Endpoint: POST /api/v1/search
Validation:
  • query: Required, 1+ characters
  • limit: Optional, 1-100 (default: 10)
  • filters.apps: Array of valid app types
  • filters.kb: Array of UUIDs
Get search history with pagination.
Endpoint: GET /api/v1/searchQuery Parameters:
  • page: Page number (default: 1)
  • limit: Items per page (1-100, default: 10)
  • sortBy: Field to sort by (default: ‘createdAt’)
  • sortOrder: Sort order (default: ‘desc’)
Retrieve a specific search result with populated citations.
Endpoint: GET /api/v1/search/:searchId
Delete a specific search and its associated citations.
Endpoint: DELETE /api/v1/search/:searchId
Delete all search history and associated citations.
Endpoint: DELETE /api/v1/search
Share a search result with other users.
Endpoint: PATCH /api/v1/search/:searchId/share
Validation:
  • User existence validated against IAM service
  • shareLink automatically generated
Remove search sharing.
Endpoint: PATCH /api/v1/search/:searchId/unshare
Archive a search result.
Endpoint: PATCH /api/v1/search/:searchId/archive
Unarchive a search result.
Endpoint: PATCH /api/v1/search/:searchId/unarchive
Internal configuration management endpoints for service administration.
Internal endpoint for updating application configuration.
Endpoint: POST /api/v1/search/updateAppConfigAuthentication: Requires scoped token with FETCH_CONFIG scope.

Schema Definitions

Error Handling

All endpoints return structured error responses with specific error constants:
Common Error Codes:
  • VALIDATION_ERROR - Invalid request parameters (from validators)
  • NOT_FOUND - Resource not found
  • UNAUTHORIZED - Authentication required
  • FORBIDDEN - Insufficient permissions
  • INTERNAL_ERROR - Server error
  • AI_SERVICE_UNAVAILABLE - AI backend unavailable
  • BAD_REQUEST - Malformed request
AI Service Specific Errors:
  • Connection refused → “AI Service is currently unavailable. Please check your network connection or try again later.”
  • API errors → Conversation marked as ‘Failed’ with specific failure reason
  • Processing errors → Error message added to conversation messages

Important Notes

  1. MongoDB ObjectIds: All ID fields use 24-character hexadecimal strings matching /^[0-9a-fA-F]{24}$/
  2. UUIDs vs ObjectIds: Knowledge base filters use UUIDs, not ObjectIds
  3. Computed Fields: Response objects include computed isOwner and accessLevel fields
  4. Pagination: Conversation messages paginate backwards (newest first)
  5. Streaming: Custom complete events replace AI backend events with conversation data
  6. Agent Conversations: Inherit all conversation features plus agent-specific capabilities
  7. Access Control: Strict validation of user permissions and resource ownership
  8. Transaction Support: Uses MongoDB transactions when replica sets are available