1.1.0
Search
K

Cognitive Search API

Cognitive Search API makes it possible for the system to read, infer meaning, and deliver precise answers from large sets of documents with high accuracy.

Uploading Q&A and Documents

Please sign up and sign in to the Alli dashboard first. You must select 'Cognitive Search' for the Project Type when you sign up. Go to the Q&A tab on the dashboard to upload question-answer pairs. If you want to upload unstructured text data such as Word, PDF, Powerpoint, and Excel file, go to the Documents tab in the dashboard and upload the documents.
If you want to automatically sync with your data source, such as MS OneDrive, please go to the Source tab. Uploading the document via API is in the Upload Document section in this page.

Getting the API KEY

Please provide your API key in the request header API-KEY. Your API key can be found in your dashboard Settings menu, under the General tab.

Providing Agent or User Information

For certain endpoints, you can add agent or user information in the request header to specify who makes the call.
Agent information can be provided in the request header AGENT-EMAIL. You can find your agents' email information in your dashboard Settings > Agent menu. Below is an example.
-H 'AGENT-EMAIL: [email protected]'
A user ID can be provided in the request header OWN-USER-ID. The user ID can be either a new one or an existing one, and if a new user ID is provided, Alli will create a new user with that ID. Any future API calls with the same OWN-USER-ID header will be considered as they're from the same user.
If you want to update the user's email address at the same time, you can provide the email address in the request header USER-EMAIL. Below is an example.
-H 'OWN-USER-ID: 5f1234567a409876c082487z' \
-H 'USER-EMAIL: [email protected]'
You cannot use non-ASCII characters for OWN-USER-ID. If the user ID includes any non-ASCII characters, you can encode the ID to base64 and use base64:CONVERTED_ID.
You can find saved user ID and email information in your Alli dashboard Customers menu.

Error Messages

Please read the error message you get if you don't get the response that you expected. For example, if you don't use the right HTTP method for the API, you'll get this type of error as response:
{“error”: “Method Not Allowed POST: /webapi/faq_feedbacks”}
post
https://backend.alli.ai
/webapi/faq
Search from Q&A

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.
curl -d '{
"query": "How much is it?",
"maxResults": 3,
"hashtags": ["wiki", "knowledge"],
"hashtagsOperator": "OR",
"format": "text"}' \
-H 'API-KEY: YOUR API KEY' \
-H 'Content-Type: application/json' \
https://backend.alli.ai/webapi/faq

Response Example

{"result":
[
{
"confidence": 0.8371959004827834,
"effectiveConfidence": 0.9698303406362148,
"question": "How is the product priced?",
"answer": "We have a pricing table that includes a free plan.",
"id": "ClMVIjCoNDAiZDLyNWZhM1O3YTUIIKZjPPRcER==",
"hashtags": [],
"lastUpdatedDate": "2020-11-19",
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
},
{
"confidence": 0.6119840535714456,
"effectiveConfidence": 0.7738889000171243,
"question": "Do you have a pricing table?",
"answer": "Yes we do. Please check out our website",
"id": "RkFROjVmNDAwZDMyNWZhM2Y4YTA1ZDZjNWUwMQ==",
"hashtags": [],
"lastUpdatedDate": "2020-11-20",
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
],
"count": 2,
"hashId": "d4ca12d4e64766er0c2b45f4aa5463a4"
}
post
https://backend.alli.ai
/webapi/mrc
Search from Documents

Request Example (hashtags)

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.
curl -X POST -d '{
"query": "can I disclose the composite ratings?",
"maxResults": 3,
"hashtags": ["wiki", "knowledge"],
"hashtagsOperator": "OR",
"format": "text",
"returnPdfPreview": true,
"returnPdfPreviewRawData": true \
-H 'API-KEY: YOUR API KEY' \
-H 'Content-Type: application/json' \
https://backend.alli.ai/webapi/mrc

Request Example (combinedHashtags)

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.
curl -X POST -d '{
"query": "can I disclose the composite ratings?",
"maxResults": 3,
"hashtags": [],
"hashtagsOperator": "OR",
"combinedHashtags": [["wiki","knowledge"],["elibrary","compliance"]]
"combinedHashtagsOperator": "AND",
"format": "text",
"returnPdfPreview": true,
"returnPdfPreviewRawData": true }' \
-H 'API-KEY: YOUR API KEY' \
-H 'Content-Type: application/json' \
https://backend.alli.ai/webapi/mrc

