AI
The AI API provides direct access to Egnyte AI capabilities such as:
- Document Q&A
- Summarization
- Knowledge Base queries
- Hybrid search
This API is primarily synchronous (request → response).
When to Use
Use the AI API when:
- You need quick answers on documents
- You want low-latency responses
- You do not need agent-level workflows
Use Agents API if you need orchestration or multi-step reasoning.
Note: File and folder paths must be URL-encoded segment by segment. Do not encode forward slashes (/). For example, Shared/example?path/$file.txt should be encoded as Shared/example%3Fpath/%24file.txt.
Base URL
https://{domain}.egnyte.com/pubapi/v1/ai
Authentication
All requests require an OAuth 2.0 Bearer token in the Authorization header:
Authorization: Bearer {access_token}
See Authentication for details on obtaining a token.
Rate Limits
AI API endpoints have stricter rate limits than standard Egnyte APIs. These limits apply per access token:
| Limit Type | Default |
|---|---|
| Daily | 100 calls per token |
| Per minute | 10 calls per token |
| Per second | 2 calls per token |
If your production application requires higher limits, contact Egnyte to discuss custom arrangements.
Note: These limits are in addition to the general Egnyte API rate limits described in Best Practices.
Core Capabilities
| Feature | Endpoint |
|---|---|
| Document Q&A | /document/{entry-id}/ask |
| Summarization | /document/{entry-id}/summary |
| AI Assistant (multi-source Q&A) | POST /assistant/ask |
| AI Assistant — Execution Status (poll for result) | GET /assistant/{executionId}/status |
| Copilot (multi-source Q&A) — deprecated, use AI Assistant | POST /copilot/ask |
| Knowledge Base Q&A | /kb/{kb-id}/ask |
| Hybrid Search | /hybrid-search |
Ask a Question
Ask a question about a specific document and receive an AI-generated answer based on the document's content.
Request
POST /pubapi/v1/ai/document/{entry-id}/ask
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
entry-id | string | Yes | The unique identifier of the file version |
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
question | string | Yes | — | The question to ask about the document |
includeCitations | boolean | No | false | Whether to include citations in the response |
chatHistory | object | No | — | Previous conversation messages for context |
chatHistory.messages | array | No | [] | Array of previous message objects |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/document/{entryId}/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "What is the date of Christmas Day in the US in 2025?", "chatHistory": { "messages": [] }, "includeCitations": true }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
response | object | The AI-generated response |
response.text | string | The answer text |
citations | array | List of citations used to generate the response (if includeCitations was true) |
citations[].filename | string | Name of the cited file |
citations[].entryId | string | Entry ID of the cited file |
citations[].chunks | array | Specific content chunks referenced |
citations[].chunks[].chunkId | string | Unique identifier for the chunk |
citations[].chunks[].sourceText | string | The text excerpt from the document |
Example Response
{
"response": {
"text": "Christmas Day in the US in 2025 is on December 25th, which falls on a Thursday."
},
"citations": [
{
"filename": "Policy.pdf",
"entryId": "535083b1-383a-4352-b993-77900bf5d98a",
"chunks": [
{
"chunkId": "0",
"sourceText": "Policy Renewal Migration Portability"
}
]
}
]
}
Summarize a Document
Generate an AI-powered summary of a document.
Request
POST /pubapi/v1/ai/document/{entry-id}/summary
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
entry-id | string | Yes | The unique identifier of the file version |
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
chatHistory | object | No | — | Previous conversation messages for context |
chatHistory.messages | array | No | [] | Array of previous message objects |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/document/{entryId}/summary" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "chatHistory": { "messages": [] } }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
response | object | The AI-generated summary |
response.text | string | The summary text |
Example Response
{
"response": {
"text": "Summary of the document is here"
}
}
AI Assistant
Ask questions to AI Assistant, which provides AI-driven answers based on content across your Egnyte domain. This is an asynchronous API — the ask returns an execution ID immediately, and you poll a separate status endpoint until the answer is ready.
Note: AI Assistant replaces the deprecated Copilot endpoint. The request format is similar but the response is different — AI Assistant is async while Copilot is synchronous.
Key Behavior
-
Works across multiple documents
-
Supports citations, tool calls, and web search
-
Can be scoped via selectedItems
-
Async: poll
/{executionId}/statusfor the result
Request
POST /pubapi/v1/ai/assistant/ask
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
question | string | Yes | — | The question to ask AI Assistant |
selectedItems | object | No | — | Files and folders to include in the search context |
selectedItems.folders | array | No | [] | Array of folder objects |
selectedItems.folders[].id | string | Yes | — | Folder ID |
selectedItems.files | array | No | [] | Array of file objects |
selectedItems.files[].entryId | string | Yes | — | File entry ID |
selectedItems.allEgnyteSearch | boolean | No | false | Search across all content in the Egnyte domain |
selectedItems.webSearch | boolean | No | false | Include web search results in the response |
includeCitations | boolean | No | false | Whether to include citations in the status response |
chatHistory | object | No | — | Previous conversation messages for context |
chatHistory.messages | array | No | [] | Array of previous message objects |
conversationId | string | No | — | Pass the conversationId from a previous response to continue an existing conversation |
mcpSelectionId | string | No | — | ID of the MCP (Model Context Protocol) server selection to use for this request |
modelDetails | object | No | — | Override the AI model. When omitted, defaults to Gemini-2.5 Flash (gemini-2.5-flash) |
modelDetails.name | string | No | — | Display name of the model |
modelDetails.version | string | No | — | Model version identifier (e.g., gemini-2.5-flash) |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/assistant/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "Describe the file", "chatHistory": { "messages": [] }, "selectedItems": { "folders": [ { "id": "{folderId}" } ], "files": [ { "entryId": "{entryId}" } ] }, "includeCitations": true }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
conversationId | string | Unique identifier for this conversation. Pass in subsequent requests to continue the conversation |
executionId | string | Unique identifier for this execution. Use this to poll /{executionId}/status for the result |
executionStatus | string | Initial execution status (e.g., IN_PROGRESS) |
truncated | boolean | Whether the response was truncated |
actions | array | Pending actions returned at submission time, if any |
Example Response
{
"conversationId": "2862a232-20ac-4244-8c1e-871b7a539ae2",
"executionId": "10cd770f-8b8f-4a76-bf0a-7418dd910fb7",
"executionStatus": "IN_PROGRESS",
"truncated": false,
"actions": []
}
Get Execution Status
Poll this endpoint after calling /ask to retrieve the answer and execution details.
GET /pubapi/v1/ai/assistant/{executionId}/status
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
executionId | string | Yes | The executionId returned by the /ask response |
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
includeCitations | boolean | No | true | Whether to include citations in the response |
Execution Status Response
200 OK
| Field | Type | Description |
|---|---|---|
status | string | Current execution status. Poll until this is no longer IN_PROGRESS. Possible values: IN_PROGRESS, COMPLETED, FAILED, AWAITING_USER_CONFIRMATION |
responseText | string | The AI-generated answer. Populated when status is COMPLETED |
thoughts | array | Model's reasoning steps |
citations | array | Citations used to generate the response |
citations[].filename | string | Name of the cited file |
citations[].entryId | string | Entry ID of the cited file |
citations[].objectId | string | Object ID of the cited file |
citations[].previewUrl | string | URL to preview the file |
citations[].chunks | array | Specific content chunks referenced |
citations[].chunks[].chunkId | string | Unique identifier for the chunk |
citations[].chunks[].sourceText | string | The text excerpt from the document |
actions | array | Actions returned by the execution |
intent | string | Detected intent of the question (e.g., qna) |
lastUpdated | long | Timestamp of the last status update (Unix epoch in milliseconds) |
numToolCalls | integer | Total number of tool calls made |
pendingActions | array | Actions awaiting user confirmation (e.g., MCP authentication) |
pendingActions[].type | string | Type of pending action (e.g., MCP_AUTH) |
pendingActions[].serverId | string | ID of the server requiring the action |
pendingActions[].toolCallId | string | ID of the tool call that triggered this pending action |
toolCalls | object | Map of tool calls made, keyed by tool call ID |
toolCalls.<id>.name | string | Internal name of the tool |
toolCalls.<id>.sourceDisplayName | string | Display name of the data source the tool operated on |
toolCalls.<id>.toolDisplayName | string | Human-readable display name of the tool |
toolCalls.<id>.thought | string | Model's reasoning before invoking this tool |
toolCalls.<id>.thoughts | array | Sequence of reasoning steps for this tool call |
toolCalls.<id>.input | object | Input parameters passed to the tool |
toolCalls.<id>.output | object | Output returned by the tool |
toolCalls.<id>.status | string | Execution status of the tool call |
toolCalls.<id>.timestamp | string | ISO 8601 timestamp of when the tool was called |
toolCalls.<id>.metadata | object | Additional key-value metadata about the tool call |
Example Response
{
"status": "COMPLETED",
"responseText": "The provided document shows several premium examples",
"thoughts": [],
"citations": [
{
"filename": "Policy.pdf",
"entryId": "535083b1-383a-4352-b993-77900bf5d98a",
"objectId": "52.1e0bffbc-500d-4669-82f9-c984a33813e5",
"previewUrl": "/navigate/file/3bf2374e-49ac-45b2-b3b3-b44e0da88597",
"chunks": [
{
"chunkId": "c590a032-9ac6-467a-aa65-9b58e30bff5b",
"sourceText": "Text"
}
]
}
],
"intent": "qna",
"lastUpdated": 1780660757000,
"numToolCalls": 2,
"pendingActions": [],
"toolCalls": {
"call_abc123": {
"name": "search_documents",
"sourceDisplayName": "Egnyte",
"toolDisplayName": "Document Search",
"thought": "Searching for relevant documents",
"input": { "query": "premium examples" },
"output": "Found 3 relevant documents",
"status": "success",
"timestamp": "2025-06-05T10:00:00Z"
}
}
}
Copilot
Deprecated. This endpoint is deprecated and will be removed on September 30, 2026. Use AI Assistant (POST /pubapi/v1/ai/assistant/ask) instead. Note that AI Assistant is asynchronous — see the AI Assistant section for the updated request and response format. Until then, /copilot/ask remains fully supported for backward compatibility.
Ask questions to Egnyte Copilot, which provides AI-driven answers based on content across your Egnyte domain. Optionally specify files or folders to limit the search context.
Key Behavior
-
Works across multiple documents
-
Supports citations
-
Can be scoped via selectedItems
Request
POST /pubapi/v1/ai/copilot/ask
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
question | string | Yes | — | The question to ask Copilot |
selectedItems | object | Yes | — | Files and folders to include in the search context |
selectedItems.folders | array | No | [] | Array of folder objects |
selectedItems.folders[].id | string | Yes | — | Folder ID |
selectedItems.files | array | No | [] | Array of file objects |
selectedItems.files[].entryId | string | Yes | — | File entry ID |
includeCitations | boolean | No | false | Whether to include citations in the response |
chatHistory | object | No | — | Previous conversation messages for context |
chatHistory.messages | array | No | [] | Array of previous message objects |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/copilot/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "Describe the file", "chatHistory": { "messages": [] }, "selectedItems": { "folders": [ { "id": "{folderId}" } ], "files": [ { "entryId": "{entryId}" } ] }, "includeCitations": true }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
response | object | The AI-generated response |
response.text | string | The answer text |
citations | array | List of citations used to generate the response (if includeCitations was true) |
citations[].filename | string | Name of the cited file |
citations[].entryId | string | Entry ID of the cited file |
citations[].objectId | string | Object ID of the cited file |
citations[].previewUrl | string | URL to preview the file |
citations[].chunks | array | Specific content chunks referenced |
citations[].chunks[].chunkId | string | Unique identifier for the chunk |
citations[].chunks[].sourceText | string | The text excerpt from the document |
conversationId | string | Unique identifier for this conversation |
deprecationNotice | string | Present only on this deprecated endpoint. Message indicating that /copilot/ask is deprecated and that callers should migrate to /assistant/ask. Not returned by /assistant/ask. |
Deprecation Response Headers
| Header | Value | Description |
|---|---|---|
Deprecation | true | Signals to API gateways and proxies that this endpoint is deprecated (RFC 8594) |
Sunset | Wed, 30 Sep 2026 00:00:00 GMT | Machine-readable date when the endpoint will be removed (RFC 8594) |
Link | </pubapi/v1/ai/assistant/ask>; rel="successor-version" | URL of the replacement endpoint (RFC 8288) |
Example Response
{
"response": {
"text": "The provided document shows several premium examples"
},
"citations": [
{
"filename": "Policy.pdf",
"entryId": "535083b1-383a-4352-b993-77900bf5d98a",
"objectId": "52.1e0bffbc-500d-4669-82f9-c984a33813e5",
"previewUrl": "/navigate/file/3bf2374e-49ac-45b2-b3b3-b44e0da88597",
"chunks": [
{
"chunkId": "c590a032-9ac6-467a-aa65-9b58e30bff5b",
"sourceText": "Text"
}
]
}
],
"conversationId": "c655a318-268c-47d2-b6e0-d53dedd117ef",
"deprecationNotice": "This endpoint is deprecated and will be removed on September 30, 2026. Use POST /pubapi/v1/ai/assistant/ask instead. Note - the replacement endpoint is asynchronous: POST /assistant/ask returns an executionId; poll GET /assistant/{executionId}/status to retrieve the response."
}
List Knowledge Bases
Retrieve a list of Knowledge Bases (KBs) available in your Egnyte domain.
When to Use
-
Structured enterprise knowledge
-
Pre-indexed document sets
Request
POST /pubapi/v1/ai/kb/list
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
sortBy | array | Yes | — | Sorting criteria. Allowed values: createdOn, name |
sortDirection | array | Yes | — | Sort direction. Allowed values: ASC, DESC |
status | array | Yes | — | KB status filter. Allowed values: ACTIVE, DELETED, CREATED |
page | integer | No | 0 | Page number for pagination |
size | integer | No | 200 | Number of items per page |
createdBy | integer | No | — | Filter by user ID of the KB creator |
createdAfter | long | No | — | Filter KBs created after this timestamp (Unix epoch in milliseconds) |
createdBefore | long | No | — | Filter KBs created before this timestamp (Unix epoch in milliseconds) |
includePlaceholderData | boolean | No | false | Include placeholder data in the response |
includeProcessingStatistics | boolean | No | false | Include processing statistics in the response |
includePrompts | boolean | No | false | Include prompt-related data in the response |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/kb/list" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "sortBy": [ "name" ], "sortDirection": [ "ASC" ], "status": [ "ACTIVE" ], "includePlaceholderData": false, "includeProcessingStatistics": false, "includePrompts": false }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
content | array | List of Knowledge Base entries |
content[].id | string | Unique identifier of the KB |
content[].name | string | Name of the KB |
content[].description | string | Description of the KB |
content[].paths | array | Folder paths associated with the KB |
content[].paths[].id | string | Unique identifier of the path |
content[].paths[].folderId | string | Folder ID linked to the KB |
content[].paths[].path | string | File path where documents are stored |
content[].paths[].permission | string | Permission level (e.g., Owner) |
content[].paths[].status | string | Path status (e.g., ACTIVE) |
content[].status | string | KB status |
content[].type | string | KB type (e.g., KBA) |
content[].createdBy | string | Display name of the user who created the KB |
content[].createdByUser | object | Details of the user who created the KB |
content[].createdByUser.firstName | string | First name of the creator |
content[].createdByUser.lastName | string | Last name of the creator |
content[].createdByUser.userName | string | Username/email of the creator |
content[].createdByUser.userId | integer | User ID of the creator |
content[].createdOn | long | Timestamp when the KB was created (Unix epoch in milliseconds) |
content[].noResponseMessage | string | Feedback message when no AI response is generated |
content[].iconName | string | Icon name used for the KB in the UI |
content[].subType | string | Whether the KB is SYSTEM_DEFINED or USER_DEFINED |
content[].progress | integer | Processing progress percentage |
content[].lastProcessedAt | long | Timestamp when the KB was last processed (Unix epoch in milliseconds) |
content[].pathCount | integer | Number of paths linked to the KB |
content[].prompts | array | List of prompts associated with the KB |
content[].subStatus | string | Sub-status of the KB (e.g., WITHIN_LIMIT) |
number | integer | Current page number |
size | integer | Maximum number of elements per page |
first | boolean | Whether this is the first page |
last | boolean | Whether this is the last page |
empty | boolean | Whether the content is empty |
numberOfElements | integer | Number of elements in the current page |
totalElements | integer | Total number of elements across all pages |
totalPages | integer | Total number of pages |
fileLimit | integer | Maximum number of files allowed |
Example Response
{
"content": [
{
"id": "a691dcbf-2d97-4420-8b08-720c88809a9e",
"name": "KB",
"description": "KB description",
"paths": [
{
"id": "8804124f-5fb7-476c-846d-10d6c94f7c33",
"folderId": "0f53980d-7a3b-44d7-ae15-42048bacf993",
"path": "/Shared/Documents",
"permission": "Owner",
"status": "ACTIVE"
}
],
"status": "ACTIVE",
"type": "KBA",
"createdBy": "Ankesh Katiyar",
"createdByUser": {
"firstName": "Ankesh",
"lastName": "Katiyar",
"userName": "akatiyar@akatiyar",
"userId": 1,
"avatarEosObjectId": ""
},
"createdOn": 1738570114257,
"noResponseMessage": "",
"iconName": "add",
"subType": "USER_DEFINED",
"progress": 100,
"lastProcessedAt": 1738570336155,
"pathCount": 1,
"prompts": [],
"subStatus": "WITHIN_LIMIT"
}
],
"number": 0,
"size": 200,
"first": true,
"last": true,
"empty": false,
"numberOfElements": 1,
"totalElements": 1,
"totalPages": 1,
"fileLimit": 10000
}
Ask Knowledge Base
Ask a question to a specific Knowledge Base and receive an AI-generated answer based on the KB's content.
Request
POST /pubapi/v1/ai/kb/{kb-id}/ask
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
kb-id | string | Yes | The unique identifier of the Knowledge Base |
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
question | string | Yes | — | The question to ask the Knowledge Base |
includeCitations | boolean | No | false | Whether to include citations in the response |
chatHistory | object | No | — | Previous conversation messages for context |
chatHistory.messages | array | No | [] | Array of previous message objects with role and content fields |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/kb/{KbId}/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "Explain all the organizational HR policies", "chatHistory": { "messages": [ { "role": "user", "content": "Show me the policies" }, { "role": "assistant", "content": "I am sorry, but I do not know the answer to this question." } ] }, "includeCitations": true }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
response | object | The AI-generated response |
response.text | string | The answer text |
citations | array | List of citations used to generate the response (if includeCitations was true) |
citations[].filename | string | Name of the cited file |
citations[].entryId | string | Entry ID of the cited file |
citations[].objectId | string | Object ID of the cited file |
citations[].previewUrl | string | URL to preview the file |
citations[].chunks | array | Specific content chunks referenced |
citations[].chunks[].chunkId | string | Unique identifier for the chunk |
citations[].chunks[].sourceText | string | The text excerpt from the document |
conversationId | string | Unique identifier for this conversation |
Example Response
{
"response": {
"text": "The provided document shows the various HR policies."
},
"citations": [
{
"filename": "Policy.pdf",
"entryId": "535083b1-383a-4352-b993-77900bf5d98a",
"objectId": "52.1e0bffbc-500d-4669-82f9-c984a33813e5",
"previewUrl": "/navigate/file/3bf2374e-49ac-45b2-b3b3-b44e0da88597",
"chunks": [
{
"chunkId": "c590a032-9ac6-467a-aa65-9b58e30bff5b",
"sourceText": "Policy Renewal Migration Portability"
}
]
}
],
"conversationId": "c655a318-268c-47d2-b6e0-d53dedd117ef"
}
Hybrid Search
Perform a hybrid search that combines traditional keyword-based search with semantic (vector) search to deliver more relevant results.
Key Use Case
- Retrieve relevant chunks before sending to LLM
Important Notes
-
Responses may include structured citations
-
Tables and rich content are returned as text chunks
-
No polling required (synchronous)
Request
POST /pubapi/v1/hybrid-search
Request Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
semanticWeight | float | Yes | — | Balance between keyword and semantic search. Range: 0.0 (pure keyword) to 1.0 (pure semantic) |
query | string | Yes | — | The search query text. Must be between 3 and 250 characters |
folderPath | string | No | — | Restrict search to a specific folder path |
collectionId | string | No | — | Restrict search to a specific collection (Knowledge Base) |
createdBy | string | No | — | Filter results by creator username |
createdAfter | long | No | — | Filter results to items created after this timestamp (Unix epoch in milliseconds) |
createdBefore | long | No | — | Filter results to items created before this timestamp (Unix epoch in milliseconds) |
limit | integer | No | 100 | Maximum number of results to return. Range: 1-1000 |
preferredFolderPath | string | No | — | Boost results from this folder path |
excludeFolderPaths | array | No | [] | Exclude results from these folder paths |
folderPaths | array | No | [] | Include results only from these folder paths |
entryIds | array | No | [] | Restrict search to specific entry IDs |
Example Request
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/hybrid-search" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "semanticWeight": 0.5, "query": "quarterly financial report", "folderPath": "/Shared/Finance", "createdBy": "john.doe", "createdAfter": 1609459200000, "limit": 50, "preferredFolderPath": "/Shared/Finance/2023" }'
Response
200 OK
| Field | Type | Description |
|---|---|---|
results | array | List of search results |
results[].filename | string | Name of the file |
results[].entryId | string | Unique identifier for the file entry |
results[].objectId | string | Object identifier |
results[].chunks | array | List of content chunks matching the query |
results[].chunks[].chunkId | string | Unique identifier for the content chunk |
results[].chunks[].chunkText | string | The text content of the chunk |
results[].chunks[].type | string | Type of chunk: TEXT or TABLE |
results[].chunks[].score | float | Relevance score for this chunk |
Example Response
{
"results": [
{
"filename": "Financial_Report_2023.pdf",
"entryId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"objectId": "obj123456",
"chunks": [
{
"chunkId": "chunk-123",
"chunkText": "The quarterly financial report shows a 15% increase in revenue compared to last year.",
"type": "TEXT",
"score": 0.92
},
{
"chunkId": "chunk-124",
"chunkText": "Operating expenses decreased by 5% due to cost optimization initiatives.",
"type": "TEXT",
"score": 0.85
}
]
},
{
"filename": "Budget_Forecast.xlsx",
"entryId": "b2c3d4e5-f6g7-8901-bcde-fg2345678901",
"objectId": "obj234567",
"chunks": [
{
"chunkId": "chunk-456",
"chunkText": "Q1 2023 | Q2 2023 | Q3 2023 | Q4 2023 (Projected)\n$1.2M | $1.4M | $1.5M | $1.7M",
"type": "TABLE",
"score": 0.85
}
]
}
]
}
Error Codes
| Status | Error | Description | Resolution |
|---|---|---|---|
| 400 | Bad Request | Invalid request parameters (e.g., query too short, invalid semanticWeight range) | Check parameter values and constraints in the request body |
| 401 | Unauthorized | Invalid or expired OAuth token | Refresh your OAuth token and retry the request |
| 403 | Forbidden | Insufficient permissions to access the resource | Ensure the user has the required permissions for the file, folder, or Knowledge Base |
| 404 | Not Found | File, folder, or Knowledge Base does not exist | Verify the entry-id, kb-id, or path is correct |
| 409 | Conflict | Forbidden upload location (e.g., /, /Shared, /Private) | Use a valid folder path within an allowed location |
| 429 | Too Many Requests | AI API rate limit exceeded | Implement exponential backoff and check the Retry-After header. Review rate limits above |
Code Examples
curl -i -X POST "https://{domain}.egnyte.com/pubapi/v1/ai/document/13c5b4d4-a324-4141-b2a3-365625969d1e/ask" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -d '{ "question": "What is the date of Christmas Day in the US in 2025?", "chatHistory": { "messages": [] }, "includeCitations": true }'
Related Resources
- Authentication — How to obtain and refresh OAuth tokens
- Best Practices — Rate limiting, pagination, and error handling strategies
- File System API — Manage files and folders in Egnyte
