Comment on page
🎛
APP
ZBrain enables users to build LLM-powered applications, such as chatbots or question-answering tools, tailored to their specific needs. Users can personalize the apps' features, responses, and operations. Once developed, these applications can be easily incorporated into an organization's internal workflows and customer-facing systems.
Creating an application with ZBrain is a streamlined process enabled by the platform's intuitive API. To create an app using ZBrain, initiate a POST request to the provided URL with the necessary headers and payload. This includes setting your app's configuration, description, email, knowledge base, and name.
- Request URL: https://services.zbrain.ai:3000/api/manage-app
- Request Method: POST
- Request Headers:
- 1.Authorization: Bearer <<API Key>>
- 2.Content-Type: application/json
- Request Payload:
- 1.configuration: {type: <<"PUBLIC" or "PRIVATE">>}
- 2.description: << "some description optional" >>
- 3.email: << email >>
- 4.knowledgeBases: << Array of KnowledgeBaseId's which are strings >>
- 5.name: <Enter your app name>
Parameters | |
---|---|
Authorization | |
configuration | type of app i.e., PUBLIC or PRIVATE |
description | description about the app |
email | registered email id of application creator email ( for PRIVATE app only) |
name | name of the app |
knowledgeBases | Array of KnowledgeBaseId's which are strings (get the _id key of each knowledge base from Get knowledge bases response) |
- Sample Request Body payload:{"configuration": {"type": "PRIVATE/PUBLIC"},"description": "App Description","email": "","knowledgeBases": ["knowledgeBaseId"],"name": "App Name",}
- Code snippets:
Node Js
Python
cURL
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://services.zbrain.ai:3000/api/manage-app',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer <API key>'
},
body: JSON.stringify({
"configuration": {
"type": "<PUBLIC or PRIVATE>"
},
"description": "<some description optional>",
"email": "<email>",
"knowledgeBases": [
"<knowledgeBaseId>",
"<knowledgeBaseId>"
],
"name": "<name>"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://services.zbrain.ai:3000/api/manage-app"
payload = json.dumps({
"configuration": {
"type": "<PUBLIC or PRIVATE>"
},
"description": "<some description optional>",
"email": "<email>",
"knowledgeBases": [
"<knowledgeBaseId>",
"<knowledgeBaseId>"
],
"name": "<name>"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <API key>'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
curl --location 'https://services.zbrain.ai:3000/api/manage-app' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API key>' \
--data '{
"configuration": {
"type": "<PUBLIC or PRIVATE>"
},
"description": "<some description optional>",
"email": "<email>",
"knowledgeBases": [
"<knowledgeBaseId>",
"<knowledgeBaseId>"
],
"name": "<name>"
}'
- Sample Response:{"responseData": {"styles": {"headerColor": "string","textColor": "string","sideBarColor": "string","sideBarText": "string","backGroundColor": "string","sampleQueryColor": "string","botReplyBg": "string"},"configuration": {"id": number,"type": "string"},"logo": "string","name": "string","description": "string","pageTitle": "string","pageDescription": "string","botName": "string","botInstruction": "string","botIcon": "string","botType": "string","model": "string","tenantId": "string","email": "string","createdBy": "string","knowledgeBases": ["string"],"embedding": {"url": "string","path": "string","bucket": "string","status": "string"},"sampleQueries": ["string"],"suggestedQueries": ["string"],"tokenLimit": number,"isDeleted": boolean,"isActive": boolean,"_id": "string","addedOn": number,"modifiedOn": number,"__v": 0},"message": "App created successfully","success": true,"responseCode": 200}
The ZBrain get app API allows users to get all user active apps. To get a ZBrain apps, initiate a GET request to the provided URL with the necessary payload.
- Request URL: https://services.zbrain.ai:3000/api/apps?skip=0&limit=10
- Request Method: GET
- Query strings:
- 1.skip: << numeric value >>
- 2.limit: << numeric value >>
- Request Headers:
- 1.Authorization: Bearer <<API Key >>
- 2.Content-Type: application/json
Parameters | |
---|---|
Authorization | |
skip | no.of apps to skip |
limit | no.of apps to listout |
- Sample Query string:
?skip=0&limit=10
- Code snippets:
Node Js
Python
cURL
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://services.zbrain.ai:3000/api/apps?skip=0&limit=10',
'headers': {
'Authorization': 'Bearer <API key>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "https://services.zbrain.ai:3000/api/apps?skip=0&limit=10"
payload = {}
headers = {
'Authorization': 'Bearer <API key>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
curl --location 'https://services.zbrain.ai:3000/api/apps?skip=0&limit=10' \
--header 'Authorization: Bearer <API key>'
- Sample Response:{"responseData": {"data": [{"_id": "string","styles": {"headerColor": "string","textColor": "string","sideBarColor": "string","sideBarText": "string","backGroundColor": "string","sampleQueryColor": "string","botReplyBg": "string"},"configuration": {"id": number,"type": "string"},"name": "string","description": "string","pageTitle": "string","pageDescription": "string","botName": "string","botInstruction": "string","botType": "string","knowledgeBases": ["string"],"addedOn": number,"modifiedOn": number}],"total": number},"message": "Information fetched successfully","success": true,"responseCode": 200}
- Request URL: https://services.zbrain.ai:3000/api/manage-app/<appId>
- Request Method: GET
- Path parameters:
- 1.appId: << appId >>
- Request Headers:
- 1.Authorization: Bearer <<API Key >>
- 2.Content-Type: application/json
Parameters | |
---|---|
Authorization | |
appId |
- Sample Path parameters:
/manage-app/<appId>
- Code snippets:
Node Js
Python
cURL
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://services.zbrain.ai:3000/api/manage-app/<appId>',
'headers': {
'Authorization': 'Bearer <API key>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "https://services.zbrain.ai:3000/api/manage-app/<appId>"
payload = {}
headers = {
'Authorization': 'Bearer <API key>'
}var request = require('request');
var options = {
'method': 'GET',
'url': 'https://services.zbrain.ai:3000/api/manage-app/<appId>',
'headers': {
'Authorization': 'Bearer <API key>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
curl --location 'https://services.zbrain.ai:3000/api/manage-app/<appId>' \
--header 'Authorization: Bearer <API key>'
- Sample Response:{"responseData": {"styles": {"headerColor": "string","textColor": "string","sideBarColor": "string","sideBarText": "string","backGroundColor": "string","sampleQueryColor": "string","botReplyBg": "string"},"configuration": {"id": number,"type": "string"},"logo": "string","name": "string","description": "string","pageTitle": "string","pageDescription": "string","botName": "string","botInstruction": "string","botIcon": "string","botType": "string","model": "string","tenantId": "string","email": "string","createdBy": "string","knowledgeBases": ["string"],"embedding": {"url": "string","path": "string","bucket": "string","status": "string"},"sampleQueries": ["string"],"suggestedQueries": ["string"],"tokenLimit": number,"isDeleted": boolean,"isActive": boolean,"_id": "string","addedOn": number,"modifiedOn": number,"__v": 0},"message": "Information fetched successfully","success": true,"responseCode": 200}
The ZBrain app update API allows for various modifications to your existing application. This includes the ability to change your app's name, add or adjust sample queries, modify the title and description of the chat page, alter the chatbot's instructions, or even rename the app. Additionally, it provides the flexibility to update the knowledge bases linked to your application. To update a ZBrain app, initiate a PUT request to the provided URL with the necessary payload.
- Request URL:https://services.zbrain.ai:3000/api/manage-app
- Request Method: PUT
- Request Payload:
- 1.name : << App name >>
- 2.sampleQueries : << Array of questions >>
- 3.pageTitle: << Chat screen tttle >>
- 4.pageDescription: << Chat screen description >>
- 5.appId: << appId>>
- 6.knowledgeBases: << Array of knowledgebaseId's >>
- 7.botInstruction: << Instruction to chatbot >>
- 8.botName: << chatbot name >>
Text | |
---|---|
Authorization | |
name | name of the app |
sampleQueries | sample queries for chatscreen |
appId | |
pageTitle | name to the chat screen |
pageDescription | description to the chatscreen |
knowledgeBases | Array of KnowledgeBaseId's which are strings (get the _id key of each knowledge base from Get knowledge bases response) |
botInstruction | instruction to bot |
botName | bot name |
- Sample Request Body payload:
{
"name": "name of app",
"sampleQueries": ["sample query 1","sample query 2"],
"appId": "_id",
"pageTitle": "chat screen title",
"pageDescription": "chat screen description",
"knowledgeBases": ["knowledgeBase1_id","knowledgeBase2_id"]
"botInstruction": "bot instruction",
"botName": "bot name"
}
- Code snippets:
Node Js
Python
cURL
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://services.zbrain.ai:3000/api/manage-app',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer <API key>'
},
body: JSON.stringify({
"name": "<name>",
"sampleQueries": [
"<add sample queries>"
],
"pageTitle": "<pageTitle>",
"pageDescription": "<pageDescription>",
"appId": "<appId>",
"knowledgeBases": [
"knowledgeBaseId",
"knowledgeBaseId"
],
"botInstruction": "<instruction to bot>",
"botName": "<bot name>"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://services.zbrain.ai:3000/api/manage-app"
payload = json.dumps({
"name": "<name>",
"sampleQueries": [
"<add sample queries>"
],
"pageTitle": "<pageTitle>",
"pageDescription": "<pageDescription>",
"appId": "<appId>",
"knowledgeBases": [
"knowledgeBaseId",
"knowledgeBaseId"
],
"botInstruction": "<instruction to bot>",
"botName": "<bot name>"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <API key>'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
curl --location --request PUT 'https://services.zbrain.ai:3000/api/manage-app' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API key>' \
--data '{
"name": "<name>",
"sampleQueries": [
"<add sample queries>"
],
"pageTitle": "<pageTitle>",
"pageDescription": "<pageDescription>",
"appId": "<appId>",
"knowledgeBases": [
"knowledgeBaseId",
"knowledgeBaseId"
],
"botInstruction": "<instruction to bot>",
"botName": "<bot name>"
}'
- Sample Response:{"responseData": {"styles": {"headerColor": "string","textColor": "string","sideBarColor": "string","sideBarText": "string","backGroundColor": "string","sampleQueryColor": "string","botReplyBg": "string"},"configuration": {"id": number,"type": "string"},"logo": "string","name": "string","description": "string","pageTitle": "string","pageDescription": "string","botName": "string","botInstruction": "string","botIcon": "string","botType": "string","model": "string","tenantId": "string","email": "string","createdBy": "string","knowledgeBases": ["string"],"embedding": {"url": "string","path": "string","bucket": "string","status": "string"},"sampleQueries": ["string"],"suggestedQueries": ["string"],"tokenLimit": number,"isDeleted": boolean,"isActive": boolean,"_id": "string","addedOn": number,"modifiedOn": number,"__v": 0},"message": "Information added successfully","success": true,"responseCode": 200}
To delete an app on ZBrain, simply send a DELETE request to the provided URL, replacing '' with your specific application's ID. Ensure the required headers, including your Authorization Bearer and Content-Type, are correctly included in the request.
- Request URL: https://services.zbrain.ai:3000/api/delete-app/<appId>
- Request Method: DELETE
- Request Headers:
- 1.Authorization: Bearer <<API Key>>
- 2.Content-Type: application/json
Text | |
---|---|
Authorization | |
appId |
- Sample Request Path Payload:/appId
- Code snippets:
Node Js
Python
cURL
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://services.zbrain.ai:3000/api/delete-app/<appId>',
'headers': {
'Authorization': 'Bearer <API key>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "https://services.zbrain.ai:3000/api/delete-app/<appId>"
payload = {}
headers = {
'Authorization': 'Bearer <API key>'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
curl --location --request DELETE 'https://services.zbrain.ai:3000/api/delete-app/<appId>' \
--header 'Authorization: Bearer <API key>'
- Sample Response:{"responseData": "App deleted successfully","message": "App deleted successfully","success": true,"responseCode": 200}
The query API for ZBrain allows you to interact with your created application by sending a POST request to the provided URL. The request payload should include the specific app ID and the user's message content, facilitating the app to return responses in a paragraph format to the queries posed.
- Request URL: https://services.zbrain.ai:3000/api/query
- Request Method: POST
- Request Headers:
- 1.Authorization: Bearer <<API Key>>
- 2.Content-Type: application/json
- Request Payload:
- 1.appId: << appId >>
- 2.messages: [{role: "user", content: << Enter Query >>}]
- 3.conversationId: <<timestamp-randomId>>
Note: role should be "user" only in messages
Parameters | |
---|---|
Authorization | provide Bearer API-Key (get it from settings > profile from https://app.zbrain.ai/settings/profile ) |
appId | |
messages | Array of containing role and user query as content |
conversationId | unique Id for a conversation session. ( Hyphen separated timestamp and randomId of length max 10 characters) |
- Sample Request Body Payload:
1
{
2
"appId": "appId",
3
"messages": [
4
{
5
"role": "user",
6
"content": "query"
7
}
8
],
9
"conversationId": "timestamp-randomId"
10
}
- Code snippets:
Node Js
Python
cURL
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://services.zbrain.ai:3000/api/query',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer <API key>'
},
body: JSON.stringify({
"appId": "<appId>",
"messages": [
{
"role": "user",
"content": "<query>"
}
],
"conversationId": "timestamp-randomId"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://services.zbrain.ai:3000/api/query"
payload = json.dumps({
"appId": "<appId>",
"messages": [
{
"role": "user",
"content": "<query>"
}
],
"conversationId": "timestamp-randomId"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <API key>'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
curl --location 'https://services.zbrain.ai:3000/api/query' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API key>' \
--data '{
"appId": "<appId>",
"messages": [
{
"role": "user",
"content": "<query>"
}
],
"conversationId": "timestamp-randomId"
}'
- Sample Response:{"responseData": "string","message": "Information fetched successfully","success": true,"responseCode": 200}
ZBrain’s query stream API responds to user queries in a real-time streaming format. By initiating a GET request with the specific app ID and query, the API facilitates a continuous, interactive conversation with the user, enhancing the chatbot experience.
- Request URL: https://services.zbrain.ai:3000/api/stream-query?appId=<appId>&query=<query>&conversationId<timestamp-randomId>
- Request Method: GET
- Request Headers:
- 1.Authorization: Bearer <<API Key>>
- 2.Content-Type: text/event-stream
Parameters | |
---|---|
Authorization | |
appId | |
query | Query to chatbot ("string") |
conversationId | unique Id for a conversation session. ( Hyphen separated timestamp and randomId of length max 10 characters) |
- Sample Request query Payload:
1
?appId=<appId>&query=<query>&conversationId=<timestamp-randomId>
- Code snippets:
Node Js
Python
cURL
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://services.zbrain.ai:3000/api/stream-query?appId=<appId>&query=<query>&conversationId=<timestamp-randomId>',
'headers': {
'Content-Type': 'application/octet-stream',
'Authorization': 'Bearer <API key>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests