API reference

Knowledge

Knowledge documents

MethodPathSummary
GET/v1/account/knowledgeKnowledge documents at account level and for groups
POST/v1/account/knowledge/ask"Ask it a question": the passages the agent would find, and which document each came from
POST/v1/account/knowledge/textAdd pasted text; it is stored as a .txt file and embedded in the background
POST/v1/account/knowledge/uploadUpload a file (multipart: file, optional title and groupId fields). Text, Markdown, HTML or CSV.
POST/v1/account/knowledge/urlAdd a web page by its address; it is fetched and embedded in the background
DELETE/v1/account/knowledge/{docId}Delete a document, its chunks and its stored file

Knowledge documents at account level and for groups#

GET /v1/account/knowledge

Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).

Query parameters

NameTypeRequiredDescription
groupIdstring (grp_… ID)NoID (grp_…)
scopeenumNoOne of: "all", "account", "group". Default: "all".

Response 200

FieldTypeRequiredDescription
docsarray<KnowledgeDoc>Yes—
docs[].assetIdstring | nullYes—
docs[].createdAtstring (date-time)Yes—
docs[].embeddedAtstring (date-time) | nullYes—
docs[].errorstring | nullYes—
docs[].groupIdstring (grp_… ID) | nullYes—
docs[].idstring (kdoc_… ID)YesID (kdoc_…)
docs[].sourceTypeenumYesOne of: "upload", "url", "text".
docs[].sourceUrlstring | nullYes—
docs[].statusenumYesOne of: "pending", "processing", "ready", "failed".
docs[].titlestringYes—
docs[].updatedAtstring (date-time)Yes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
curl -X GET "$ANSWERSTACK_API_URL/v1/account/knowledge" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

"Ask it a question": the passages the agent would find, and which document each came from#

POST /v1/account/knowledge/ask

Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token). Bearer token: Authorization: Bearer <token> (An API token (ans_pat_ or ans_svc_). Only routes that list a scope here accept one, and only with that scope.).

Request body

application/json, required.

FieldTypeRequiredDescription
groupIdstring (grp_… ID)NoID (grp_…)
limitintegerNoBetween 1 and 10. Default: 3.
playbookIdstring (pb_… ID)NoID (pb_…)
questionstringYes2–500 characters.

Response 200

FieldTypeRequiredDescription
passagesarray<object>Yes—
passages[].contentstringYes—
passages[].docIdstring (kdoc_… ID)YesID (kdoc_…)
passages[].isGroupDocbooleanYes—
passages[].similaritynumberYes—
passages[].titlestringYes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
curl -X POST "$ANSWERSTACK_API_URL/v1/account/knowledge/ask" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "question": "string"
}'

Add pasted text; it is stored as a .txt file and embedded in the background#

POST /v1/account/knowledge/text

Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token). Bearer token: Authorization: Bearer <token> (An API token (ans_pat_ or ans_svc_). Only routes that list a scope here accept one, and only with that scope.).

Request body

application/json, required.

FieldTypeRequiredDescription
groupIdstring (grp_… ID)NoID (grp_…)
textstringYes1–200000 characters.
titlestringYes1–200 characters.

Response 201

FieldTypeRequiredDescription
assetIdstring | nullYes—
createdAtstring (date-time)Yes—
embeddedAtstring (date-time) | nullYes—
errorstring | nullYes—
groupIdstring (grp_… ID) | nullYes—
idstring (kdoc_… ID)YesID (kdoc_…)
sourceTypeenumYesOne of: "upload", "url", "text".
sourceUrlstring | nullYes—
statusenumYesOne of: "pending", "processing", "ready", "failed".
titlestringYes—
updatedAtstring (date-time)Yes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
curl -X POST "$ANSWERSTACK_API_URL/v1/account/knowledge/text" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "string",
  "text": "string"
}'

Upload a file (multipart: file, optional title and groupId fields). Text, Markdown, HTML or CSV.#

POST /v1/account/knowledge/upload

Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).

Response 201

FieldTypeRequiredDescription
assetIdstring | nullYes—
createdAtstring (date-time)Yes—
embeddedAtstring (date-time) | nullYes—
errorstring | nullYes—
groupIdstring (grp_… ID) | nullYes—
idstring (kdoc_… ID)YesID (kdoc_…)
sourceTypeenumYesOne of: "upload", "url", "text".
sourceUrlstring | nullYes—
statusenumYesOne of: "pending", "processing", "ready", "failed".
titlestringYes—
updatedAtstring (date-time)Yes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
curl -X POST "$ANSWERSTACK_API_URL/v1/account/knowledge/upload" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

Add a web page by its address; it is fetched and embedded in the background#

POST /v1/account/knowledge/url

Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).

Request body

application/json, required.

FieldTypeRequiredDescription
groupIdstring (grp_… ID)NoID (grp_…)
titlestringNo1–200 characters.
urlstringYes1–2000 characters.

Response 201

FieldTypeRequiredDescription
assetIdstring | nullYes—
createdAtstring (date-time)Yes—
embeddedAtstring (date-time) | nullYes—
errorstring | nullYes—
groupIdstring (grp_… ID) | nullYes—
idstring (kdoc_… ID)YesID (kdoc_…)
sourceTypeenumYesOne of: "upload", "url", "text".
sourceUrlstring | nullYes—
statusenumYesOne of: "pending", "processing", "ready", "failed".
titlestringYes—
updatedAtstring (date-time)Yes—

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
curl -X POST "$ANSWERSTACK_API_URL/v1/account/knowledge/url" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "url": "string"
}'

Delete a document, its chunks and its stored file#

DELETE /v1/account/knowledge/{docId}

Authentication: Bearer token: Authorization: Bearer <token> (Supabase access token).

Path parameters

NameTypeRequiredDescription
docIdstring (kdoc_… ID)YesID (kdoc_…)

Response 200

FieldTypeRequiredDescription
deletedenumYesOne of: true.

Errors: 400, 401, 403, 404, 409, 429, 500, with an ErrorBody body.

Example

bash
curl -X DELETE "$ANSWERSTACK_API_URL/v1/account/knowledge/{docId}" \
  -H "Authorization: Bearer $ACCESS_TOKEN"