Response Example

{
"count": 2,
"result": [
{
"answer": "an institution’s board of directors and senior management",
"answerHash": "8430cf3b9af628abc1bb063802db39be",
"confidence": 0.9998937845230103,
"effectiveConfidence": 1,
"documentId": "S25vd2xlZGdlQmFzZTo1ZjMzODFkZmNhYWJjYWUyMjkzYjFhY2U=",
"documentName": "Policy document 1.docx",
"hashtags": [
"hashtag1",
"hashtag2"
],
"pageNo": 5,
"createdDate": "2020-11-18",
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"pdfPreviewRawData": {
"pdfs": [
{
"pdfUrl": "PDF_ACTUAL_URL",
"pageNo": 1,
"highlight_indexes": [
12
]
},
{
"pdfUrl": "PDF_ACTUAL_URL",
"pageNo": 2,
"highlight_indexes": [
12,
13,
14
]
}
],
"totalPageNo": 10
},
"pdfPreview" : "PDF_PREVIEW_URL"
"folder": "folder 1",
"viewer": ["[email protected]"]
},
{
"answer": "banks cannot, except in very limited circumstances",
"answerHash": "d849a49662a4f21df51de24d06196547",
"confidence": 0.9998629689216614,
"effectiveConfidence": 0.9998629689216614,
"documentId": "S25vd2xlZGdlQmFzZTo1ZjMzODFkZmNhYWJjYWUyMjkzYjFhY2U=",
"documentName": "Bank policy 2020.pdf",
"hashtags": [
"hashtag1",
"hashtag2"
],
"pageNo": 220,
"createdDate": "2020-11-18",
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"pdfPreviewRawData": {
"pdfs": [
{
"pdfUrl": "PDF_ACTUAL_URL",
"pageNo": 1,
"highlight_indexes": [
12
]
}
],
"totalPageNo": 5
},
"pdfPreview" : "PDF_PREVIEW_URL"
}
]
}
get
https://backend.alli.ai
/webapi/single_faq
Get Single Q&A

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section to get the api key.
curl -X GET \
-d '{"id": "iuHjHBhjHGbhjm==", "format": "text"}' \
-H "API-KEY: YOUR API KEY" \
https://backend.alli.ai/webapi/single_faq

Response Example

{
"result": {
"question": "Who is there?",
"similarQuestion": ["Who's present?", "Who is it?"],
"answer": "Elmo",
"id": "RkFROjYwMmY2ZTQ0YWZmMWQ5YmQ0NmM5Y2VkNw==",
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 1
},
"lastUpdatedDate": "2021-02-19",
"createdDate": "2021-02-19",
"hashtags": []
}
}
get
https://backend.alli.ai
/webapi/single_document
Get Single Document

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section to get the api key.
curl -X GET \
-d '{"id": "S25vd2xlZGdlQmFzZTo1ZjMzODFkZmNhYWJjYWUyMjkzYjFhY2U="}' \
-H "API-KEY: YOUR API KEY" \
https://backend.alli.ai/webapi/single_document

Response Example

{"result": {
"id": "S25vd2xlZGdlQmFzZTo1ZjMzODFkZmNhYWJjYWUyMjkzYjFhY2U=",
"documentName": "Policy document 1.docx",
"createdDate": "2020-11-12",
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"hashtags" : ["hashtag1", "hashtag2"]
}
}
get
https://backend.alli.ai
/webapi/faq_feedbacks
Q&A Feedbacks

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section to get the api key.
If you'd like to get a feedback list from a specific user, please put OWN-USER-ID in the header. If you'd like to get a feedback list from a specific agent, please put AGENT-EMAIL in the header. Without OWN-USER-ID or AGENT-EMAIL, all the feedbacks will be returned.
curl -X GET \
-d '{"offset": 0, "limit": 10}' \
-H "API-KEY: YOUR API KEY" \
https://backend.alli.ai/webapi/faq_feedbacks

