Skip to content

Knowledge Bases

These endpoints let you list your organization’s knowledge bases, manage text items within each base, and run semantic searches (RAG) directly via API.

Base URL: https://api.squados.io/v1

Every request requires the Authorization: Bearer pk_... header. Requests with a body also need Content-Type: application/json. See Authentication for details on generating and using tokens.


Lists all knowledge bases in the organization.

Query parameters

ParameterTypeDefaultDescription
limitinteger50Number of records per page. Maximum: 100.
offsetinteger0Starting position for pagination.
Terminal window
curl https://api.squados.io/v1/bases \
-H "Authorization: Bearer pk_your_key_here"

Response — 200 OK

{
"bases": [
{
"id": "BASE_ID",
"name": "Product Documentation",
"description": "Base with manuals and FAQs",
"item_count": 42,
"created_at": "2025-03-10T14:22:00Z",
"updated_at": "2025-06-01T09:45:00Z"
}
],
"total": 3,
"limit": 50,
"offset": 0
}

Returns the details of a specific knowledge base.

Path parameters

ParameterTypeDescription
baseIduuidKnowledge base ID.
Terminal window
curl https://api.squados.io/v1/bases/BASE_ID \
-H "Authorization: Bearer pk_your_key_here"

Response — 200 OK

{
"id": "BASE_ID",
"name": "Product Documentation",
"description": "Base with manuals and FAQs",
"item_count": 42,
"created_at": "2025-03-10T14:22:00Z",
"updated_at": "2025-06-01T09:45:00Z"
}

Errors: 404 if the base is not found.


Lists the items in a knowledge base with optional status filtering.

Path parameters

ParameterTypeDescription
baseIduuidKnowledge base ID.

Query parameters

ParameterTypeDefaultDescription
limitinteger50Number of records per page. Maximum: 100.
offsetinteger0Starting position for pagination.
statusstringFilter by status: pending, processing, processed, or error.
Terminal window
curl "https://api.squados.io/v1/bases/BASE_ID/items?status=processed&limit=20" \
-H "Authorization: Bearer pk_your_key_here"

Response — 200 OK

{
"base_id": "BASE_ID",
"items": [
{
"id": "ITEM_ID",
"name": "Return Policy",
"type": "text",
"source": "text",
"status": "processed",
"chunk_count": 4,
"token_count": 812,
"content_preview": "Our return policy allows exchange or refund of any product within 30 days…",
"created_at": "2025-05-20T11:00:00Z"
}
],
"total": 18,
"limit": 20,
"offset": 0
}

Inserts a new text item into the knowledge base.

Path parameters

ParameterTypeDescription
baseIduuidKnowledge base ID.

Request body

FieldTypeRequiredDescription
namestringYesItem title. Minimum: 1 character.
contentstringYesFull text content. Maximum: 100,000 characters.
Terminal window
curl -X POST https://api.squados.io/v1/bases/BASE_ID/items \
-H "Authorization: Bearer pk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Return Policy",
"content": "Our policy allows exchange or refund of any product within 30 days of purchase..."
}'

Response — 201 Created

{
"id": "ITEM_ID",
"base_id": "BASE_ID",
"name": "Return Policy",
"type": "text",
"status": "pending",
"created_at": "2025-06-08T12:00:00Z"
}

Errors: 400 if the body is invalid or content exceeds 100,000 characters; 404 if the base is not found.


Returns the full detail of an item, including its complete content.

Path parameters

ParameterTypeDescription
baseIduuidKnowledge base ID.
itemIduuidItem ID.
Terminal window
curl https://api.squados.io/v1/bases/BASE_ID/items/ITEM_ID \
-H "Authorization: Bearer pk_your_key_here"

Response — 200 OK

{
"id": "ITEM_ID",
"base_id": "BASE_ID",
"name": "Return Policy",
"type": "text",
"source": "text",
"status": "processed",
"chunk_count": 4,
"token_count": 812,
"content_preview": "Our return policy allows exchange or refund of any product within 30 days…",
"content": "Our return policy allows exchange or refund of any product within 30 days of purchase. To request, log into your account and open a support ticket...",
"created_at": "2025-05-20T11:00:00Z"
}

The content field holds the full text (up to 100,000 characters). If the item has not been processed yet, content is null.

Errors: 400 if baseId or itemId are not valid UUIDs; 404 if the item is not found.


Updates the name and/or content of a text item (source: "text").

Path parameters

ParameterTypeDescription
baseIduuidKnowledge base ID.
itemIduuidItem ID.

Request body — at least one field is required.

FieldTypeRequiredDescription
namestringNoNew item title.
contentstringNoNew text content. Maximum: 100,000 characters.
Terminal window
curl -X PATCH https://api.squados.io/v1/bases/BASE_ID/items/ITEM_ID \
-H "Authorization: Bearer pk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"content": "Updated text with the new return conditions..."
}'

Response — 200 OK

Returns the updated BaseItemDetail. Note that status resets to "pending" because re-embedding is triggered automatically.

{
"id": "ITEM_ID",
"base_id": "BASE_ID",
"name": "Return Policy",
"type": "text",
"source": "text",
"status": "pending",
"chunk_count": 0,
"token_count": 0,
"content_preview": null,
"content": "Updated text with the new return conditions...",
"created_at": "2025-05-20T11:00:00Z"
}

Removes an item from the knowledge base.

Path parameters

ParameterTypeDescription
baseIduuidKnowledge base ID.
itemIduuidItem ID.
Terminal window
curl -X DELETE https://api.squados.io/v1/bases/BASE_ID/items/ITEM_ID \
-H "Authorization: Bearer pk_your_key_here"

Response — 204 No Content

No body. Cleanup of the corresponding vectors in the vector store (Qdrant) is queued automatically after deletion.

Errors: 404 if the item is not found.


Runs a semantic search directly against the knowledge base using embeddings. Useful for integrating RAG into external systems — receive the most relevant chunks for a question and use them in your own pipeline.

Path parameters

ParameterTypeDescription
baseIduuidKnowledge base ID.

Request body

FieldTypeRequiredDescription
querystringYesText to search semantically.
limitintegerNoMaximum number of results. Default: 5. Maximum: 20.
min_scorenumberNoMinimum similarity score (0 to 1). Default: 0.6.

Simple example:

Terminal window
curl -X POST https://api.squados.io/v1/bases/BASE_ID/query \
-H "Authorization: Bearer pk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"query": "What is the return policy?"
}'

Example with filters:

Terminal window
curl -X POST https://api.squados.io/v1/bases/BASE_ID/query \
-H "Authorization: Bearer pk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the product prices?",
"limit": 10,
"min_score": 0.7
}'

Response — 200 OK

{
"query": "What is the return policy?",
"results": [
{
"content": "Our policy allows exchange or refund of any product within 30 days of purchase...",
"score": 0.92,
"item_id": "ITEM_ID",
"item_name": "Return Policy",
"chunk_index": 0
},
{
"content": "For products with manufacturing defects, the period is extended to 90 days...",
"score": 0.81,
"item_id": "ITEM_ID",
"item_name": "Return Policy",
"chunk_index": 1
}
],
"total_results": 2,
"embedding_model": "text-embedding-3-small"
}

Each result returns the text chunk (content), its similarity score (0 to 1), the source item, and the chunk index within that item.

Errors: 400 if query is invalid or missing; 404 if the base is not found; 500 if RAG is not configured for the base.


For details on errors and HTTP status codes, see Errors.