Search from Q&A
POST
https://backend.alli.ai/webapi/faq
This API lets you find the most relevant question and answer pairs from your Q&A knowledge base.
Request Body
200 The API will find the most relevant question and answers from your Q&A database.
confidence: It shows the confidence value from AI model. Shown as a number value between 0 and 1.
effectiveConfidence: When you provide feedback to the query result, it automatically trains the AI model. Effective confidence is the adjusted score with these users' and agents' feedback. Shown as a number value between 0 and 1.
question: This is the question part of the selected Q&A pair.
answer: This is the answer part of the selected Q&A pair.
id: This is used to identify the result to give or cancel feedback.
hashtags: Hashtags registered for the Q&A.
lastUpdatedDate: The date when the Q&A is last updated.
agentFeedback: The feedback from agents (through dashboard and REST calls) about this Q&A.
userFeedback: The feedback from users (through conversation) about this Q&A.
count: The number of suggested Q&As.
hashId: This hash id is being used when you call select_answer later.
The number of search results and the threshold follows your dashboard setting. Please check your settings in Q&A > Settings.
Copy {"result":
[
{
"confidence": CONFIDENCE_VALUE,
"effectiveConfidence": EFFECTIVE_CONFIDENCE_VALUE,
"question": "QUESTION_1",
"answer": "ANSWER_1",
"id": "ID_1",
"hashtags": [],
"lastUpdatedDate": "DATE",
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
}, ...
],
"count": 3,
"hashId": "HASH_ID"
}
Search from Documents
POST
https://backend.alli.ai/webapi/mrc
Documents API finds an answer from your unstructured text documents and even from complex tables.
Request Body
Get Single Q&A
GET
https://backend.alli.ai/webapi/single_faq
This is the method to get all the details of a single Q&A.
Request Body
200 Includes fields:
question: The question associated with the Q&A.
answer : The answer to the question.
id: The id of this Q&A.
userFeedback: The feedback from users (through conversation) about this Q&A.
agentFeedback: The feedback from agents (through dashboard and REST calls) about this Q&A.
lastUpdatedDate, createdDate: The date when the Q&A was updated / first created.
hashtags: All hashtags associated with this question.
Copy {
"result": {
"question": "Who is there?",
"answer": "Elmo",
"id": "RkFROjYwMmY2ZTQ0YWZmMWQ5YmQ0NmM5Y2VkNw==",
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 1
},
"lastUpdatedDate": "2021-02-19",
"createdDate": "2021-02-19",
"hashtags": []
}
}
Get Single Document
GET
https://backend.alli.ai/webapi/single_document
This is the method to get all details of a single document.
Request Body
200 You will get the result as the following JSON format.
id: The Document's ID.
documentName: The document's file name.
createdDate: The date when the document was uploaded.
hashtags: Hashtags registered for the document.
agentFeedback : Counts of positive and negative ratings by employees.
userFeedback: The feedback from users about this document{"result": {
Q&A Feedbacks
GET
https://backend.alli.ai/webapi/faq_feedbacks
This API lets you get the list of feedbacks given to Q&A pairs for each search query.
Request Body
200 You will get the result as the following JSON format.
query: It's the search query that has feedback for Q&A search results.
feedbacks: It contains detailed feedback information for the query, faqId and postive.
faqId: The Q&A pair's ID that has the feedback information.
positive: true or false. true indicates that the Q&A pair has positive feedback upon the search, and false indicates negative feedback.
count: The total number of feedbacks listed.
Q&A Feedback
POST
https://backend.alli.ai/webapi/faq_feedback
This API lets you give or cancel feedback given to a Q&A pair for a search query.
Request Body
200 You will get the result as the following JSON format.
id: The ID for the Q&A you want to give or cancel feedback for the query. It's the same one you used for the request.
positiveCount: The total number of positive feedbacks after the request is processed.
negativeCount: The total number of negative feedbacks after the request is processed.
Q&A User Feedback
POST
https://backend.alli.ai/webapi/faq/user_feedback
The feedback registered with the above API will be submitted as user feedback. This API registers user feedback (user feedback is what the users who use the Alli chatbot and approve or disprove of answers submit).
Request Body
200 Returns the current user feedback for this FAQ, both the positiveCount and negativeCount.
Copy {
"result": {
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
}
}
Upload Q&As
POST
https://backend.alli.ai/webapi/upload_faq_file
You can upload multiple Q&As in the tsv, csv, xlsx, and zip format using this API.
Request Body
200 result: success if the file upload is successful.
notUploaded: If any of the questions are not uploaded or updates existing Q&A, the details will be listed here.
question: The question part of not-uploaded or updated Q&A.
state: dup if the Q&A is not uploaded due to duplication in 'similar questions' content. up if the Q&A updated an existing one due to the same question content.
Copy {
"result": "success",
"notUploaded": [
{
"question": "QUESTION_1",
"state": "dup"
},
{
"question": "QUESTION_2",
"state": "up"
}
]
}
Add Q&A
POST
https://backend.alli.ai/webapi/register_faq
You can add a new Q&A or update an existing Q&A using this API.
Request Body
200 status: The status of the registered Q&A. 'created' means the Q&A is newly created. 'updated' means an existing Q&A is updated with a new answer.
id: The registered Q&A's ID.
Copy {
"result": {
"status": "created",
"id": "Q&A_ID"
},
"errors": null
}
Delete Q&A
POST
https://backend.alli.ai/webapi/delete_faq
You can delete a Q&A using this API.
Request Body
200 status: 'deleted' if the Q&A is successfully deleted. 404 When there's no Q&A with the ID, this error will be returned.
Copy {
"result": {
"status": "deleted"
},
"errors": null
}
Copy {
"errors": "The record doesn't exist."
}
List Q&As
GET
https://backend.alli.ai/webapi/faqs
You can list Q&As in the Knowledge Base using this API.
Request Body
200 offset: The same offset value with the offset request parameter.
count: Total number of Q&As listed after limit is applied.
totalCount: Total number of Q&As as the result of applied filters.
id: The ID of the Q&A.
question: The question part of the Q&A.
answer: The answer part of the Q&A.
hashtags: The hashtags added on the Q&A.
userFeedback: Number of positive and negative user feedbacks. User feedbacks affects the search result for future queries.
agentFeedback: Number of positive and negative agent feedbacks. Agent feedbacks affects the search result for future queries.
lastUpdatedDate: The date when the Q&A is last updated.
createdDate: The date when the Q&A is created.
Copy {
"offset": 0,
"count": 10,
"totalCount": 12,
"results": [
{
"id": "Q&A_ID_1",
"question": "QUESTION_1",
"answer": "ANSWER_1",
"hashtags": [
"HASHTAG_1",
"HASHTAG_2"
],
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"lastUpdatedDate": "2021-05-04",
"createdDate": "2021-02-23"
},
{
"id": "Q&A_ID_2",
"question": "QUESTION_2",
"answer": "ANSWER_2",
"hashtags": [
"HASHTAG_1",
"HASHTAG_3"
],
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"lastUpdatedDate": "2021-05-04",
"createdDate": "2021-02-23"
}, ...
]
}
Q&A Candidates
GET
https://backend.alli.ai/webapi/faq_candidates
Using this API, you can get the list of unanswered questions from customers. They're called Candidates.
Request Body
200 You will get the result as the following JSON format.
count: The total number of candidates.
id: The ID of the extracted answer to the unanswered question. Whenever there is a new unanswered question registered, Alli tries to extract and add an answer from uploaded documents automatically.
frequency: Sum of all the frequency numbers under the questions.
textAnswer: The answer extracted from the uploaded documents for the question.
state: The status of the candidate. ACTIVE if the candidate is not added to the Q&A database yet. ARCHIVED if the candidate is added to the Q&A database.
createdAt: The timestamp of when the candidate was created.
questions: Multiple similar questions can have the same answer. Information about all the questions for the answer is under here.
id (under questions): The ID of the unanswered question from customers.
question (under questions): The unanswered question from customers.
frequency (under questions): How many times the question was asked by customers.
id (under history): The ID of the history information of the unanswered question. The history is the customers' log when the question was asked.
Q&A Candidates
POST
https://backend.alli.ai/webapi/add_faq_candidates
Registers a new Q&A Candidate with the system.
Request Body
200 You will get the result as the following JSON format.
id: The id of the candidate registered.
Documents Feedbacks
GET
https://backend.alli.ai/webapi/mrc_feedbacks
This API lets you get the list of feedbacks given to Document search results (AI-extracted answers from uploaded documents) for each search query.
Request Body
Documents Search Feedback
POST
https://backend.alli.ai/webapi/mrc_feedback
This API lets you give or cancel feedback given to a Document search result for a search query.
Request Body
200 You will get the result as the following JSON format.
positiveCount: The total number of positive feedbacks after the request is processed.
negativeCount: The total number of negative feedbacks after the request is processed.
Documents Search User Feedback
POST
https://backend.alli.ai/webapi/mrc/user_feedback
Provide user feedback to the Documents search result.
Request Body
200 Returns the positiveCount and negativeCount of the user feedback after the change.
Copy {
"result": {
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
}
}
Upload Documents
POST
https://backend.alli.ai/webapi/upload_file
This API method allows you to upload documents for Cognitive Search. Available file formats for the upload: PDF, TXT, MS Word, PowerPoint, Excel, HTM and HTML. To upload a HTML file with linked resources, please compress in a ZIP file along with any relative linked resources before uploading.
Request Body
200 You will get the result in the following JSON format.
id: The ID of the uploaded document.
fileName: The filename of the uploaded document.
hashtags: The array of hashtags added to the uploaded document.
footer: The footer (source) info added to the uploaded document. It can be the default one or the one specified by footerTitle and footerUrl parameters.
Upload Documents from S3
POST
https://backend.alli.ai/webapi/upload_from_s3
This API lets you transfer documents stored in S3 into Cognitive Search. They will appear as Knowledge Base documents in the dashboard. Available file formats are same in the section of Upload Documents.
Request Body
200 You will get the result in the following JSON format:
id: The id for the transferred document.
fileName: The filename of the transferred document.
hashtags: The array of hashtags added to the uploaded document.
footer: The footer (source) info added to the uploaded document. It can be the default one or the one specified by footerTitle and footerUrl parameters.
Check Document Status
GET
https://backend.alli.ai/webapi/check_file_status
Once you upload documents through API, it is converted, parsed, and embedded as vectors. This API shows the status of the process for a document being uploaded.
Request Body
200 You will get the result in the following JSON format.
id: The ID of the document being checked.
status: Status of the document. Please see Response Example below for possible values.
Delete Documents
POST
https://backend.alli.ai/webapi/delete_file
This API lets you delete uploaded files.
Request Body
200 You will get the result in the following JSON format.
ok: true if the deletion completes successfully. If the deletion fails, the result will be false and errors will contain an error message.
List Documents
GET
https://backend.alli.ai/webapi/knowledge_bases
This API lets you list out the uploaded documents.
Query Parameters
200 You will get the result in the following JSON format.
id: The ID of the listed document.
fileName: The filename of the list document.
hashtags: The hashtags added on the document.
autoHashtags : The automatically generated hashtags added to the document.
Rename Documents (Knowledge Base)
POST
https://backend.alli.ai/webapi/update_kb_name
This API lets you update the name for an uploaded document.
Request Body
200 You will get the result in the following JSON format:
id: The Document id for the file who's name was changed.
filename: The Document's new name.
Update Documents
POST
https://backend.alli.ai/webapi/update_document
This API lets you update hashtags, footer title, and footer title link for a document.
Request Body
200 You will get the result in the following JSON format.
id: The id of the document to which the hashtags correspond
hashtags: Hashtags attached to the document after update
footer: The footer (source) info added to the uploaded document. It can be the default one or the one specified by footerTitle and footerUrl parameters.
Knowledge Base Toggle Status
POST
https://backend.alli.ai/webapi/toggle_documents
This API lets you change the status of many documents (AKA knowledge bases) at once
Request Body
200 You will get the result in the following JSON format:
knowledgeBases : a list of ONLY the knowledge bases whose status were toggled
id: id of knowledge base
status: new status of knowledge base (boolean). true meaning status is now on.
Knowledge Base Auto Hashtag (Classification)
POST
https://backend.alli.ai/webapi/kb_auto_hashtag
This API lets you get the hashtag list with classification keywords for the documents.
Request Body
200 You will get the result in the following JSON format.
updated -> id : The id of the Document to which the hashtags correspond.
autoHashtags: Array of JSON objects, containing the list of hashtags auto-generated for the Document.
state: Status of hashtag, depending on if agent has confirmed this auto-generated hashtag. Will be one of: "SUGGESTED", "APPROVED", "DECLINED".
bestConfidence: Numerical confidence of this auto-generated hashtag from 0 to 1.
autoHashtags -> id: The id of the hashtag.
hashtag: String value of hashtag (displayed in Dashboard).
Knowledge Base Auto Hashtag Feedback (Classification)
POST
https://backend.alli.ai/webapi/kb_auto_hashtag_feedback
This API lets you approve or decline classification hashtags for documents
Request Body
200 You will get the result in the following JSON format:
result: Array of JSON objects, each corresponding to a auto-hashtag
id: The id of the hashtag
state: The hashtag's feedback from agent. Will be one of: "suggested", "approved", "declined"
Select Answer
POST
https://backend.alli.ai/webapi/faq/select_answer
This method should be used to simulate a user looking up a specific FAQ
Path Parameters
Request Body
200 You will get the result in the following JSON format:
In case of success 404 In case you provide an invalid FAQ
Copy {"result": [], "error": "Record does not exist."}
Agent Management
POST
https://backend.alli.ai/webapi/agent_management
Used to create and delete agents from the project.
Request Body
200 id: ID of agent that was deleted/created
status: What happened (either "deleted" or "created") 400 If the agent you try to create already has an email registered. 404 If you try to delete an agent that doesn't exist.
Copy {
"result": {
"id" : "QWdlbnQ6NWZkMmFjMzIwODQ4MzY1ZDI4NWFjMGUw",
"status": "deleted"
},
"errors": null
}
Copy {
"result": [],
"errors": "Agent with provided email already exists."
}
Copy {
"result": [],
"errors": "The record does not exist."
}
Get All Hashtags
GET
https://backend.alli.ai/webapi/hashtags
Gets all hashtags from both FAQs and MRCs
200 Returns each hashtag with its count of uses
Copy {
"result": {
"sample_tag1": 2,
"sample_tag2": 1,
}
}
Q&A Query History
GET
https://backend.alli.ai/webapi/faq_histories
Returns the past Q&A Searches that have been done, both through the REST API and the Alli dashboard.
Query Parameters
200 Each query will have the following attributes:
agent: an object which contains the id of the agent who made the query.
question: The question actually asked in the query
answers: All answers provided by the system to the query. Each answer has the Q&A that was referred to, and the confidence, effective confidence.
There is also a count of how many queries were returned in a count field.
Copy {
"result": {
"histories": [
{
"agent": {
"id": "QWdlbnQ6NjA0NmMyNWJmNTFjMmVlYjc4Mjg3Zjcy"
},
"question": "What is life?",
"answers": [
{
"faq": {
"id": "RkFROjYwNDZjMmUxM2MzYmQ5MjVmMzgxMGNkOQ=="
},
"effectiveConfidence": 0.9999999999999927,
"confidence": 0.9999999999999927
}
]
}
],
"count": 1
},
"errors": null
}
Documents Query History
GET
https://backend.alli.ai/webapi/mrc_histories
Returns the past Documents Searches that have been done, both through the REST API and the Alli dashboard.
Query Parameters
200 Each query history will have the following attributes:
agent: The id of the agent who made the request.
question: The actual question asked.
answers: A list of all possible answers provided. Each answer has the knowledgeBase used to source that answer (both the filename and the id), the actual answer itself, the answerFormat, the hashtags associated with the knowledgeBase that was retrieved, and whether feedbackAvailable for this specific answer.
Copy {
"result": {
"histories": [
{
"agent": {
"id": "QWdlbnQ6NWZiNzc5MGIwZjE3Zjc5ZmNiNzVlYzFh"
},
"question": "program memory of c004",
"answers": [
{
"knowledgeBase": {
"id": "S25vd2xlZGdlQmFzZTo2MDUyODM0ODFiYzgxNDcwZTEzNGRjNDQ=",
"fileName": "specification_en.pdf"
},
"answer": "{\"blocks\": [{\"key\": \"kn13\", \"type\": \"unstyled\", \"text\": \"Type capacity program memory program memory - C004, B04KR: 80KB\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [], \"data\": {}}, {\"key\": \"2vjf\", \"text\": \" \", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [], \"data\": {}}, {\"key\": \"45cb\", \"text\": \"— From specification_en.pdf\", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [{\"offset\": 0, \"length\": 27, \"style\": \"ITALIC\"}], \"entityRanges\": [{\"offset\": 7, \"length\": 20, \"key\": 0}], \"data\": {}}], \"entityMap\": {\"0\": {\"type\": \"LINK\", \"mutability\": \"MUTABLE\", \"data\": {\"url\": \"https://staging-download.alli.ai/download_document/UHJvamVjdDo1ZmI3NzkwYjBmMTdmNzlmY2I3NWVjMWM=/S25vd2xlZGdlQmFzZTo2MDUyODM0ODFiYzgxNDcwZTEzNGRjNDQ=\"}}}}",
"answerHash": "6648c76e9be27864557f84ab7822cde8",
"answerFormat": "DRAFTJS",
"hashtags": [],
"feedbackAvailable": true,
"columnFilterValues": []
},
...
{
"knowledgeBase": {
"id": "S25vd2xlZGdlQmFzZTo2MDUyODM0ODFiYzgxNDcwZTEzNGRjNDQ=",
"fileName": "specification_en.pdf"
},
"answer": "{\"blocks\": [{\"key\": \"87us\", \"type\": \"unstyled\", \"text\": \"Type capacity reload memory reload memory - C004, B04KR: 2048KB\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [], \"data\": {}}, {\"key\": \"p0wr\", \"text\": \" \", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [], \"entityRanges\": [], \"data\": {}}, {\"key\": \"qpau\", \"text\": \"— From specification_en.pdf\", \"type\": \"unstyled\", \"depth\": 0, \"inlineStyleRanges\": [{\"offset\": 0, \"length\": 27, \"style\": \"ITALIC\"}], \"entityRanges\": [{\"offset\": 7, \"length\": 20, \"key\": 0}], \"data\": {}}], \"entityMap\": {\"0\": {\"type\": \"LINK\", \"mutability\": \"MUTABLE\", \"data\": {\"url\": \"https://staging-download.alli.ai/download_document/UHJvamVjdDo1ZmI3NzkwYjBmMTdmNzlmY2I3NWVjMWM=/S25vd2xlZGdlQmFzZTo2MDUyODM0ODFiYzgxNDcwZTEzNGRjNDQ=\"}}}}",
"answerHash": "9537b6560701930d079f39ced8be1b3e",
"answerFormat": "DRAFTJS",
"hashtags": [],
"feedbackAvailable": true,
"columnFilterValues": []
}
]
}
],
"count": 1
},
"errors": null
}
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.
Copy -H 'AGENT-EMAIL: agent_1@email.com'
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.
Copy -H 'OWN-USER-ID: 5f1234567a409876c082487z' \
-H 'USER-EMAIL: user_1@email.com'
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:
Copy {“error”: “Method Not Allowed POST: /webapi/faq_feedbacks”}
Search from Q&A
POST
https://backend.alli.ai/webapi/faq
This API lets you find the most relevant question and answer pairs from your Q&A knowledge base.
Request Body
200
The API will find the most relevant question and answers from your Q&A database.
confidence: It shows the confidence value from AI model. Shown as a number value between 0 and 1.
effectiveConfidence: When you provide feedback to the query result, it automatically trains the AI model. Effective confidence is the adjusted score with these users' and agents' feedback. Shown as a number value between 0 and 1.
question: This is the question part of the selected Q&A pair.
answer: This is the answer part of the selected Q&A pair.
id: This is used to identify the result to give or cancel feedback.
hashtags: Hashtags registered for the Q&A.
lastUpdatedDate: The date when the Q&A is last updated.
agentFeedback: The feedback from agents (through dashboard and REST calls) about this Q&A.
userFeedback: The feedback from users (through conversation) about this Q&A.
count: The number of suggested Q&As.
hashId: This hash id is being used when you call select_answer later.
The number of search results and the threshold follows your dashboard setting. Please check your settings in Q&A > Settings.
Copy {"result":
[
{
"confidence": CONFIDENCE_VALUE,
"effectiveConfidence": EFFECTIVE_CONFIDENCE_VALUE,
"question": "QUESTION_1",
"answer": "ANSWER_1",
"id": "ID_1",
"hashtags": [],
"lastUpdatedDate": "DATE",
"agentFeedback": {
"positiveCount": 1,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 1,
"negativeCount": 0
}
}, ...
],
"count": 3,
"hashId": "HASH_ID"
}
Request Example
Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.
Copy 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
Copy {"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"
}
Search from Documents
POST
https://backend.alli.ai/webapi/mrc
Documents API finds an answer from your unstructured text documents and even from complex tables.
Request Body
200
You will get the result as the following JSON format:
answer : It's the answer extracted from uploaded documents in the dashboard.answerHash: This is used to identify the answer to give or cancel feedback.
answerHash : This is used to identify the answer to give or cancel feedback.
confidence : It shows the confidence value from AI model. Shown as a number value between 0 and 1.
effectiveConfidence : When you provide feedback to the query result, it automatically trains the AI model. Effective confidence is the adjusted score with these users' and agents' feedback. Shown as a number value between 0 and 1.
documentId : The document's ID where the answer is extracted from.
documentName : The document's name where the answer is extracted from.hashtags: The hashtags attached to the document.
pageNo : The page number in the document where the answer was derived.
createdDate: The date when the document was uploaded.
agentFeedback : The feedback from agents (through dashboard and REST calls) about this document
userFeedback : The feedback from users about this document
body : If returnPreview is true in the request, the html body of the document search preview is displayed.
css : If returnPreview is true in the request, the css of the document search preview is displayed.
pdfPreview : If returnPdfPreview is true in the request, the URL to a PDF preview of the document with the answer highlighted is displayed. Note that the URL can be restricted using the Download IP Allowlist setting.
folder : If the answer is found from a folder under the Documents database, the folder name will be returned here.
editor : List of the agents' email who has the editor access to the documents (if they're set in the Alli dashboard).
viewer : List of the agents' email who has the viewer access to the documents. (if they're set in the Alli dashboard).
paragraphIndex: This value is needed to highlight a specific area when requesting a preview. It is used as parameters for the preview API.
The number of search results and the threshold follows your dashboard setting. Please check your setting in Documents > Settings.
Copy {
"result": [
{
"answer": "ANSWER_1",
"answerHash": "ANSWER_HASH_1",
"confidence": CONFIDENCE_1,
"effectiveConfidence": EFFECTIVE_CONFIDENCE_1,
"documentId": "DOCUMENT_ID_1",
"documentName": "DOCUMENT_NAME_1",
"hashtags": [],
"pageNo": PAGE_NUMBER,
"paragraphIndex": 0,
"createdDate": "DATE",
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"body": "PREVIEW_HTML_BODY",
"css": "PREVIEW_CSS",
"pdfPreview": "PDF_PREVIEW_URL",
"folder": "folder 1",
"editor": ["email_1@allganize.ai", "email_2@allganize.ai"],
"viewer": ["email_3@allganize.ai"]
}
]
}
Request Example (hashtags)
Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.
Copy 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.
Copy 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
Copy {
"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",
"editor": ["email_1@allganize.ai", "email_2@allganize.ai"],
"viewer": ["email_3@allganize.ai"]
},
{
"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 Single Q&A
GET
https://backend.alli.ai/webapi/single_faq
This is the method to get all the details of a single Q&A.
Request Body
200 Includes fields:
question: The question associated with the Q&A.
answer : The answer to the question.
id: The id of this Q&A.
userFeedback: The feedback from users (through conversation) about this Q&A.
agentFeedback: The feedback from agents (through dashboard and REST calls) about this Q&A.
lastUpdatedDate, createdDate: The date when the Q&A was updated / first created.
hashtags: All hashtags associated with this question.
Copy {
"result": {
"question": "Who is there?",
"answer": "Elmo",
"id": "RkFROjYwMmY2ZTQ0YWZmMWQ5YmQ0NmM5Y2VkNw==",
"userFeedback": {
"positiveCount": 0,
"negativeCount": 0
},
"agentFeedback": {
"positiveCount": 0,
"negativeCount": 1
},
"lastUpdatedDate": "2021-02-19",
"createdDate": "2021-02-19",
"hashtags": []
}
}
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.
Copy curl -X GET \
-d '{"id": "iuHjHBhjHGbhjm==", "format": "text"}' \
-H "API-KEY: YOUR API KEY" \
https://backend.alli.ai/webapi/single_faq
Response Example
Copy {
"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 Single Document
GET
https://backend.alli.ai/webapi/single_document
This is the method to get all details of a single document.
Request Body
200 You will get the result as the following JSON format.
id: The Document's ID.
documentName: The document's file name.
createdDate: The date when the document was uploaded.
hashtags: Hashtags registered for the document.
agentFeedback : Counts of positive and negative ratings by employees.
userFeedback: The feedback from users about this document{"result": {
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.
Copy curl -X GET \
-d '{"id": "S25vd2xlZGdlQmFzZTo1ZjMzODFkZmNhYWJjYWUyMjkzYjFhY2U="}' \
-H "API-KEY: YOUR API KEY" \
https://backend.alli.ai/webapi/single_document
Response Example
Copy {"result": {
"id": "S25vd2xlZGdlQmFzZTo1ZjMzODFkZmNhYWJjYWUyMjkzYjFhY2U=",
"documentName": "Policy document 1.docx",
"createdDate": "2020-11-12",
"agentFeedback": {
"positiveCount": 1,