iblai-api-agent-dataset
Manage an agent's training datasets (RAG) through the API: list an agent's
training documents, add new resources to its knowledge base, train / untrain and
set visibility, configure a retrain schedule, and delete datasets. Use when
feeding an agent knowledge.
Auth & conventions
- Base URL:
https://api.iblai.app
- Header:
Authorization: Api-Token $IBLAI_API_KEY on every request.
- Path vars:
{org} = $IBLAI_ORG, {username} = $IBLAI_USERNAME,
{mentor} = the agent's unique id (e.g. d17dc729-60fd-4363-81a0-f67d9318b03e),
used here as the pathway.
- Host: these endpoints live under
…/dm/api/ai-index/….
- Not connected yet? Run
/iblai-api-login first to populate IBLAI_ORG,
IBLAI_USERNAME, and IBLAI_API_KEY.
Reads
- GET
https://api.iblai.app/dm/api/ai-index/orgs/{org}/users/{username}/documents/pathways/{mentor}/?limit=5&offset={n}&search={q} — list training docs. Poll this every 2s while any document is pending.
- GET
https://api.iblai.app/dm/api/ai-index/documents/{document_id}/settings/ — retrain schedule.
- GET
https://api.github.com/repos/{owner}/{repo}/branches — list GitHub branches for a repo resource (external, no auth).
Writes
- POST
https://api.iblai.app/dm/api/ai-index/orgs/{org}/users/{username}/documents/train/ — add a training resource (multipart/form-data); type varies:
- File:
{
"file": "File (required)",
"pathway": "{mentor}",
"type": "file|<ext>",
"user_image_description": "string"
}
- URL / YouTube / Blackboard:
{
"type": "url|youtube|blackboard",
"pathway": "{mentor}",
"url": "string (required)"
}
- Website crawl:
{
"type": "webcrawler",
"pathway": "{mentor}",
"url": "string",
"crawler_max_depth": "number",
"crawler_max_pages_limit": "number",
"crawler_match_patterns": "string[]",
"crawler_pattern_type": "glob|regex"
}
- GitHub:
{
"url": "repo url",
"branch": "string",
"pathway": "{mentor}",
"type": "github"
}
custom_metadata (optional, works with every type above) — a flat JSON
object of tags stored on the document, later usable as a hard retrieval filter at chat
time via document_filter (see /iblai-api-agent-session). Send it as a nested object
on a JSON body, or — because train/ is multipart/form-data — as a JSON-encoded
string form field:{ "custom_metadata": { "stateCode": "CA", "productGroup": "LICENSING", "year": 2026 } }
Rules (rejected with a validation error otherwise): keys must be flat and
alphanumeric/underscore (^\w+$, no __); values must be scalars (string, number, or
boolean) — no nested objects, arrays, or null. Stored on the document as
metadata.custom_metadata and echoed back by the list endpoint above. Leave a tag
off documents that should be exempt from a filter on that key — a document_filter
only excludes documents that carry the key with a different value, so untagged/generic
material always survives (see /iblai-api-agent-session ## Schema).
- PUT
https://api.iblai.app/dm/api/ai-index/documents/{document_id}/ — train / untrain + visibility (+ retag):{
"pathway": "{mentor}",
"url": "string",
"train": "boolean",
"access": "public|private",
"custom_metadata": { "stateCode": "CA" }
}
custom_metadata here replaces the document's stored tags (same validation as train/);
omit it to leave existing tags unchanged.
- POST
https://api.iblai.app/dm/api/ai-index/documents/{document_id}/settings/ — set retrain schedule:{
"retrain_interval_days": "number (required)"
}
- DELETE
https://api.iblai.app/dm/api/ai-index/documents/{document_id}/ — delete a dataset. Destructive — confirm with the user first.
Example
Add a YouTube video to an agent's knowledge base:
curl -X POST \
"https://api.iblai.app/dm/api/ai-index/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/documents/train/" \
-H "Authorization: Api-Token $IBLAI_API_KEY" \
-F "type=youtube" \
-F "pathway=$MENTOR" \
-F "url=https://www.youtube.com/watch?v=dQw4w9WgXcQ"
Upload a file tagged with custom_metadata (JSON-encoded string in the form field), so a
chat turn can later scope retrieval to it with document_filter: {"stateCode":"CA"}:
curl -X POST \
"https://api.iblai.app/dm/api/ai-index/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/documents/train/" \
-H "Authorization: Api-Token $IBLAI_API_KEY" \
-F "type=file" \
-F "pathway=$MENTOR" \
-F "file=@ca-insurance-explainer.pdf" \
-F 'custom_metadata={"stateCode":"CA","productGroup":"LICENSING"}'
Notes
- The list endpoint should be polled every 2s while any document is
pending so
newly added resources flip to trained as soon as processing finishes.
pathway is the agent's {mentor} unique id on every train/PUT call.
- For GitHub resources, fetch the branch list from the unauthenticated
api.github.com/repos/{owner}/{repo}/branches endpoint to populate branch.
- Deletion is destructive — confirm with the user first.
1---2name: iblai-api-agent-dataset3description: Manage an ibl.ai agent's training datasets (RAG) via the platform API — list training docs, add resources (file, URL, YouTube, Blackboard, website crawl, GitHub), train/untrain, set visibility and retrain schedule, and delete. Use when feeding an agent knowledge.4---56# iblai-api-agent-dataset78Manage an agent's training datasets (RAG) through the API: list an agent's9training documents, add new resources to its knowledge base, train / untrain and10set visibility, configure a retrain schedule, and delete datasets. Use when11feeding an agent knowledge.1213## Auth & conventions1415- **Base URL:** `https://api.iblai.app`16- **Header:** `Authorization: Api-Token $IBLAI_API_KEY` on every request.17- **Path vars:** `{org}` = `$IBLAI_ORG`, `{username}` = `$IBLAI_USERNAME`,18 `{mentor}` = the agent's unique id (e.g. `d17dc729-60fd-4363-81a0-f67d9318b03e`),19 used here as the `pathway`.20- **Host:** these endpoints live under `…/dm/api/ai-index/…`.21- Not connected yet? Run **`/iblai-api-login`** first to populate `IBLAI_ORG`,22 `IBLAI_USERNAME`, and `IBLAI_API_KEY`.2324## Reads2526- **GET** `https://api.iblai.app/dm/api/ai-index/orgs/{org}/users/{username}/documents/pathways/{mentor}/?limit=5&offset={n}&search={q}` — list training docs. Poll this every 2s while any document is `pending`.27- **GET** `https://api.iblai.app/dm/api/ai-index/documents/{document_id}/settings/` — retrain schedule.28- **GET** `https://api.github.com/repos/{owner}/{repo}/branches` — list GitHub branches for a repo resource (external, no auth).2930## Writes3132- **POST** `https://api.iblai.app/dm/api/ai-index/orgs/{org}/users/{username}/documents/train/` — add a training resource (`multipart/form-data`); `type` varies:33 - File:34 ```json35 {36 "file": "File (required)",37 "pathway": "{mentor}",38 "type": "file|<ext>",39 "user_image_description": "string"40 }41 ```42 - URL / YouTube / Blackboard:43 ```json44 {45 "type": "url|youtube|blackboard",46 "pathway": "{mentor}",47 "url": "string (required)"48 }49 ```50 - Website crawl:51 ```json52 {53 "type": "webcrawler",54 "pathway": "{mentor}",55 "url": "string",56 "crawler_max_depth": "number",57 "crawler_max_pages_limit": "number",58 "crawler_match_patterns": "string[]",59 "crawler_pattern_type": "glob|regex"60 }61 ```62 - GitHub:63 ```json64 {65 "url": "repo url",66 "branch": "string",67 "pathway": "{mentor}",68 "type": "github"69 }70 ```71 - **`custom_metadata`** (optional, works with **every** `type` above) — a flat JSON72 object of tags stored on the document, later usable as a hard retrieval filter at chat73 time via `document_filter` (see `/iblai-api-agent-session`). Send it as a nested object74 on a JSON body, or — because `train/` is `multipart/form-data` — as a **JSON-encoded75 string** form field:76 ```json77 { "custom_metadata": { "stateCode": "CA", "productGroup": "LICENSING", "year": 2026 } }78 ```79 Rules (rejected with a validation error otherwise): keys must be flat and80 alphanumeric/underscore (`^\w+$`, no `__`); values must be scalars (string, number, or81 boolean) — no nested objects, arrays, or `null`. Stored on the document as82 `metadata.custom_metadata` and echoed back by the list endpoint above. Leave a tag83 **off** documents that should be exempt from a filter on that key — a `document_filter`84 only excludes documents that carry the key with a *different* value, so untagged/generic85 material always survives (see `/iblai-api-agent-session ## Schema`).86- **PUT** `https://api.iblai.app/dm/api/ai-index/documents/{document_id}/` — **train / untrain + visibility (+ retag)**:87 ```json88 {89 "pathway": "{mentor}",90 "url": "string",91 "train": "boolean",92 "access": "public|private",93 "custom_metadata": { "stateCode": "CA" }94 }95 ```96 `custom_metadata` here replaces the document's stored tags (same validation as `train/`);97 omit it to leave existing tags unchanged.98- **POST** `https://api.iblai.app/dm/api/ai-index/documents/{document_id}/settings/` — **set retrain schedule**:99 ```json100 {101 "retrain_interval_days": "number (required)"102 }103 ```104- **DELETE** `https://api.iblai.app/dm/api/ai-index/documents/{document_id}/` — delete a dataset. Destructive — confirm with the user first.105106## Example107108Add a YouTube video to an agent's knowledge base:109110```bash111curl -X POST \112 "https://api.iblai.app/dm/api/ai-index/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/documents/train/" \113 -H "Authorization: Api-Token $IBLAI_API_KEY" \114 -F "type=youtube" \115 -F "pathway=$MENTOR" \116 -F "url=https://www.youtube.com/watch?v=dQw4w9WgXcQ"117```118119Upload a file tagged with `custom_metadata` (JSON-encoded string in the form field), so a120chat turn can later scope retrieval to it with `document_filter: {"stateCode":"CA"}`:121122```bash123curl -X POST \124 "https://api.iblai.app/dm/api/ai-index/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/documents/train/" \125 -H "Authorization: Api-Token $IBLAI_API_KEY" \126 -F "type=file" \127 -F "pathway=$MENTOR" \128 -F "file=@ca-insurance-explainer.pdf" \129 -F 'custom_metadata={"stateCode":"CA","productGroup":"LICENSING"}'130```131132## Notes133134- The list endpoint should be polled every 2s while any document is `pending` so135 newly added resources flip to trained as soon as processing finishes.136- `pathway` is the agent's `{mentor}` unique id on every train/PUT call.137- For GitHub resources, fetch the branch list from the unauthenticated138 `api.github.com/repos/{owner}/{repo}/branches` endpoint to populate `branch`.139- Deletion is destructive — confirm with the user first.