import requests
url = "https://api.datagrid.com/v1/knowledge"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files": "<string>",
"name": "<string>",
"parent": "{
\"type\": \"page\",
\"page_id\": \"<string>\"
}",
"semantic_indexing_enabled": "true"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('name', '<string>');
form.append('parent', '{
"type": "page",
"page_id": "<string>"
}');
form.append('semantic_indexing_enabled', 'true');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.datagrid.com/v1/knowledge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/knowledge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form 'name=<string>' \
--form 'parent={
"type": "page",
"page_id": "<string>"
}' \
--form semantic_indexing_enabled=true \
--form files.items='@example-file'{
"object": "knowledge",
"id": "<string>",
"name": "<string>",
"teamspace_id": "<string>",
"scope": "teamspace",
"default_indexing_quality": "none",
"parent": {
"type": "page",
"page_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"status": "pending",
"last_error": {
"code": "out_of_credits",
"message": "<string>"
},
"row_counts": {
"total": 123,
"completed": 123,
"failed": 123
},
"credits": {
"consumed": 123
},
"sync": {
"connection_id": "config_123abc",
"enabled": true,
"trigger": {
"type": "cron",
"cron_expression": "0 0 * * *",
"timezone": "America/New_York",
"description": "<string>"
}
},
"updated_at": "2023-11-07T05:31:56Z"
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Create knowledge
Create knowledge which will be learned and leveraged by agents. Processing continues asynchronously after the request returns. If the background processing run later fails, subsequent retrievals surface that terminal state through status and last_error.
import requests
url = "https://api.datagrid.com/v1/knowledge"
files = { "files.items": ("example-file", open("example-file", "rb")) }
payload = {
"files": "<string>",
"name": "<string>",
"parent": "{
\"type\": \"page\",
\"page_id\": \"<string>\"
}",
"semantic_indexing_enabled": "true"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('files', '<string>');
form.append('name', '<string>');
form.append('parent', '{
"type": "page",
"page_id": "<string>"
}');
form.append('semantic_indexing_enabled', 'true');
form.append('files.items', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.datagrid.com/v1/knowledge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/knowledge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'files=<string>' \
--form 'name=<string>' \
--form 'parent={
"type": "page",
"page_id": "<string>"
}' \
--form semantic_indexing_enabled=true \
--form files.items='@example-file'{
"object": "knowledge",
"id": "<string>",
"name": "<string>",
"teamspace_id": "<string>",
"scope": "teamspace",
"default_indexing_quality": "none",
"parent": {
"type": "page",
"page_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"status": "pending",
"last_error": {
"code": "out_of_credits",
"message": "<string>"
},
"row_counts": {
"total": 123,
"completed": 123,
"failed": 123
},
"credits": {
"consumed": 123
},
"sync": {
"connection_id": "config_123abc",
"enabled": true,
"trigger": {
"type": "cron",
"cron_expression": "0 0 * * *",
"timezone": "America/New_York",
"description": "<string>"
}
},
"updated_at": "2023-11-07T05:31:56Z"
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Upload size limits
Each file must be within your plan’s per-file size cap. If a file is too large, the API returns 413 (payload_too_large) with guidance and a link to Knowledge upload limits.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The files to be uploaded and learned. Supported media types are pdf, json, csv, text, png, jpeg, excel, google sheets, docx, pptx.
The name of the knowledge.
The parent page reference, indicating where this page is nested
- Option 1
- Option 2
Show child attributes
Show child attributes
Whether semantic indexing is enabled for tables created under this knowledge. Set to false to keep records SQL-queryable without vector indexing.
Response
Successfully created knowledge
The knowledge object represents knowledge that an agent may leverage to respond.
The object type, which is always knowledge.
knowledge The knowledge identifier, which can be referenced in the API endpoints.
The name of the knowledge.
The ID of the teamspace that owns this knowledge.
The visibility scope of the knowledge. 'teamspace' means visible only within the owning teamspace. 'organization' means visible across all teamspaces in the same organization.
teamspace, organization The knowledge-level indexing override. none means semantic indexing is disabled; null means Datagrid uses its normal indexing defaults.
none The parent page reference, indicating where this page is nested
- Option 1
- Option 2
Show child attributes
Show child attributes
The ISO string for when the knowledge was created.
The current knowledge status. pending indicates that processing has started but no rows have reached a terminal state yet (none learned, none failed). partial indicates that processing has not finished for every row — some rows may already be learned or failed while others are still being processed. ready indicates that processing has finished and the knowledge is available for use; some individual rows may have failed to process, so check row_counts.failed. failed indicates that no rows are currently available and the knowledge reached a terminal failure state, either because the latest asynchronous processing or re-index run ended unsuccessfully before any rows became available, or because every row ended in a persistent failed state.
pending, partial, ready, failed The last terminal processing error for this knowledge, if any. Present when the latest asynchronous processing or re-index run ended unsuccessfully; null when the knowledge is failed only because every row ended in a persistent failed state.
Show child attributes
Show child attributes
Row count statistics for the knowledge.
Show child attributes
Show child attributes
Credit consumption for this knowledge. null when the knowledge is still being processed and the final cost is not yet known (e.g. immediately after creation or reindexing), or when the credit lookup fails. When present, consumed is the current summed spend for the knowledge's active tables — it is not necessarily the cost of the most recent request, nor the full lifetime spend.
Show child attributes
Show child attributes
Sync information for knowledge that syncs data from a connection
Show child attributes
Show child attributes
The ISO string for when the knowledge was last updated.