Response Example

{
"result": [
{
"query": "where is the office?",
"feedbacks": [
{
"faqId": "RkFROjVmNDA1MWVkMTFmOWJjMTJjOGUwMTg5YQ==",
"positive": true
},
{
"faqId": "RkFROjVmNDA1MWVkMTFmOWJjMTJjOGUwMThhNA==",
"positive": false
},
{
"faqId": "RkFROjVmNDA1MWVjMTFmOWJjMTJjOGUwMTgyYw==",
"positive": true
}
]
},
{
"query": "Are you funded?",
"feedbacks": [
{
"faqId": "RkFROjVmNDA1MWVjMTFmOWJjMTJjOGUwMTgyNw==",
"positive": true
}
]
}
],
"count": 4
}
post
https://backend.alli.ai
/webapi/faq_feedback
Q&A Feedback

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section to get the api key.
Please replace Q&A_ID accordingly. About getting Q&A_ID, please take a look at Search from Q&A or Q&A Feedbacks section. It's id in Response Example of Search from Q&A section, or faq_id in Response Example of Q&A Feedbacks.
curl https://backend.alli.ai/webapi/faq_feedback \
-d '{"query": "What do I do if I didn't get a receipt?",
"id": "Q&A_ID",
"isPositive": true}' \
-H "API-KEY: YOUR API KEY" \
-H "Content-Type: application/json"

Response Example

{
"result": {
"faqTrainSearchResult": {
"faq": {
"id": "RkFROjVlOTc5MWExMjM5NjFiNzYzOTcxMWI1Mg=="
},
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
}
},
"errors": null
}
post
https://backend.alli.ai
/webapi/faq/user_feedback
Q&A User Feedback

Request Example

curl https://backend.alli.ai/webapi/faq/user_feedback \
-H 'API-KEY: YOUR_API_KEY' \
-H "Content-Type: application/json" \
-d '{
"query": "QUERY",
"prev": PREVIOUSLY_ASSIGNED_FEEDBACK,
"id": "FAQ_ID",
"positive": true
}'

Response Example

{
"result": {
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
}
}
post
https://backend.alli.ai
/webapi/upload_faq_file
Upload Q&As

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl -F 'file=@/location/to/your_file' \
-H 'API-KEY: YOUR_API_KEY'
https://backend.alli.ai/webapi/upload_faq_file

Response Example

{
"result": "success",
"notUploaded": [
{
"question": "How to teach AI",
"state": "dup"
},
{
"question": "I'd like to schedule a meeting or a demo.",
"state": "up"
}
]
}
post
https://backend.alli.ai
/webapi/register_faq
Add Q&A

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl 'https://backend.alli.ai/webapi/register_faq' \
-H 'API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"status": "ON",
"question": "Where is the office?",
"similarQuestions": ["Office location?", "Office address?"],
"answer": "We have offices in Oakland(US), Seoul(Korea), and Tokyo(Japan)",
"hashtags": ["office", "location"],
"memo": "Added from API",
"folder": "folder 1",
"agentEditor": ["[email protected]"],
"agentViewer": ["your@email_2.com"],
"userViewer": {
"variables": {
"CUSTOMER_ID": ["id_1", "id_2"],
"CUSTOMER_GROUP": ["{categoryElementId}", "{categoryElementId}"]
}
},
"followFolderPermission": false,
"allowOtherAgentsView": true,
"allowOtherUsersView": true
}'

Response Example

