APIs
Chatbot API
Reference

API - Chatbot - Reference

GET /chatbots/

Get all chatbots associated with the user.

Example request

curl --request GET \
 --url https://api.aidbase.ai/v1/chatbots \
 --header 'accept: application/json' \
 --header 'Authorization: Bearer [YOUR_API_KEY]'

Example response

{
  "success": true,
  "data": [
    {
      "id": "1572f60b-791b-4e94-b5c7-9b42b650d3ca",
      "public_id": "p-8KP033W9GT8xZMEULqa",
      "title": "Website Chatbot",
      "allowed_domains": [
        "www.mywebsite.com",
      ]
    },
    {
      "id": "6e8665aa-b573-450c-b4f9-7846ce5c195e",
      "public_id": "oZ4tBppTZonaFVzNaNm_D",
      "title": "Test (Development) Chatbot",
      "allowed_domains": [
        "localhost:3000"
      ]
    }
    ...
  ]
}

GET /chatbot/:id/

Get a specific chatbot by ID.

Example request

curl --request GET \
 --url https://api.aidbase.ai/v1/chatbot/p-8KP033W9GT8xZMEULqa \
 --header 'accept: application/json' \
 --header 'Authorization: Bearer [YOUR_API_KEY]'

Example response

{
  "success": true,
  "data": {
    "id": "1572f60b-791b-4e94-b5c7-9b42b650d3ca",
    "public_id": "p-8KP033W9GT8xZMEULqa",
    "title": "Website Chatbot",
    "allowed_domains": [
      "www.mywebsite.com",
    ]
  }
}

POST /chatbot/:id/reply

Get an AI reply from a chatbot.

Example request

curl --request POST \
 --url https://api.aidbase.ai/v1/chatbot/odguL9hXiB413s3g9ZO3z/reply \
 --header 'accept: application/json' \
 --header 'Authorization: Bearer [YOUR_API_KEY]' \
 --data '{
    "message": "How can I get started with Aidbase API?"
 }'

Example response

{
  "success": true,
  "data": {
    "id": "a9fb17e5-db95-4777-8ccb-5fa391fcdd66",
    "session_id": "tAp_XW4qvRzKw4mlWKH9U",
    "message": "First you need to create an account on Aidbase. Then you can get your API key from the settings.",
  }
}

To get the next reply in the same conversation, include the session_id from the previous response.

Example request

curl --request POST \
 --url https://api.aidbase.ai/v1/chatbot/odguL9hXiB413s3g9ZO3z/reply \
 --header 'accept: application/json' \
 --header 'Authorization: Bearer [YOUR_API_KEY]' \
 --data '{
    "message": "How can I get started with Aidbase API?",
    "session_id": "tAp_XW4qvRzKw
 }'

GET /chatbot/:id/knowledge

Get all knowledge items associated with a chatbot.

Example request

curl --request GET \
 --url https://api.aidbase.ai/v1/chatbot/odguL9hXiB413s3g9ZO3z/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="
  }
}

PUT /chatbot/:id/knowledge

Add a new knowledge item to a chatbot.

ℹ️

The knowledge item must have a trained model.
The model can be trained using the /knowledge/:id/train endpoint.

Example request

curl --request PUT \
 --url https://api.aidbase.ai/v1/chatbot/odguL9hXiB413s3g9ZO3z/knowledge \
 --header 'accept: application/json' \
 --header 'Authorization: Bearer [YOUR_API_KEY]' \
 --data '{
    "knowledge_id": "cd2faf2c-464b-421f-a7b1-b856860551f8"
 }'

Example response

{
  "success": true,
}

DELETE /chatbot/:id/knowledge

Remove a knowledge item from a chatbot.

ℹ️

The knowledge item will be removed from the chatbot, but the knowledge item itself will not be deleted.

Example request

curl --request DELETE \
 --url https://api.aidbase.ai/v1/chatbot/odguL9hXiB413s3g9ZO3z/knowledge \
 --header 'accept: application/json' \
 --header 'Authorization: Bearer [YOUR_API_KEY]' \
 --data '{
    "knowledge_id": "cd2faf2c-464b-421f-a7b1-b856860551f8"
 }'

Example response

{
  "success": true,
}