• Register

AI API

The Egnyte AI API allows you to access AI features supported by Egnyte via API such as ask a question and generate the summary of a document, ask a question to Egnyte Copilot, Knowledge Bases, etc.

URL Encoding

Note that the Path parameter in the API endpoints described below must be URL encoded in a special way. Each element of the path needs to be separately encoded. I.e. the forward slashes ('/') in the path must not be encoded, but the text in between must be. This is required because filesystem paths on Egnyte can contain characters which are not permitted in the path portion of a URL.

For example, this path: Shared/example?path/$file.txt should be encoded as Shared/example%3Fpath/%24file.txt

Rate Limiting

In additiona to general rate limiting as mentioned in Best Practices, our AI APIs have more stringent rate limits that apply to all the AI APIs. These rate limits restrict the number of calls per day, number of calls per minute and number of calls per second. Like the generic rate limits mentioned above, these rate limits are also enforced per access token rather than against the entire key. Integrations should be built with inherent support for receiving and handling these throttles. The default AI API rate limits are:

DescriptionLimit
API Key

100 API calls per day per token
10 API calls per minute per token
2 API calls per second per token

If you anticipate that your API call volume will exceed these limits when your application is in production, please contact us and we can discuss other arrangements.

If your API call is throttled you will see a response with a 429 HTTP status code with the following value for the X-Mashery-Error-Code header field:

ErrorDescription
429 Requests from this source has gone over its rate limit quota. 

API Methods

Ask a Question

Allow users to ask questions related to a given document, providing AI-driven response based on the document content.

POST /pubapi/v1/ai/document/{entry-id}/ask

Request Parameters:

ParameterDescriptionRequiredPossible Values
entry-id The id of the specific version of the file Yes (Included in the endpoint URL) A valid unique string identifying the file version
question 
The specific question user wants to ask against the document 
Yes

A string (e.g. What is the date of Christmas Day in the US in 2025)

includeCitations Whether the response should include citations(defaults to false) No

true/false 

chatHistory An object representing previous interactions No

 

Request Examples

POST /pubapi/v1/ai/document/13c5b4d4-a324-4141-b2a3-365625969d1e/ask HTTP/1.1
    Host: apidemo.egnyte.com
    Authorization: Bearer 68zc95e3xv954u6k3hbnma3q
    Content-Type: application/json
    {
      "question": "What is the date of Christmas Day in the US in 2025?",
	"chatHistory":
 	{
		"messages": []
    	},
    }
curl 'htts://domain.egnyte.com/pubapi/v1/ai/document/82ed268b-4a86-4d63-9a1b-dedae8b98e4b/ask' \
   --data-raw '
    {
    	"question": "What is the date of Christmas Day in the US in 2025?",
    	"chatHistory": {"messages": []}, 
    	"includeCitations": true,
    }
}'

Response Parameters:

ParameterDescription
response The response to the queston
citations A list or object containing citations or references used in generating the response 

Sample Response

{
	"response":
		{
			"text": "The provided document."
		},
	"citations":[
		{
			"filename": "Policy.pdf",
			"entryId": "535083b1-383a-4352-b993-77900bf5d98a",
			"chunks":[
				{
					"chunkId": "0",
					"sourceText": "Policy Renewal Migration Portability"
				}
			]
		}
	]   
}

Summarize a Document

Allow users to generate the summary for a given document, providing AI-driven response based on the document content.

POST/pubapi/v1/ai/document/{entry-id}/summary

Request Parameters:

ParameterDescriptionRequiredPossible Values
entry-id The id of the specific version of the file Yes (Included in the endpoint URL) A valid unique string identifying the file version
chatHistory An object representing previous interactions No

 

Request Examples

POST /pubapi/v1/ai/document/ 13c5b4d4-a324-4141-b2a3-365625969d1e/summary HTTP/1.1
    Host: apidemo.egnyte.com
    Authorization: Bearer 68zc95e3xv954u6k3hbnma3q
    Content-Type: application/json
    {
	"chatHistory":
 	{
		"messages": []
   	},
    }
curl 'htts://domain.egnyte.com/pubapi/v1/ai/document/82ed268b-4a86-4d63-9a1b-dedae8b98e4b/ask' \
   --data-raw '
    {
    	"chatHistory": 
		{
			"messages": []
		},
    }