{
"result": {
"status": "created",
"id": "RkFROkYwYRQxYzIzMDcxYWM5M3JlOWR5Y2EeOQ=="
},
"errors": null
}
post
https://backend.alli.ai
/webapi/delete_faq
Delete Q&A

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl 'https://backend.alli.ai/webapi/delete_faq' \
-H 'API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d {
"id": "RkFROkYwYRQxYzIzMDcxYWM5M3JlOWR5Y2EeOQ=="
}

Response Example

{
"result": {
"status": "deleted"
},
"errors": null
}
get
https://backend.alli.ai
/webapi/faqs
List Q&As

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl -X GET 'https://backend.alli.ai/webapi/faqs' \
-H 'API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"searchTerm": "Allganize",
"isUsed": true,
"hashtags": ["company", "Alli"],
"hashtagsOperator": "OR",
"createdByAgent": true,
"answeredByMrc": true,
"autoGenerated": false,
"editedByAgent": false,
"format": "text",
"offset": 0,
"limit": 10
}'

Response Example

{
"offset": 0,
"count": 2,
"totalCount": 2,
"results": [
{
"id": "RkRODjYwUIr2YTUzYTc0MjNmMDgxOTFkZTRlNA==",
"question": "How many people work at Allganize?",
"answer": "Currently (Nov 2019), we have 16 employees working at three different locations.",
"hashtags": [
"company",
"actual"
],
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"lastUpdatedDate": "2021-05-04",
"createdDate": "2021-02-23"
},
{
"id": "RkFROjYwIdU4YTUzYTc0MjNmUR2wOTFkZTU1OA==",
"question": "Do you have any references or case studies?",
"answer": "We do! Check out our recent case studies and other articles on our blog: https://blog.allganize.ai/",
"hashtags": [
"company",
"actual"
],
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"lastUpdatedDate": "2021-05-04",
"createdDate": "2021-02-23"
}
]
}
get
https://backend.alli.ai
/webapi/faq_candidates
Q&A Candidates

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl -X GET \
-d '{ "hashtags": ["wiki"],
"searchTerm": "user",
"order": "FREQUENCY_DESC",
"state": "ALL",
"offset": 0,
"limit": 10}' \
-H "API-KEY: YOUR API KEY" \
https://backend.alli.ai/webapi/faq_candidates

Response Example

{
"result": {
"faqCandidates": [
{
"id": "RkFRQ2FuZGlkYXRlOjVlYjA3OGU5MGFmZmMyM2QxZjc4ZTMzMQ==",
"frequency": 1,
"textAnswer": "This is how to use it, A from Z.\n— From User Guide.pdf",
"state": "ACTIVE",
"createdAt": 1588623593321,
"questions": [{
"id": "RkFRQ2FuZGlkYXRlUXVlc3Rpb246NWViMDc4ZTkwYWZmYzIzZDFmNzhlMzMw",
"question": "User manual?",
"frequency": 1,
"history": {
"id": "Q29udmVyc2F0aW9uOjVlYjA3OGI2NWUyMTJlMTMzZDM4NDAzOA=="
}
}]
},
{
"id": "RkFRQ2FuZGlkYXRlOjVlOWEzZWI2MmZlOTFkMzIwYjE2YWQyOQ==",
"frequency": 1,
"textAnswer": "You can cancel the policy in 15 days\n— From UserPolicy.pdf",
"state": "ACTIVE",
"createdAt": 1587166902114,
"questions": [{
"id": "RkFRQ2FuZGlkYXRlUXVlc3Rpb246NWU5YTNlYjYyZmU5MWQzMjBiMTZhZDI4",
"question": "Can I cancel?",
"frequency": 1,
"history": {
"id": "Q29udmVyc2F0aW9uOjVlOWEzZDliNjU5YmM2NTEyMTk5MDQ3Ng=="
}
}]
}
],
"count": 1
},
"errors": null
}
post
https://backend.alli.ai
/webapi/add_faq_candidates
Q&A Candidates

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl https://backend.alli.ai/webapi/add_faq_candidates \
-d '{"queries": ["what is that processor", "how much does the processor cost"]}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"

Response Example

