Skip to content

Knowledge Bases

The Knowledge Bases API lets you inspect your organization’s bases, manage their items, and retrieve context for external applications. The public API does not create, rename, or delete the base itself: use SquadOS for those operations. Through the API, you inspect existing bases and create, read, update, or delete items.

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

Every request requires Authorization: Bearer pk_.... Requests with a body also require Content-Type: application/json. See Authentication.

Every endpoint is scoped to the token’s organization. An ID that belongs to another organization is treated as not found.

Lists the organization’s bases from newest to oldest.

QueryTypeDefaultRule
limitinteger50Maximum 100.
offsetinteger0Starting position for the page.
Terminal window
curl "https://api.squados.io/v1/bases?limit=50&offset=0" \
-H "Authorization: Bearer pk_your_key_here"
{
"bases": [
{
"id": "BASE_ID",
"name": "Product Documentation",
"description": "Manuals and frequently asked questions",
"item_count": 42,
"created_at": "2026-08-15T14:22:00Z",
"updated_at": "2026-08-31T09:45:00Z"
}
],
"total": 1,
"limit": 50,
"offset": 0
}

description may be null. item_count is the base’s current item count.

Returns one base and its item count. description may be null.

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

Returns 400 when baseId is not a valid UUID and 404 when the base does not exist in the organization.

An item goes through asynchronous processing. The expected states are:

StatusMeaning
pendingWaiting for processing.
processingExtraction, splitting, and indexing are in progress.
processedAvailable for retrieval.
errorProcessing failed.

Lists the base’s items from newest to oldest.

QueryTypeDefaultRule
limitinteger50Maximum 100.
offsetinteger0Starting position for the page.
statusstringExact filter: 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"
{
"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 policy accepts returns within 30 days...",
"created_at": "2026-08-20T11:00:00Z"
}
],
"total": 1,
"limit": 20,
"offset": 0
}

chunk_count, token_count, and content_preview may be null until processing produces a result.

Creates an item with source: "text".

FieldTypeRequiredRule
namestringYesMust not be empty after trimming surrounding whitespace.
contentstringYesMust not be empty; 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": "We accept returns within 30 days of purchase."
}'

The 201 Created response contains id, base_id, name, type, status, and created_at. The item starts with status: "pending" and asynchronously moves to processing and then processed or error.

Returns the list fields plus base_id and content.

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

Text items preserve the submitted content in content, including before indexing finishes. For a file-sourced item, content may be null before extraction. chunk_count, token_count, and content_preview may also be null.

Returns 400 when either ID is not a valid UUID and 404 when the base or item does not exist in the organization.

Updates name, content, or both on an item with source: "text". At least one field is required; content remains limited to 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": "We accept returns within 45 days of purchase."
}'

Every update — including a name-only update — resets status to pending and starts new processing. The 200 OK response returns the item detail. During this transition, chunk_count, token_count, and content_preview may still reflect the previous processing run; treat them as provisional until the new processed state.

Deletes the item and returns 204 No Content, with no body. The deletion queues asynchronous cleanup of vectors and chunk files in the same commit. The 204 confirms item deletion, not a specific deadline for internal cleanup.

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

Returns 400 for invalid IDs and 404 when the base or item does not exist in the organization.

Retrieves base excerpts with the same engine used by agents: query expansion, dense and lexical (BM25) search, fusion, reranking, and deduplication. The query is restricted to the organization and exact base ID.

FieldTypeRequiredRule
querystringYesQuestion or search text; an empty string is rejected.
limitintegerNoDefault 5; normalized to 1 through 20. Limits presentation without changing the outcome classification.
min_scorenumberNoDeprecated and ignored. Accepted only for backward compatibility.
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 deadline?",
"limit": 5
}'
{
"query": "What is the return deadline?",
"results": [
{
"content": "We accept returns within 45 days of purchase.",
"score": 0.92,
"item_id": "ITEM_ID",
"item_name": "Return policy",
"chunk_index": 0
}
],
"total_results": 1,
"embedding_model": "text-embedding-3-small",
"outcome": "supported",
"degraded": false
}
FieldMeaning
resultsFinal excerpts after reranking and limiting. Always [] for not_found.
total_resultsNumber of excerpts returned in results.
outcomesupported, uncertain, or not_found. Use this field to decide whether reliable context is available.
degradedtrue when the organization used the legacy contingency engine. The response shape stays the same.
scoreReranker relevance from 0 to 1, rounded to four decimals. It is not cosine similarity. Compare only results from the same query and do not apply a fixed cutoff.
item_nameSource item name; may be null.
chunk_indexExcerpt index; may be an integer, string, or null.

The endpoint returns 400 for invalid IDs or bodies, 404 for a missing base, 503 service_unavailable when a retrieval dependency is unavailable, and 500 for missing configuration or an unexpected failure.

See Errors for the API’s common failure format.