Knowledge Base API
Sample requests and responses for building with the Agentaus API.
Reference for creating and managing datasets and instances (documents) programmatically — e.g. from a backend job, not through the Agentaus UI. This is a distinct, stable contract from the APIs the UI itself uses: a small set of fields and a single JSON error envelope.
Resources
Dataset object
id
Typestring (uuid)
NotesUse this in all subsequent calls
object
Typestring
NotesAlways
"dataset"name
Typestring
NotesDisplay name for the dataset
description
Typestring | null
NotesFree-text description of the dataset's contents
data_type
Typestring
NotesAlways
"document" for datasets created through this APIstatus
Typestring
Notes
"ready" if completed_instances >= total_instances (including an empty dataset), otherwise "processing"total_instances
Typeinteger
NotesInstance count
completed_instances
Typeinteger
NotesInstances that have finished vectorisation
created_at / updated_at
Typestring
NotesISO 8601, UTC
json
{
"id": "5a1f7e2c-...",
"object": "dataset",
"name": "Support KB",
"description": "Internal support articles",
"data_type": "document",
"status": "processing",
"total_instances": 12,
"completed_instances": 9,
"created_at": "2026-09-01T02:15:30Z",
"updated_at": "2026-09-10T11:02:00Z"
}Instance object
An instance is one uploaded document inside a dataset.
id
Typestring (uuid)
NotesUse this in subsequent retrieve/update/delete calls
object
Typestring
NotesAlways
"instance"dataset_id
Typestring (uuid)
NotesParent dataset
filename
Typestring | null
NotesOriginal uploaded filename
external_id
Typestring | null
NotesYour own identifier for this document (max 255 chars); settable and updatable
status
Typestring
NotesOne of
"pending", "processing", "completed", or "failed", reflecting document-processing progresserror
Typestring | null
NotesPresent only when
status is "failed"content_type
Typestring | null
NotesDerived from the filename extension
created_at / updated_at
Typestring
NotesISO 8601, UTC
json
{
"id": "9c3d1a44-...",
"object": "instance",
"dataset_id": "5a1f7e2c-...",
"filename": "handbook.pdf",
"external_id": "kb-042",
"status": "pending",
"content_type": "application/pdf",
"created_at": "2026-09-10T11:00:00Z",
"updated_at": "2026-09-10T11:00:00Z"
}Datasets
Create a dataset
POST
/api/v1/datasets
Create a Dataset
Requires headers
Authorization: Bearer <token> and Content-Type: application/json.Body parameters
name
RequiredDisplay name for the dataset.
description
OptionalFree-text description of the dataset's contents.
curl -X POST https://<host>/api/v1/datasets \
-H "Authorization: Bearer $AGENTAUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support KB",
"description": "Internal support articles"
}'Response
{
"id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"object": "dataset",
"name": "Support KB",
"description": "Internal support articles",
"data_type": "document",
"status": "ready",
"total_instances": 0,
"completed_instances": 0,
"created_at": "2026-09-10T11:00:00Z",
"updated_at": "2026-09-10T11:00:00Z"
}See Errors for the full list of error codes.
List datasets
GET
/api/v1/datasets
List Datasets
Requires header
Authorization: Bearer <token>. Returns the datasets you own in your tenant, one page at a time. Each item in data is a dataset object.Query parameters
count
OptionalPage size, 1–100. Defaults to
20.sort_by
Optionalinserted_at (default) or name.sort_order
Optionaldesc (default) or asc.cursor
OptionalThe
cursor from the previous response, to fetch the next page.is_usable
Optionaltrue or false to return only usable or only unusable datasets. Omit to list both.curl -G https://<host>/api/v1/datasets \ -H "Authorization: Bearer $AGENTAUS_API_KEY" \ -d count=2 \ -d sort_by=name \ -d sort_order=asc
Response
{
"object": "dataset.list",
"data": [
{
"id": "1d7b9e40-6a2c-4f13-8e5d-3c9a7b2f0e61",
"object": "dataset",
"name": "Product FAQ",
"description": null,
"data_type": "document",
"status": "ready",
"total_instances": 4,
"completed_instances": 4,
"created_at": "2026-08-20T08:30:00Z",
"updated_at": "2026-08-21T09:12:45Z"
},
{
"id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"object": "dataset",
"name": "Support KB",
"description": "Internal support articles",
"data_type": "document",
"status": "processing",
"total_instances": 12,
"completed_instances": 9,
"created_at": "2026-09-01T02:15:30Z",
"updated_at": "2026-09-10T11:02:00Z"
}
],
"cursor": "g3QAAAABZAAEbmFtZW0AAAAKU3VwcG9ydCBLQg",
"has_next_page": true
}The response is a list envelope:
object
Typestring
NotesAlways
"dataset.list"cursor
Typestring | null
NotesPass this as the
cursor query param to fetch the next pagehas_next_page
Typeboolean
Notes
false once you've reached the last pageTo page through every dataset, repeat the request with the returned
cursor until has_next_page is false. Keep sort_by and sort_order the same while following a cursor. A malformed or stale cursor is rejected with a 400Bad Request.See Errors for the full list of error codes.
Retrieve a dataset
GET
/api/v1/datasets/{id}
Retrieve a Dataset
Requires header
Authorization: Bearer <token>.Path parameters
id
RequiredDataset id
curl https://<host>/api/v1/datasets/$DATASET_ID \ -H "Authorization: Bearer $AGENTAUS_API_KEY"
Response
{
"id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"object": "dataset",
"name": "Support KB",
"description": "Internal support articles",
"data_type": "document",
"status": "processing",
"total_instances": 12,
"completed_instances": 9,
"created_at": "2026-09-01T02:15:30Z",
"updated_at": "2026-09-10T11:02:00Z"
}See Errors for the full list of error codes.
Update a dataset
PATCH
/api/v1/datasets/{id}
Update a Dataset
Requires headers
Authorization: Bearer <token> and Content-Type: application/json. Only name/description are accepted — any other key is rejected. Fields you omit are left unchanged.Path parameters
id
RequiredDataset id
Body parameters
name
OptionalNew display name for the dataset.
description
OptionalNew free-text description of the dataset's contents.
curl -X PATCH https://<host>/api/v1/datasets/$DATASET_ID \
-H "Authorization: Bearer $AGENTAUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"description": "Updated description"}'Response
{
"id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"object": "dataset",
"name": "Support KB",
"description": "Updated description",
"data_type": "document",
"status": "processing",
"total_instances": 12,
"completed_instances": 9,
"created_at": "2026-09-01T02:15:30Z",
"updated_at": "2026-09-10T11:05:00Z"
}See Errors for the full list of error codes.
Delete a dataset
DELETE
/api/v1/datasets/{id}
Delete a Dataset
Requires header
Authorization: Bearer <token>. Revokes access and queues record/media/vector cleanup asynchronously — a 200 response means the dataset is gone, not that every downstream artifact has finished being purged.Path parameters
id
RequiredDataset id
curl -X DELETE https://<host>/api/v1/datasets/$DATASET_ID \ -H "Authorization: Bearer $AGENTAUS_API_KEY"
Response
{
"id": "5a1f7e2c-...",
"object": "dataset",
"deleted": true
}See Errors for the full list of error codes.
Get dataset stats
GET
/api/v1/datasets/{dataset_id}/stats
Get Dataset Stats
Requires header
Authorization: Bearer <token>. Use this endpoint to poll for completion.Path parameters
dataset_id
RequiredDataset id
curl https://<host>/api/v1/datasets/$DATASET_ID/stats \ -H "Authorization: Bearer $AGENTAUS_API_KEY"
Response
{
"total_instances": 12,
"ready": 9,
"processing": 3,
"failed": 0
}See Errors for the full list of error codes.
Instances
Create an instance (upload a document)
POST
/api/v1/datasets/{dataset_id}/instances
Create an Instance
Requires header
Authorization: Bearer <token> and a multipart/form-data body — exactly one file per request. Uploading queues document parsing/vectorisation asynchronously.Path parameters
dataset_id
RequiredParent dataset id
Body parameters
file
RequiredOne of
.docx .pdf .doc .ppt .pptx .xls .xlsx .epub .html .md .odt .org .rst .rtf .csv .tsv .xml .txt .js .jsx .css .py .sql .ts .tsx .sh .java .cs .c .cpp .php .ps1 .go .rs .kt .lua .dart .asm .rb .jpg .jpeg .png .webp .bmp, up to 100,000,000 bytes (100 MB)external_id
OptionalYour own id for the document, max 255 chars
curl -X POST https://<host>/api/v1/datasets/$DATASET_ID/instances \ -H "Authorization: Bearer $AGENTAUS_API_KEY" \ -F "[email protected]" \ -F "external_id=kb-042"
Response
{
"id": "9c3d1a44-6b21-4f2e-8a13-2d5e7f8b9c10",
"object": "instance",
"dataset_id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"filename": "handbook.pdf",
"external_id": "kb-042",
"status": "pending",
"content_type": "application/pdf",
"created_at": "2026-09-10T11:00:00Z",
"updated_at": "2026-09-10T11:00:00Z"
}See Errors for the full list of error codes.
List instances
GET
/api/v1/datasets/{dataset_id}/instances
List Instances
Requires header
Authorization: Bearer <token>. Returns the instances in a dataset, one page at a time, ordered by creation time. Each item in data is an instance object.Path parameters
dataset_id
RequiredParent dataset id
Query parameters
status
OptionalOnly return instances in these statuses — any of
pending, processing, completed, failed. Repeat the param for each value, e.g. status[]=pending&status[]=failed. Omit to list all.count
OptionalPage size, 1–100. Defaults to
20.order
Optionaldesc (default, newest first) or asc, by creation time.cursor
OptionalThe
cursor from the previous response, to fetch the next page.curl -G https://<host>/api/v1/datasets/$DATASET_ID/instances \ -H "Authorization: Bearer $AGENTAUS_API_KEY" \ -d count=2 \ -d order=asc \ --data-urlencode "status[]=completed" \ --data-urlencode "status[]=failed"
Response
{
"object": "instance.list",
"data": [
{
"id": "9c3d1a44-6b21-4f2e-8a13-2d5e7f8b9c10",
"object": "instance",
"dataset_id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"filename": "handbook.pdf",
"external_id": "kb-042",
"status": "completed",
"content_type": "application/pdf",
"created_at": "2026-09-10T11:00:00Z",
"updated_at": "2026-09-10T11:03:20Z"
},
{
"id": "e4a8c2f1-0d3b-4c7e-9a56-7b1f2e3d4c58",
"object": "instance",
"dataset_id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"filename": "pricing.xlsx",
"external_id": null,
"status": "failed",
"error": "Unable to parse document",
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"created_at": "2026-09-10T11:01:00Z",
"updated_at": "2026-09-10T11:01:45Z"
}
],
"cursor": "g3QAAAACZAACaWRtAAAAJGU0YThjMmYx",
"has_next_page": true
}The response is a list envelope:
object
Typestring
NotesAlways
"instance.list"cursor
Typestring | null
NotesPass this as the
cursor query param to fetch the next pagehas_next_page
Typeboolean
Notes
false once you've reached the last pageTo page through every instance, repeat the request with the returned
cursor until has_next_page is false. Keep order the same while following a cursor. An invalid query param value, including a malformed cursor, is rejected with a 400Bad Request invalid_parameter_value.See Errors for the full list of error codes.
Retrieve an instance
GET
/api/v1/datasets/{dataset_id}/instances/{id}
Retrieve an Instance
Requires header
Authorization: Bearer <token>.Path parameters
dataset_id
RequiredParent dataset id
id
RequiredInstance id
curl https://<host>/api/v1/datasets/$DATASET_ID/instances/$INSTANCE_ID \ -H "Authorization: Bearer $AGENTAUS_API_KEY"
Response
{
"id": "9c3d1a44-6b21-4f2e-8a13-2d5e7f8b9c10",
"object": "instance",
"dataset_id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"filename": "handbook.pdf",
"external_id": "kb-042",
"status": "pending",
"content_type": "application/pdf",
"created_at": "2026-09-10T11:00:00Z",
"updated_at": "2026-09-10T11:00:00Z"
}See Errors for the full list of error codes.
Update an instance
PATCH
/api/v1/datasets/{dataset_id}/instances/{id}
Update an Instance
Requires headers
Authorization: Bearer <token> and Content-Type: application/json. Only external_id is accepted — any other key is rejected.Path parameters
dataset_id
RequiredParent dataset id
id
RequiredInstance id
Body parameters
external_id
OptionalMax 255 chars
curl -X PATCH https://<host>/api/v1/datasets/$DATASET_ID/instances/$INSTANCE_ID \
-H "Authorization: Bearer $AGENTAUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"external_id": "kb-042-v2"}'Response
{
"id": "9c3d1a44-6b21-4f2e-8a13-2d5e7f8b9c10",
"object": "instance",
"dataset_id": "5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10",
"filename": "handbook.pdf",
"external_id": "kb-042-v2",
"status": "pending",
"content_type": "application/pdf",
"created_at": "2026-09-10T11:00:00Z",
"updated_at": "2026-09-10T11:06:00Z"
}See Errors for the full list of error codes.
Delete an instance
DELETE
/api/v1/datasets/{dataset_id}/instances/{id}
Delete an Instance
Requires header
Authorization: Bearer <token>. Database rows are removed synchronously; S3 file and vector-store cleanup are best-effort and asynchronous.Path parameters
dataset_id
RequiredParent dataset id
id
RequiredInstance id
curl -X DELETE https://<host>/api/v1/datasets/$DATASET_ID/instances/$INSTANCE_ID \ -H "Authorization: Bearer $AGENTAUS_API_KEY"
Response
{
"id": "9c3d1a44-...",
"object": "instance",
"deleted": true
}Note the response key here is uuid, not id as on every other instance response — match on whichever field you sent in the request if you need to confirm which instance was deleted.
See Errors for the full list of error codes.
Errors
All errors — including authentication failures before your request reaches a specific dataset or instance — use this envelope.
request_id echoes the X-Request-Id response header when present — include it when reporting an issue:json
{
"error": {
"type": "invalid_request_error",
"code": "missing_required_parameter",
"message": "name is required",
"param": "name",
"request_id": "b3f0b1b2-1111-4444-8888-abcdefabcdef"
}
}400Bad Request
code
missing_required_parameterMeaningA required field was omitted
400Bad Request
code
invalid_parameter_valueMeaningA field failed validation (bad enum, wrong type, etc.)
400Bad Request
code
parameter_too_longMeaningA field exceeded its max length
400Bad Request
code
unsupported_parameterMeaningAn update request included a field it doesn't accept
400Bad Request
code
too_many_filesMeaningMore than one file uploaded to an instance create
400Bad Request
code
unsupported_file_typeMeaningFile extension not in the allowed list
400Bad Request
code
file_too_largeMeaningFile exceeds 100,000,000 bytes (100 MB)
400Bad Request
code
invalid_idMeaningThe dataset/instance id in the URL isn't a well-formed UUID
401Unauthorized
code
unauthorizedMeaningMissing, invalid, or expired bearer token
403Forbidden
code
insufficient_permissionsMeaningYour account has no base access to this API
404Not Found
code
dataset_not_foundMeaningDataset doesn't exist, or you lack access to it
404Not Found
code
instance_not_foundMeaningInstance doesn't exist in that dataset, or you lack access
500Internal Server Error
code
internal_errorMeaningUnexpected server error
503Service Unavailable
code
service_unavailableMeaningAuthorization backend temporarily unavailable — retry
Asynchronous processing
Uploading a document only queues parsing and vectorisation — it doesn't happen inline with the request. To know when a document is usable:
- Poll
GET /datasets/{id}/statsorGET /datasets/{id}and wait forcompleted_instances == total_instances/status == "ready". - The per-instance
statusfield starts at"pending"and is not currently a reliable per-instance completion signal — prefer the dataset-level aggregate above to decide when a dataset is ready to query.
End-to-end example — create a dataset, upload a document, poll until ready, then clean up:
bash
TOKEN="..."
HOST="https://<host>"
DATASET_ID=$(curl -s -X POST "$HOST/api/v1/datasets" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"name": "Support KB"}' | jq -r .id)
curl -s -X POST "$HOST/api/v1/datasets/$DATASET_ID/instances" \
-H "Authorization: Bearer $TOKEN" \
-F "[email protected]" -F "external_id=kb-042"
until [ "$(curl -s "$HOST/api/v1/datasets/$DATASET_ID" -H "Authorization: Bearer $TOKEN" | jq -r .status)" = "ready" ]; do
sleep 5
done
curl -s -X DELETE "$HOST/api/v1/datasets/$DATASET_ID" \
-H "Authorization: Bearer $TOKEN"Using a dataset in Chat Completions
Once a dataset's
status is ready (see above), ground a Chat Completions response in it by adding an agentaus_dataset_search tool entry with the dataset's id to tools — no other change to the request is needed:sh
curl -X POST https://<host>/api/v1/chat/completions \
-H "Authorization: Bearer $AGENTAUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "What is our policy on late refunds?"}],
"stream": false,
"tools": [
{
"type": "agentaus_dataset_search",
"dataset_ids": ["5a1f7e2c-3b4d-4e21-9f2a-8b6d2a5c9e10"]
}
]
}'Retrieval runs server-side before inference starts, so a normal text completion comes back — no tool call round-trip to handle:
json
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "According to the Support KB, late refunds are approved case-by-case within 14 days of the original purchase — see the \"Refunds\" section of the handbook for the full policy.",
"refusal": null,
"role": "assistant",
"tool_calls": []
}
}
],
"created": 1782460000,
"id": "chatcmpl-1782460000",
"model": "agentaus",
"object": "chat.completion",
"usage": {
"input_tokens": 3120,
"output_tokens": 48
}
}See
agentaus_dataset_search on the Chat Completions API page for the full tool contract — combining it with your own function tools, the dataset_ids field, and its error cases.