curl -X PUT http://127.0.0.1:47334/api/projects/mindsdb/knowledge_bases/my_kb \
  -H "Content-Type: application/json" \
  -d '{
    "knowledge_base": {
      "rows": [
        {
          "order_id": "123",
          "product": "Widget A",
          "notes": "Great product, would buy again"
        },
        {
          "order_id": "124",
          "product": "Widget B",
          "notes": "Poor quality"
        }
      ],
      "query": "SELECT * FROM sample_data.orders"
    }
}'
200 OK

PUT /api/projects/{project_name}/knowledge_bases/{knowledge_base_name}

This API endpoint inserts data into a knowledge base using the PUT method.

Learn more about knowledge bases following this doc page.

Path Parameters

project_name
string
required

Defines the project where the knowledge bases are located. Note that the default project name is mindsdb.

knowledge_base_name
string
required

Defines the knowledge base name.

Body

query
string

Defines the SQL query used to fetch data to be inserted into the knowledge base.

rows
string

Defines raw data to be inserted into the knowledge base.

files
string

Defines the list of files to be inserted into the knowledge base.

urls
string

Defines the list of URLs to be crawled and their content inserted into the knowledge base. For example, "urls": ["https://docs.mindsdb.com/mindsdb_sql/knowledge-bases"].

limit
string

Defines the limit of pages to be crawled. For example, "limit": 10.

crawl_depth
string

Defines the crawl depth limit for URLs. For example, "crawl_depth": 2.

filters
string

Defines the list of domains to be filtered. For example, "filters": { "allowed_domains": ["example.com"] }.

Learn more about the web crawler here.

Response

None.

curl -X PUT http://127.0.0.1:47334/api/projects/mindsdb/knowledge_bases/my_kb \
  -H "Content-Type: application/json" \
  -d '{
    "knowledge_base": {
      "rows": [
        {
          "order_id": "123",
          "product": "Widget A",
          "notes": "Great product, would buy again"
        },
        {
          "order_id": "124",
          "product": "Widget B",
          "notes": "Poor quality"
        }
      ],
      "query": "SELECT * FROM sample_data.orders"
    }
}'
200 OK