Introduction
Welcome to the Brainybear API! You can use our API to access Brainybear API endpoints, which can get information on various products such as threads and messages.
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "https://api.brainybear.ai/v1/path"
-H "Authorization: APIKEY"
Make sure to replace
APIKEY
with your API key.
Brainybear uses API keys to allow access to the API. You can get a new Brainybear API key at our Brainybear account.
Brainybear expects for the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: APIKEY
Threads
Get Threads
curl "https://api.brainybear.ai/v1/threads?assistant_id=9999&startdate=2020-01-01&enddate=2020-12-31&limit=10"
-H "Authorization: APIKEY"
The above command returns JSON structured like this:
[
{
"thread_id":3456,
"created":"2024-07-21 12:56:33",
"last message":"2024-09-21 12:56:33",
"model":"4-o-mini",
"messages":5,
"credits":5,
}
]
This endpoint retrieves all Brainybear feedback for your website.
HTTP Request
GET https://api.brainybear.ai/v1/threads
Query Parameters
Parameter | Default | Description |
---|---|---|
assistant_id | none | The result will return threads responses based on the assistant id. [Required] |
days | 7 | The result will return feedback comment in the last N days if no startdate and enddate specified. |
startdate | none | The result will return feedback comment after the start date. |
enddate | none | The result will return feedback comment before the end date. |
limit | 50 | The result will return latest X number of specified number of feedback. |
Messages
Get Messages
curl "https://api.brainybear.ai/v1/get-messages?limit=10&thread_id=3456"
-H "Authorization: APIKEY"
The above command returns JSON structured like this:
[
{
"model":"4-o-mini",
"channel":"web",
"messages":[{
"role":"user",
"content":[{
"type":"text",
"text":"test\n"}],
},{
"role":"assistant",
"content":[{
"type":"text",
"text":"It looks like you're testing the system. How can I assist you today?"}]
}]
}
]
This endpoint retrieves all survey details for your website.
HTTP Request
GET https://api.brainybear.ai/v1/list-survey
Query Parameters
Parameter | Default | Description |
---|---|---|
limit | 50 | The result will return latest X number of specified number of survey. |
Get Survey Responses
curl "https://api.brainybear.ai/v1/survey?id=3930&startdate=2020-01-01&enddate=2020-12-31&limit=10"
-H "Authorization: APIKEY"
The above command returns JSON structured like this:
[
{
"questions":[{
"id":0,
"question":"Did you find what you were looking for?",
"type":"Radio"
}, {
"id":1,
"question":"What type of articles you are looking for?",
"type":"Checkbox"
}],
"responses":[{
"id":0,
"client_id":"1659351352936.mgx5l83q",
"sessio _id":"1665044041564.o1tnz2vc",
"answers":["Yes", "Opinions, Web dev, Web design"],
"url":"https://brainybear.ai",
"country":"SG",
"countryName":"Singapore",
"created":"2022-08-16 08:11:17",
"os":"Windows",
"browser":"Chrome",
"referrer":"google.com",
}, {
"id":1,
"client_id":"1660637959183.znxym39a",
"sessio _id":"1660637959182.hgojyp",
"answers":["No", "Opinions"],
"url":"https://brainybear.ai",
"country":"US",
"countryName":"United States",
"created":"2022-08-16 08:11:17",
"os":"MacOS",
"browser":"Safari",
"referrer":"google.com",
}]
}
]
This endpoint retrieves all Brainybear survey for your website.
HTTP Request
GET https://api.brainybear.ai/v1/survey
Query Parameters
Parameter | Default | Description |
---|---|---|
id | none | The result will return survey responses based on the survey id. [Required] |
startdate | none | The result will return survey responses after the start date. |
enddate | none | The result will return survey responses before the end date. |
limit | 50 | The result will return latest X number of specified number of survey responses. |
Delete Individual API
Delete Individual
curl "https://api.brainybear.ai/v1/delete_individual"
-H "Authorization: APIKEY"
The above command returns JSON structured like this:
[
{
"success":true
}
]
This endpoint will delete the individual information based on the provided client ID.
HTTP Request
POST https://api.brainybear.ai/v1/delete_individual
Query Parameters
Parameter | Required | Description |
---|---|---|
client_id | {client_id} | The API will delete the individual information based on the provided client ID. |
Errors
The Brainybear API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |