Skip to content

Guides

Knowledge base

Upload plain-text documents and attach them to assistants so they can answer from your content.

The knowledge base is a library of plain-text documents owned by your tenant. You upload a document once, then attach it to one or more assistants; attached documents can be enabled or disabled per assistant without detaching them.

MethodPathPurpose
GET/documentsList documents
GET/documents/{id}Get document metadata
GET/documents/{id}/contentGet raw text content
POST/documentsCreate a document (JSON or file upload)
PATCH/documents/{id}Update name and/or content
DELETE/documents/{id}Delete (fails with 409 while attached)
GET/assistants/{id}/documentsList documents attached to an assistant
POST/assistants/{id}/documentsAttach a document
PATCH/assistants/{id}/documents/{documentId}Enable/disable an attachment
DELETE/assistants/{id}/documents/{documentId}Detach a document

Create a document#

POST /documents accepts two content types:

  • JSON — send the text inline: name (max 200 chars), filename (must end in .txt, max 255 chars), and content (max 1 MB).
  • multipart/form-data — upload a file: fields name and file.
bash
curl -X POST https://core-api.heysadie.ai/documents \
  -H "Authorization: ApiKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Opening hours",
    "filename": "opening-hours.txt",
    "content": "We are open Monday to Friday, 9am to 5pm."
  }'

Document responses include id, name, sizeBytes, timestamps, and usedByCount — the number of assistants currently using the document.

List and read documents#

GET /documents

Query paramTypeRequiredDescription
limitnumberNoPage size, 1–200 (default 50)
offsetnumberNoItems to skip
searchstringNoFilter, max 200 chars
usedByAssistantUUIDNoOnly documents attached to this assistant
  • GET /documents/{id} returns the document's metadata.
  • GET /documents/{id}/content returns the raw text with Content-Type: text/plain; charset=utf-8 — the response body is the document text itself, not the usual JSON envelope.
Terminal
curl https://core-api.heysadie.ai/documents/DOCUMENT_ID/content \
  -H "Authorization: ApiKey YOUR_API_KEY"

Update a document#

PATCH /documents/{id} — like create, accepts JSON (name, filename, content, at least one required) or multipart (name and/or file).

Terminal
curl -X PATCH https://core-api.heysadie.ai/documents/DOCUMENT_ID \
  -H "Authorization: ApiKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "content": "We are open every day, 9am to 9pm." }'

Attach documents to an assistant#

Attach an existing document:

bash
curl -X POST https://core-api.heysadie.ai/assistants/ASSISTANT_ID/documents \
  -H "Authorization: ApiKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "documentId": "DOCUMENT_ID" }'

A successful attach returns 201 with an empty body. GET /assistants/{id}/documents lists what's attached.

Enable or disable per assistant#

An attachment can be toggled without removing it — useful for temporarily pulling content from one assistant while other assistants keep using the document:

Terminal
curl -X PATCH https://core-api.heysadie.ai/assistants/ASSISTANT_ID/documents/DOCUMENT_ID \
  -H "Authorization: ApiKey YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "enabled": false }'

Detach#

Terminal
curl -X DELETE https://core-api.heysadie.ai/assistants/ASSISTANT_ID/documents/DOCUMENT_ID \
  -H "Authorization: ApiKey YOUR_API_KEY"

Returns 204 No Content.

Delete a document#

DELETE /documents/{id} soft-deletes the document and returns 204 No Content.

409 while attached

Deleting a document that is still attached to any assistant fails with 409 Conflict ("Document is attached to assistants — detach first"); the error details include the attached assistant IDs. Detach it from every assistant, then delete.

Next steps#

  • Assistants — the rest of the assistant configuration surface.
  • Task groups — structured task flows, another way to shape assistant behavior.