API - Knowledge - Reference
GET
/knowledge
Get all knowledge items associated with the current account.
Example request
curl --request GET \
--url https://api.aidbase.ai/v1/knowledge \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"items": [
{
"id": "d38b8600-d708-40d9-a2a8-c178b84b30a0",
"type": "website",
"base_url": "https://www.mywebsite.com/",
"trained_at": "2023-12-24T06:05:17.365Z",
"is_training": false,
"training_failed_at": null,
"training_failed_with": null
},
...
],
"total": 40,
"has_more": true,
"next_cursor": "MjUuNTA="
}
}
GET
/knowledge/:id
Get a specific knowledge item by its ID.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to retrieve. | N/A |
Example request
curl --request GET \
--url https://api.aidbase.ai/v1/knowledge/d38b8600-d708-40d9-a2a8-c178b84b30a0 \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"id": "d38b8600-d708-40d9-a2a8-c178b84b30a0",
"type": "website",
"base_url": "https://www.mywebsite.com/",
"trained_at": "2023-12-24T06:05:17.365Z",
"is_training": false,
"training_failed_at": null,
"training_failed_with": null
}
}
GET
/knowledge/:id/sub-pages
Get all sub pages associated with a specific knowledge item.
This is only applicable to knowledge items of type website
.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to retrieve sub pages for. | N/A |
Example request
curl --request GET \
--url https://api.aidbase.ai/v1/knowledge/d38b8600-d708-40d9-a2a8-c178b84b30a0/sub-pages \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"items": [
{
"page_url": "/about",
"trained_at": "2023-12-24T06:05:10.494Z",
"training_failed_at": null,
"training_failed_with": null
},
{
"page_url": "/contact",
"trained_at": "2023-12-24T06:05:10.494Z",
"training_failed_at": null,
"training_failed_with": null
},
...
],
"total": 12,
"has_more": false
}
}
GET
/knowledge/:id/faq-items
Get all FAQ items associated with a specific knowledge item.
This is only applicable to knowledge items of type faq
.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to retrieve FAQ items for. | N/A |
Example request
curl --request GET \
--url https://api.aidbase.ai/v1/knowledge/08ca7aff-4d1a-4b7c-bd4d-6850a6bee2e2/faq-items \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"items": [
{
"id": "5a3b79d1-31c3-4b6c-a5ba-1500b0606e1e",
"question": "Does the chatbot work around the clock?",
"answer": {
"version": "2.28.0",
"blocks": [
{
"type": "paragraph",
"data": {
"text": "Yes, most definitely. The chatbot is always available to help you out."
},
"id": "-n2eBiFvt3"
}
],
"time": 1699624114099
},
"source_url": null,
"categories": [
"General questions"
]
},
...
],
"total": 8,
"has_more": false
}
}
POST
/knowledge/website
Create a new knowledge item of type website
.
Field | Description | Default value |
---|---|---|
website_url | The URL of the website to add. The URL must start with http:// or https://. | N/A |
Example request
curl --request POST \
--url https://api.aidbase.ai/v1/knowledge/website \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]' \
--header 'Content-Type: application/json' \
--data '{"website_url": "https://example.com"}'
Example response
{
"success": true,
"data": {
"id": "9090b4c7-f2ba-43f3-97b5-d7f996ee69ce",
"type": "website",
"base_url": "https://example.com"
}
}
POST
/knowledge/video
Create a new knowledge item of type video
.
Field | Description | Default value |
---|---|---|
video_url | The URL of the video to add. We currently only accept YouTube links. | N/A |
video_type | The type of the video. Must be "YOUTUBE". | N/A |
Example request
curl --request POST \
--url https://api.aidbase.ai/v1/knowledge/video \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]' \
--header 'Content-Type: application/json' \
--data '{
"video_url": "https://www.youtube.com/watch?v=EuXAQGoxLi8",
"video_type": "YOUTUBE"
}'
Example response
{
"success": true,
"data": {
"id": "4e4a12a2-d5ad-46a1-ba43-c5907457eedf",
"type": "video",
"video_id": "EuXAQGoxLi8",
"video_url": "https://www.youtube.com/watch?v=EuXAQGoxLi8",
"video_type": "YOUTUBE"
}
}
POST
/knowledge/document
Create a new knowledge item of type document
.
Field | Description | Default value |
---|---|---|
file_type | The mime type of the document. Allowed types are application/pdf, application/msword, text/plain, and text/csv. | N/A |
file_name | The name of the file. This field is optional. | N/A |
Example request
curl --request POST \
--url https://api.aidbase.ai/v1/knowledge/document \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]' \
--header 'Content-Type: application/json' \
--data '{
"file_type": "application/pdf",
"file_name": "my-document"
}'
Example response
{
"success": true,
"data": {
"id": "aee9a3bb-ce5a-44d4-866e-51899215a1ff",
"upload_url": "[SIGNED_UPLOAD_URL]"
}
}
You must use the upload_url
provided in the response to upload the document file and then call the /finalize
endpoint to complete the document creation.
POST
/knowledge/:id/finalize
Finalize the creation of a knowledge item after successfully uploading the document file.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to finalize | N/A |
This is only applicable to knowledge items of type document
.
Example request
curl --request GET \
--url https://api.aidbase.ai/v1/knowledge/aee9a3bb-ce5a-44d4-866e-51899215a1ff/finalize \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"id": "aee9a3bb-ce5a-44d4-866e-51899215a1ff",
"type": "document",
"document_url": "https://cdn.aidbase.ai/53f337a6-f2f4-4f1e-8f63-0316c0ccb11a/documents/my-document.pdf",
}
}
POST
/knowledge/faq
Create a new knowledge item of type faq
.
Field | Description | Default value |
---|---|---|
title | The title of the FAQ. | N/A |
description | The description of the FAQ. This field is optional. | N/A |
Example request
curl --request POST \
--url https://api.aidbase.ai/v1/knowledge/faq \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]' \
--header 'Content-Type: application/json' \
--data '{
"title": "General FAQ",
"description": "General questions from new users."
}'
Example response
{
"success": true,
"data": {
"id": "3b3a4370-f5e3-4c34-9644-b731097ac6b8",
"type": "faq",
"title": "General FAQ",
"description": "General questions from new users."
}
}
POST
/knowledge/:id/faq-item
Create a new FAQ item associated with a specific FAQ knowledge item.
This is only applicable to knowledge items of type faq
.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to create an FAQ item for. | N/A |
question | The question of the FAQ item | N/A |
answer | The answer of the FAQ item | N/A |
source_url | The source URL of the FAQ item. This field is optional. | N/A |
categories | A list of category names for the FAQ. This field is optional. If the category does not exist, it will be created. | N/A |
Example request
curl --request POST \
--url https://api.aidbase.ai/v1/knowledge/3b3a4370-f5e3-4c34-9644-b731097ac6b8/faq-item \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]' \
--header 'Content-Type: application/json' \
--data '{
"question": "What is the price?",
"answer": "We have different plans for different types of usage.\nSee our pricing page for more details.",
"source_url": "https://example.com/pricing",
"categories": ["General", "Pricing"]
}'
Example response
{
"success": true,
"data": {
"id": "707370c7-b4cf-48a8-bcd8-20ee48208287",
"question": "What is the price?",
"answer": [
{
"id": "K7FdGHS8ZF",
"type": "paragraph",
"nodeType": "block",
"children": [
{
"text": "We have different plans for different types of usage.<br>See our pricing page for more details."
}
]
}
],
"source_url": "https://example.com/pricing",
"rating": {
"upvotes": 0,
"downvotes": 0
},
"categories": [
"Pricing",
"General"
]
}
}
DELETE
/knowledge/:id
Delete a specific knowledge item by its ID.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to delete. | N/A |
Example request
curl --request DELETE \
--url https://api.aidbase.ai/v1/knowledge/7639b950-10d6-4c3a-bb22-8f982fcf8c03 \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"id": "7639b950-10d6-4c3a-bb22-8f982fcf8c03",
"type": "website",
"base_url": "https://www.mywebsite.com/"
}
}
DELETE
/knowledge/:id/faq-item/:faq-item-id
Delete a specific FAQ item associated with a specific FAQ knowledge item.
This is only applicable to knowledge items of type faq
.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to delete an FAQ item from. | N/A |
:faq-item-id | The ID of the FAQ item to delete. | N/A |
Example request
curl --request DELETE \
--url https://api.aidbase.ai/v1/knowledge/3b3a4370-f5e3-4c34-9644-b731097ac6b8/faq-item/707370c7-b4cf-48a8-bcd8-20ee48208287 \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"id": "707370c7-b4cf-48a8-bcd8-20ee48208287",
"question": "What is the price?",
"answer": {
"version": "2.28.0",
"time": 1708682770518,
"blocks": [
{
"id": "pRzU8KBZq_",
"type": "paragraph",
"data": {
"text": "We have different plans for different types of usage.<br>See our pricing page for more details."
}
}
]
},
"rating": {
"upvotes": 0,
"downvotes": 0
},
"categories": [
"General",
"Pricing"
]
}
}
PUT
/knowledge/:id/train
Trigger a training session for a specific knowledge item.
A training session will take some time to finish.
You can use a GET
request to the /knowledge/:id
endpoint to check the status of the training session.
Field | Description | Default value |
---|---|---|
:id | The ID of the knowledge item to trigger training for. | N/A |
Example request
curl --request PUT \
--url https://api.aidbase.ai/v1/knowledge/3b3a4370-f5e3-4c34-9644-b731097ac6b8/train \
--header 'accept: application/json' \
--header 'Authorization: Bearer [YOUR_API_KEY]'
Example response
{
"success": true,
"data": {
"id": "3b3a4370-f5e3-4c34-9644-b731097ac6b8",
"type": "faq",
"title": "General FAQ",
"description": "General questions from new users.",
"trained_at": null,
"is_training": true,
"training_failed_at": null,
"training_failed_with": null
}
}