{
"result": {
"candidates": [
{
"id": "RkFRQ2FuZGlkYXRlOjVmOGE1ZDA0ODgxNzc0OWNjMWUwMzRiNg=="
},
{
"id": "iGBiuGIGIugBIGBIugBIuBGiHBiJUhbhIBgIbKHJBJCYUBLHKGJfBJbIb=="
}
]
},
"errors": null
}
get
https://backend.alli.ai
/webapi/mrc_feedbacks
Documents Feedbacks

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
If you'd like to get a feedback list from a specific user, please put OWN-USER-ID in the header. If you'd like to get a feedback list from a specific agent, please put AGENT-EMAIL in the header.
curl -X GET \
-d '{"offset": 0, "limit": 10}' \
-H "API-KEY: YOUR API KEY" \
https://backend.alli.ai/webapi/mrc_feedbacks

Response Example

{
"result": [
{
"query": "cancel the policy",
"feedbacks": [
{
"documentId": "S25vd2xlZGdlQmFzZTo1ZWM1YmJiZTczNmUxNmM0NDRjZDI2ZGM=",
"answer": "You can cancel the policy in 30 days.",
"answerHash": "44094c4a281484daadf28e67a4745747",
"positive": true
},
{
"documentId": "S25vd2xlZGdlQmFzZTo1ZWM1YmJiZTczNmUxNmM0NDRjZDI2ZGM=",
"answer": "This is how you enroll the policy.",
"answerHash": "296ffa9691166c583b00365fb6839a06",
"positive": false
},
{
"documentId": "S25vd2xlZGdlQmFzZTo1ZWM1YmJiZTczNmUxNmM0NDRjZDI2ZGM=",
"answer": "You cannot get refunded upon cancelation after 30 days.",
"answerHash": "48e5273910c913dbf0fc08482f7cd22c",
"positive": true
}
]
}
],
"count": 3
}
post
https://backend.alli.ai
/webapi/mrc_feedback
Documents Search Feedback

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section. Please replace DOCUMENT_ID and ANSWER_HASH accordingly. About getting document id and answer hash, please take a look at Search from Documents or Documents Feedbacks section.
curl https://backend.alli.ai/webapi/mrc_feedback \
-d '{"query": "what is that processor",
"id": "DOCUMENT_ID",
"answerHash": "ANSWER_HASH",
"isPositive": false}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"

Response Example

{
"result": {
"mrcFeedbackSearchResult": {
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 1
}
}
},
"errors": null
}
post
https://backend.alli.ai
/webapi/mrc/user_feedback
Documents Search User Feedback

Request Example

curl -request POST 'https://backend.alli.ai/webapi/mrc/user_feedback' \
--header 'API-KEY: YOUR_API_KEY' \
-d '{
"query": "QUERY",
"answerHash": "RESULT_ID",
"id": "DOCUMENT_ID",
"positive": true
}'

Response Example

{
"result": {
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
}
}
post
https://backend.alli.ai
/webapi/upload_file
Document Upload APIs

Request Example

Please replace file=@/location/to/your_file with the location and the name of the file you are uploading, and YOUR_HASH_TAG with the hashtag you want to add to the file. Also, please replace YOUR_API_KEY with your actual API key. To get the api key, please see getting-api-key section.
curl -F 'file=@"/location/to/your_file"' \
-F 'hashtags="[\"api1\", \"api2\"]"' \
-F 'footerUrl="www.allganize.ai"' \
-F 'footerTitle="Allganize website"' \
-F 'folder="folder 1"' \
-F 'followFolderPermission=false' \
-F 'agentViewer="[\"[email protected]\"]"' \
-F 'userViewer="{
\"variables\": {
\"CUSTOMER_ID\": [\"customer_1\"],
\"CUSTOMER_GROUP\": [\"Q2F0ZWdvcnlFbGVtZW5OAjYzNzkyZDY1NWM5ZDIxMTU5NDMwZDY1OA==\"]
}
}"' \
-H 'API-KEY: YOUR_API_KEY' https://backend.alli.ai/webapi/upload_file

Response Example

