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.
| Method | Path | Purpose |
|---|---|---|
| GET | /documents | List documents |
| GET | /documents/{id} | Get document metadata |
| GET | /documents/{id}/content | Get raw text content |
| POST | /documents | Create 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}/documents | List documents attached to an assistant |
| POST | /assistants/{id}/documents | Attach 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), andcontent(max 1 MB). - multipart/form-data — upload a file: fields
nameandfile.
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 param | Type | Required | Description |
|---|---|---|---|
limit | number | No | Page size, 1–200 (default 50) |
offset | number | No | Items to skip |
search | string | No | Filter, max 200 chars |
usedByAssistant | UUID | No | Only documents attached to this assistant |
GET /documents/{id}returns the document's metadata.GET /documents/{id}/contentreturns the raw text withContent-Type: text/plain; charset=utf-8— the response body is the document text itself, not the usual JSON envelope.
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).
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:
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:
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#
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.