Skip to main content

Knowledge Base API Documentation

GET: Retrieve Knowledge Base

Description

This route is used to retrieve a list of all the questions and answers for a specific project.

Method

GET

Query Parameters

  • sort (string): The field by which to sort the Knowledge base.
  • page (number): The page number of the results.
  • limit (number): The number of items per page.
  • searchTerm (string): Optional search term to filter Knowledge base.

Response

  • Returns a JSON response with the list of Knowledge base or an error message.

Status Codes

  • 200 OK: Knowledge Base retrieved successfully.
  • 500 Internal Server Error: Error listing Knowledge Base.

Throws

  • An error if request validation or Knowledge base retrieval fails.

Example cURL

curl --location 'https://app.ai12z.net/api/projects/{projectId}/kb' \
--header 'Authorization: Bearer <YOUR_KEY>'
--data-urlencode 'sort=name' \
--data-urlencode 'page=1' \
--data-urlencode 'limit=10'

GET: Retrieve Knowledge Base by ID

Description

This route is used to retrieve details of a specific Knowledge base by its ID.

Method

GET

URL Parameters

  • id (string): The ID of the Knowledge base to retrieve.

Response

  • Returns a JSON response with Knowledge base details such as id, question, answer, imageDescription,imageurl and imageCaption.

Status Codes

  • 200 OK: Knowledge base retrieved successfully.
  • 500 Internal Server Error: Error retrieving the Knowledge Base.

Throws

  • An error if the Knowledge Base is not found or any other error occurs.

Example cURL

curl --location 'https://app.ai12z.net/api/projects/{projectId}/kb' \
--header 'Authorization: Bearer <YOUR_KEY>'


POST: Create a knowledge Base

Description

This route is used to create a new Knowledge base for a project.

Method

POST

Request Body

Example request body:

{
"question": "Knowledgebase question",
"answer": "Knowledgebase anwer",
"link": "Knowledgebase link"
}

Response

  • Returns the newly created knowledge base.

Status Codes

  • 200 OK: knowledge base created successfully.
  • 500 Internal Server Error: Error creating the knowledge base.

Throws

  • An error if request validation or knowledge base creation fails.

Example cURL

curl --location 'https://app.ai12z.net/api/projects/{projectId}/kb' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"question": "Knowledgebase question",
"answer": "Knowledgebase anwer",
"link": "Knowledgebase link"
}'

PUT: Update a knowledge Base

Description

This route is used to update an existing knowledge base.

Method

PUT

Request Body

Example request body:

{
"id": "Knowledgebase ID",
"question": "Knowledgebase question",
"answer": "Knowledgebase anwer",
"link": "Knowledgebase link"
}

Response

  • Returns the updated Knowledge base.

Status Codes

  • 200 OK: Knowledge base updated successfully.
  • 500 Internal Server Error: Error updating the Knowledge base.

Throws

  • An error if request validation or Knowledge base update fails.

Example cURL

curl --location --request PUT 'https://app.ai12z.net/api/projects/{projectId}/kb' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":"Knowledgebase ID",
"question": "Knowledgebase question",
"answer": "Knowledgebase anwer",
"link": "Knowledgebase link"
}'

DELETE: Delete a knowledge base

Description

This route is used to delete an existing Knowledge base.

Method

DELETE

Request Body

Example request body:

{
"id": "Knowledge base ID"
}

Response

  • Returns a confirmation message indicating successful deletion.

Status Codes

  • 200 OK: Knowledge base deleted successfully.
  • 500 Internal Server Error: Error deleting the Knowledge base.

Throws

  • An error if request validation or Knowledge base deletion fails.

Example cURL

curl --location --request DELETE 'https://app.ai12z.net/api/projects/{projectId}/kb' \
--header 'Authorization: Bearer <YOUR_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "Knowledgebase ID"
}'