{
"result": {
"id": "S25vd2xlZGdlQmA23To2MGJjIsjA1YjM1Nz9iRc1YWIzYjA1ODk=",
"fileName": "policy.docx",
"hashtags": [
"api1",
"api2"
],
"footer": "{\"blocks\": [{\"key\": \"oio7\", \"text\": \"— From ocr_en.png\", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [{\"offset\": 0, \"length\": 17, \"style\": \"ITALIC\"}], \"entityRanges\": [{\"offset\": 7, \"length\": 10, \"key\": 0}], \"data\": {}}], \"entityMap\": {\"0\": {\"type\": \"LINK\", \"mutability\": \"MUTABLE\", \"data\": {\"url\": \"https://download.alli.ai/download_document/UHJvamUiddDo1ZGMxYmI1qwe0ZTk0YWNmMmY5MjRlMzU=/S12vd2xlZGdlQmFzZTo2MGJijef1YjM1Nzc4NTc1YWIzYjA1ODk=\"}}}}",
"folder": "folder 1",
"agentEditor": ["[email protected]", "[email protected]"],
"agentViewer": ["[email protected]"],
"allowOtherAgentsView": true,
"allowOtherUsersView": true,
"properties": {}
}
}                                                                                                         
post
https://backend.alli.ai
/webapi/upload_from_s3
Upload Documents from S3

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl https://backend.alli.ai/webapi/upload_from_s3 -d '{
"path": "s3://YOUR_S3_FILE_PATH",
"secretKey": "YOUR_SECRET_KEY",
"accessKey": “YOUR_ACCESS_KEY",
"bucket": "YOUR_BUCKET_NAME",
"hashtags": ["HASHTAG_1", "HASHTAG_2"],
"footerTitle": "Allganize API Documentation",
"footerUrl": "docs.allganize.ai"},
"folder": "folder 1",
"followFolderPermission": false,
"agentViewer": ["[email protected]"],
"userViewer": {
"variables": {
"CUSTOMER_ID": ["id_1"],
"CUSTOMER_GROUP": ["{categoryElementsId}"]
}
}}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"

Response Example

{
"result": {
"id": "S25vd2xlZGdlQmA23To2MGJjIsjA1YjM1Nz9iRc1YWIzYjA1ODk=",
"fileName": "policy.docx",
"hashtags": [
"api1",
"api2"
],
"footer": "{\"blocks\": [{\"key\": \"oio7\", \"text\": \"— From ocr_en.png\", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [{\"offset\": 0, \"length\": 17, \"style\": \"ITALIC\"}], \"entityRanges\": [{\"offset\": 7, \"length\": 10, \"key\": 0}], \"data\": {}}], \"entityMap\": {\"0\": {\"type\": \"LINK\", \"mutability\": \"MUTABLE\", \"data\": {\"url\": \"https://download.alli.ai/download_document/UHJvamUiddDo1ZGMxYmI1qwe0ZTk0YWNmMmY5MjRlMzU=/S12vd2xlZGdlQmFzZTo2MGJijef1YjM1Nzc4NTc1YWIzYjA1ODk=\"}}}}",
"folder": null,
"agentEditor": [
],
"agentViewer": [],
"userViewer": {
"variables": {
"CUSTOMER_ID": [
{
"id": "new_user_1",
"value": "new_user_1"
}
],
"CUSTOMER_GROUP": [
{
"id": "Q2F0ZWdvcnlFbGVtZW50OjYzNdf2MjU0OWU4OTM4N2IzMTkxN2Y0ZA==",
"value": "group_1"
},
{
"id": "Q2F0ZWdvcnlFbGVtZW50OjYzNziymRU1Nzg4YWFmODVjZTU1YjVkMg==",
"value": "group_2"
}
]
}
},
"allowOtherAgentsView": true,
"allowOtherUsersView": false,
"properties": {}
}
}
get
https://backend.alli.ai
/webapi/check_file_status
Check Document Status

Request Example

Please replace YOUR_API_KEY to your one in the example below. To get the api key, please see getting-api-key section. Please replace DOCUMENT_ID accordingly as well. About getting document id, please take a look at Search from Documents or the Documents Feedbacks section.
curl -X GET https://backend.alli.ai/webapi/check_file_status \
-d '{"id": "DOCUMENT_ID"}' \
-H "API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json"

Response Example

{"result":
{"id": "S25vd2xlZGdlQmFzZTo1ZWM1YmJiZTczNmUxNmM0NDRjZDI2ZGM",
"status": "initializing"}}
Status contains one of the following values.
'initializing : preparing for the processing or waiting
'converting': converting the files
'conversion_complete'
'conversion_fail'
'parsing': parsing for retrievers
'parsing_fail'
'completed': parsing and embedding are done
post
https://backend.alli.ai
/webapi/delete_file
Delete Documents

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section. Please replace DOCUMENT_ID accordingly as well. About getting document id, please take a look at Search from Documents or Documents Feedbacks section.
curl -d '{"ids": ["DOCUMENT_ID"]}' \
-H "API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
https://backend.alli.ai/webapi/delete_file

Response Example

{
"result": {
"ok": true,
},
"errors": null
}
get
https://backend.alli.ai
/webapi/knowledge_base_preview
Preview Documents

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section. Please replace DOCUMENT_ID accordingly as well. About getting document id, please take a look at Search from Documents or Documents Feedbacks section.
curl -d '{"id": "DOCUMENT_ID", "pageNo": 1}' \
-H "API-KEY: YOUR_API_KEY" \
-H "Content-Type: application/json" \
https://backend.alli.ai/webapi/knowledge_base_preview

Response Example

Please note that if there is an error, such as a pageNo that does not exist, the response will return null for "pdf" within the "result".
{
"result": {
"totalPageCount": 3,
"pageNo": 1,
"css": null,
"body": null,
"highlightIndexes": [],
"exactAnswer": null,
"pdf": "PDF",
"draftjs": null,
"highlights": {
"indexes": null,
"pageIndexes": [],
"__typename": "KnowledgeBasePreviewHighlights"
},
"knowledgeBase": {
"id": "DOCUMENT_ID",
"title": "DOCUMENT_TITLE",
"__typename": "MSDocsKnowledgeBase"
},
"__typename": "KnowledgeBasePreview"
},
"errors": null
}
get
https://backend.alli.ai
/webapi/knowledge_bases
List Documents

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl -X GET -d '{"status": true,
"offset": 0,
"limit": 10,
"order": "FILE_NAME_ASC",
"searchTerm": "term1 OR term2"
"hashtags": ["policy", "insurance"],
"hashtagsSearchOperator": "OR"}' \
-H 'API-KEY: YOUR_API_KEY' \
https://backend.alli.ai/webapi/knowledge_bases
You can use one of the following values for the order parameter.
Value
Description
SCORE
Descending order by score. It's a default value if a searchTerm value exists.
FILE_NAME_ASC
Ascending order by file name.
FILE_NAME_DESC
Descending order by file name.
TYPE_ASC
Ascending order by file type.
TYPE_DESC
Descending order by file type.
STATUS_ASC
Ascending order by on/off status.
STATUS_DESC
Descending order by on/off status.
CREATED_AT_ASC
Ascending order by uploaded date&time.
CREATED_AT_DESC
Descending order by uploaded date&time.

Response Example

{
"result": {
"items": [
{
"id": "S23wd2xlZGdlQmRzZTo1ZmFmMzYwZ3IyYjliMTI2OTAyMWVmMDQ=",
"fileName": "policy1.docx",
"hashtags": ["policy"],
"score": 1.0,
"downloadUrl": "https://download.alli.ai/download_document/UHJvamVjdDo1YzZiYjYyNDQxNmFmYzAwMDgyMTQwNDU=/S23wd2xlZGdlQmRzZTo1ZmFmMzYwZ3IyYjliMTI2OTAyMWVmMDQ=",
"footerUrl": "https://download.alli.ai/download_document/UHJvamVjdDo1YzZiYjYyNDQxNmFmYzAwMDgyMTQwNDU=/S23wd2xlZGdlQmRzZTo1ZmFmMzYwZ3IyYjliMTI2OTAyMWVmMDQ=",
"folder": "folder 2",
"viewer": ["[email protected]"]
},
{
"id": "S75vd2elZGdlQmFzZTo1ZmFlMjdhYmMx22E3MWM1MzA0NDI3ZWQ=",
"fileName": "insurance_policy.pdf",
"hashtags": ["policy", "insurance"],
"score": 0.89,
"downloadUrl": "https://download.alli.ai/download_document/UHJvamVjdDo1YzZiYjYyNDQxNmFmYzAwMDgyMTQwNDU=/S75vd2elZGdlQmFzZTo1ZmFlMjdhYmMx22E3MWM1MzA0NDI3ZWQ=",
"footerUrl": "www.example.com",
"folder": "folder 2",
"viewer": ["[email protected]"]
}
]
},
"errors": null
}
post
https://backend.alli.ai
/webapi/knowledge_bases
List Documents

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl -X GET -d '{"status": true,
"offset": 0,
"limit": 10,
"order": "FILE_NAME_ASC",
"searchTerm": "term1 OR term2"
"hashtags": ["policy", "insurance"],
"hashtagsSearchOperator": "OR"}' \
-H 'API-KEY: YOUR_API_KEY' \
https://backend.alli.ai/webapi/knowledge_bases
You can use one of the following values for the order parameter.
Value
Description
SCORE
Descending order by score. It's a default value if a searchTerm value exists.
FILE_NAME_ASC
Ascending order by file name.
FILE_NAME_DESC
Descending order by file name.
TYPE_ASC
Ascending order by file type.
TYPE_DESC
Descending order by file type.
STATUS_ASC
Ascending order by on/off status.
STATUS_DESC
Descending order by on/off status.
CREATED_AT_ASC
Ascending order by uploaded date&time.
CREATED_AT_DESC
Descending order by uploaded date&time.

Response Example

{
"result": {
"items": [
{
"id": "S23wd2xlZGdlQmRzZTo1ZmFmMzYwZ3IyYjliMTI2OTAyMWVmMDQ=",
"fileName": "policy1.docx",
"hashtags": ["policy"],
"score": 1.0,
"downloadUrl": "https://download.alli.ai/download_document/UHJvamVjdDo1YzZiYjYyNDQxNmFmYzAwMDgyMTQwNDU=/S23wd2xlZGdlQmRzZTo1ZmFmMzYwZ3IyYjliMTI2OTAyMWVmMDQ=",
"footerUrl": "https://download.alli.ai/download_document/UHJvamVjdDo1YzZiYjYyNDQxNmFmYzAwMDgyMTQwNDU=/S23wd2xlZGdlQmRzZTo1ZmFmMzYwZ3IyYjliMTI2OTAyMWVmMDQ=",
"folder": "folder 2",
"viewer": ["[email protected]"]
},
{
"id": "S75vd2elZGdlQmFzZTo1ZmFlMjdhYmMx22E3MWM1MzA0NDI3ZWQ=",
"fileName": "insurance_policy.pdf",
"hashtags": ["policy", "insurance"],
"score": 0.89,
"downloadUrl": "https://download.alli.ai/download_document/UHJvamVjdDo1YzZiYjYyNDQxNmFmYzAwMDgyMTQwNDU=/S75vd2elZGdlQmFzZTo1ZmFlMjdhYmMx22E3MWM1MzA0NDI3ZWQ=",
"footerUrl": "www.example.com",
"folder": "folder 2",
"viewer": ["[email protected]"]
}
]
},
"errors": null
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. To get the api key, please see getting-api-key section.
curl -X GET 'https://backend.alli.ai/webapi/search_document_by_title' \
-H 'API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
--data-urlencode “query=cpu specs” \
--data-urlencode “hashtags=company,alli”