Response Parameters:

ParameterDescription
response The summary of the document

Sample Response

{
    "response": 
	{
		"text": "Summary of the document is here"
	},
}

Copilot

Allow users to ask questions to the platform copilot, providing AI-driven response based on the global content within their Egnyte domain. Users can optionally specify the specific context (files/folders) to limit the content to be synthesized to get the answer.  

POST /pubapi/v1/ai/copilot/ask

Request Parameters:

ParameterDescriptionRequiredPossible Values
selectedItems The folder id/file entry id of the specific folders/files to be considered for the context No A valid unique string identifying the folder/file version
question 
The specific question the user wants to ask against the document 
Yes

A string (e.g. Describe the file)

includeCitations Whether the response should include citations(defaults to false) No

true/false 

chatHistory An object representing previous interactions No

 

Request Examples

POST /pubapi/v1/ai/copilot/ask HTTP/1.1
    Host: apidemo.egnyte.com
    Authorization: Bearer 68zc95e3xv954u6k3hbnma3q
    Content-Type: application/json
    {
     	"question": "Describe the file",  
	"chatHistory": {  
		"messages": []  
	},  
	"selectedItems": {  
		"folders": [  
			{  
				"id": "d57858be-f45b-4ff8-a27b-fc7be30b32f9"  
			}  
		],  
		"files": [  
			{  
				"entryId": "308314dd-caff-4eb2-889f-8b3babe420a1"  
			}  
		]  
	},  
	"includeCitations": true 
}'
curl --location 'https://domain.com/rest/pubapi/v1/ai/copilot/ask/' \ 
--header 'Content-Type: text/plain' \ 
--data '{  
	"question": "Describe the file",  
	"chatHistory": {  
		"messages": []  
	},  
	"selectedItems": {  
		"folders": [  
			{  
				"id": "d57858be-f45b-4ff8-a27b-fc7be30b32f9"  
			}  
		],  
		"files": [  
			{  
				"entryId": "308314dd-caff-4eb2-889f-8b3babe420a1"  
			}  
		]  
	},  
	"includeCitations": true 
}' 

Response Parameters:

ParameterDescription
responseText The response to the queston asked to copilot
citations A list or object containing citations or references used in generating the response
conversationId A unique identifier for the conversation

Sample Response

{  
	"responseText": "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" 
}

Knowledge Base (KB) Listing

Allow users to get the list of knowledge bases (KB) available within their Egnyte domain.  

POST /pubapi/v1/ai/kb/list

Request Parameters:

ParameterDescriptionRequiredPossible Values
sortBy The sorting criteria for the results Yes createdOn/name
sortDirection The sort direction for the results Yes ASC/DESC
status The status of the KB to be retrieved  Yes ACTIVE/DELETED/CREATED
page The page number to be retrived in a paginated response No A positive number
size The size of the folder or the number of items per page in a paginated response No A positive number
createdBy The ID of the user who created the KB. The result will be filtered by this ID when provided. No A valid unique string identifying the user (e.g. 123)
createdAfter Filter criteria to retrive the KB created after the specified timestamp No A valid date/time in milliseconds (e.g. 1738570114257)
createdBefore Filter criteria to retrive the KB created before the specified timestamp No A valid date/time in milliseconds (e.g. 1738570114257)
includePlaceholderData If true, includes the placeholder data in the response No

true/false

includeProcessingStatistics If true, includes the processing statistics in the response No

true/false 

includePrompts If true, includes the prompt-related data in the response No

true/false

Request Examples

POST /pubapi/v1/ai/kb/list HTTP/1.1
    Host: apidemo.egnyte.com
    Authorization: Bearer 68zc95e3xv954u6k3hbnma3q
    Content-Type: application/json
    {
	"sortBy": [
		 "name"
	],
	"sortDirection": [
		"ASC"
	],
	"status": [
		"ACTIVE"
	],
	"includePlaceholderData": false,
	"includeProcessingStatistics": false,
	"includePrompts": false
    }'
curl --location 'https://{domain}/pubapi/v1/ai/kb/list' \ 
--header 'Content-Type: application/json' \ 
--header 'Accept: application/json' \ 
--data '{
	"sortBy": [
		"name" 
	],
	 "sortDirection": [
		"ASC"
	 ],
	"status": [
		"ACTIVE"
	],
	"includePlaceholderData": false,
	"includeProcessingStatistics": false,
	"includePrompts": false
}' 

Response Parameters:

ParameterDescription
content The object containing the list of the knowledge Bases (KB) entries
content.id Unique identifier of the KB entry
content.name Name of the KB entry
content.description Description of the KB entry
contnet.paths List of folder paths associated with the KB entry
content.paths.id Unique identifier of the path
content.paths.folderId Id of the folder linked with the KB
content.paths.path File path where documents are stored in the KB
content.paths.permission Permission level for the path (e.g. Owner)
content.paths.status Current status of the path (e.g. ACTIVE)
content.status Status of the KB entry
content.type Type of the KB entry (e.g. KBA)
content.createdBy Display name of the user who creted the KB
content.createdByUser Details of the user who created the KB
content.createdByUser.firstName First name of the user who created the KB
content.createdByUser.lastNmae Last. name of the user who created the KB
content.createdByUser.userName Username/email id of the user who created the KB
content.createdByUser.userId User Id of the user who created the KB
content.createdOn Date/time when the KB was created
content.noResponseMessage Feedback response when no AI response is generated 
content.iconName Name of the icon used for the KB in the UI
content.subType Whether the KB was system-defined or user-defined
content.progress Progress of the KB processing (percentage)
content.lastProcessedAt Date/time when the KB was last processed
content.pathCount Number of paths linked with the KB
content.prompts List of the prompts associated with the KB
number Current page number in the paginated response
size Maximum number of elements per page
first Indicates if this is the first page
last Indicates if thisis the last page
empty Indicates if the content is empty
numberOfElements Number of elements in the current page
totalElements Number of elemensts across all pages
totalPages Total number of pages
fileLimit Maximum number of files allowed

Sample 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 (KB)

Allow users to ask questions to a given knowledge base (KB), providing AI-driven response based on the content of that KB.

POST /pubapi/v1/ai/document/{kb-id}/ask

Request Parameters:

ParameterDescriptionRequiredPossible Values
kb-id The id of the specific knowkesge base (KB) Yes (Included in the endpoint URL) A valid unique string identifying the KB
question 
The specific question user wants to ask against the KB 
Yes

A string (e.g. Explain all the organizational HR policies)

includeCitations Whether the response should include citations(defaults to false) No

true/false 

chatHistory An object representing previous interactions No

 

Request Examples

POST /pubapi/v1/ai/kb/13c5b4d4-a324-4141-b2a3-365625969d1e/ask HTTP/1.1
    Host: apidemo.egnyte.com
    Authorization: Bearer 68zc95e3xv954u6k3hbnma3q
    Content-Type: application/json
    {
    	"question": "Explain all the organizational HR policies",
	"chatHistory":
 	{
		"messages": [
			{ 
				"role": "user",
				"content": "Show me the policies"  
			}
			{
				"role": "assistant",
				"content": "I am sorry, but I don't know the answer to this question."
			}      
		 ]
    	},
	"includeCitations": true 
    }
curl 'htts://domain.egnyte.com/pubapi/v1/ai/kb/82ed268b-4a86-4d63-9a1b-dedae8b98e4b/ask' \
   --data-raw '
    {
    	"question": "Explain all the orgnizational HR policies",
    	"chatHistory": 
	{
		"messages": [
			{	
				"role": "user",
				"contnet": "Show me the policies"
			}
			{
				"role": "assistant"
				"contnet": "I am sorry, but I don't know the answer to this question."
			}      
   		]
	}, 
    	"includeCitations": true,
    }
}'

Response Parameters:

ParameterDescription
responseText The response to the queston asked to KB
citations A list or object containing citations or references used in generating the response
conversationId A unique identifier for the conversation

Sample Response

{
	"responseText": "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"    
}

Common Response Codes

ErrorDescription
200 or 201 Successful operation
401 Authentication failure
403 User not authorized (not enough permissions)
404 File or folder resource not found
409 Forbidden file or folder upload location (e.g. /, /Shared, /Private, etc)