import requests
url = "https://api.datagrid.com/v1/search/ai"
payload = {
"query": "<string>",
"record_types": [],
"limit": 10,
"offset": 0,
"skip_ai_generation": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
record_types: [],
limit: 10,
offset: 0,
skip_ai_generation: false
})
};
fetch('https://api.datagrid.com/v1/search/ai', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/search/ai \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"record_types": [],
"limit": 10,
"offset": 0,
"skip_ai_generation": false
}
'{
"object": "search_ai_result",
"answer": "<string>",
"sources": [
{
"index": 123,
"node_id": "<string>",
"type": "file",
"title": "<string>",
"dataset_name": "<string>",
"table_name": "<string>",
"emoji": "<string>",
"url": "<string>",
"thumbnail_uri": "<string>",
"page_numbers": [
123
]
}
],
"search_results": {
"object": "search_tree",
"query": "<string>",
"data": [
{}
],
"nav_items": [
{}
],
"has_more": true,
"credits": {
"consumed": 123
},
"next": "<string>",
"total_count": 123,
"counts_by_display_type": {
"datasets": 123,
"documents": 123,
"images": 123,
"channels": 123
},
"display_items": [
{
"object": "search_display_item",
"id": "<string>",
"kind": "record",
"display_type": "dataset",
"table_id": "<string>",
"title": "<string>",
"body": "<string>",
"score": 123,
"created_at": "<string>",
"updated_at": "<string>",
"url": "<string>",
"dataset_name": "<string>",
"table_name": "<string>",
"table_fingerprint": "<string>",
"navigation_item_id": "<string>",
"emoji": "<string>",
"file_uri": "<string>",
"media_type": "<string>",
"data_lake_item_id": "<string>",
"page_number": 123,
"page_url": "<string>",
"total_pages": 123,
"parent_record": {
"id": "<string>",
"title": "<string>",
"body": "<string>"
},
"channel_data": {
"channel_type": "<string>",
"is_private": true,
"is_joined": true,
"participant_count": 123,
"people_count": 123,
"agent_count": 123
}
}
]
},
"credits": {
"consumed": 123
}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}AI Search
AI-powered search that retrieves relevant knowledge from your teamspace, builds a merged context, and generates a natural language answer with numbered source citations. The response includes the generated answer, the sources cited (with links and metadata), and the full search tree results for reference. Use this when you want an AI-generated summary answer grounded in your team’s data.
import requests
url = "https://api.datagrid.com/v1/search/ai"
payload = {
"query": "<string>",
"record_types": [],
"limit": 10,
"offset": 0,
"skip_ai_generation": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
record_types: [],
limit: 10,
offset: 0,
skip_ai_generation: false
})
};
fetch('https://api.datagrid.com/v1/search/ai', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/search/ai \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"record_types": [],
"limit": 10,
"offset": 0,
"skip_ai_generation": false
}
'{
"object": "search_ai_result",
"answer": "<string>",
"sources": [
{
"index": 123,
"node_id": "<string>",
"type": "file",
"title": "<string>",
"dataset_name": "<string>",
"table_name": "<string>",
"emoji": "<string>",
"url": "<string>",
"thumbnail_uri": "<string>",
"page_numbers": [
123
]
}
],
"search_results": {
"object": "search_tree",
"query": "<string>",
"data": [
{}
],
"nav_items": [
{}
],
"has_more": true,
"credits": {
"consumed": 123
},
"next": "<string>",
"total_count": 123,
"counts_by_display_type": {
"datasets": 123,
"documents": 123,
"images": 123,
"channels": 123
},
"display_items": [
{
"object": "search_display_item",
"id": "<string>",
"kind": "record",
"display_type": "dataset",
"table_id": "<string>",
"title": "<string>",
"body": "<string>",
"score": 123,
"created_at": "<string>",
"updated_at": "<string>",
"url": "<string>",
"dataset_name": "<string>",
"table_name": "<string>",
"table_fingerprint": "<string>",
"navigation_item_id": "<string>",
"emoji": "<string>",
"file_uri": "<string>",
"media_type": "<string>",
"data_lake_item_id": "<string>",
"page_number": 123,
"page_url": "<string>",
"total_pages": 123,
"parent_record": {
"id": "<string>",
"title": "<string>",
"body": "<string>"
},
"channel_data": {
"channel_type": "<string>",
"is_private": true,
"is_joined": true,
"participant_count": 123,
"people_count": 123,
"agent_count": 123
}
}
]
},
"credits": {
"consumed": 123
}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request body for AI-powered search.
The natural language search query. The AI will search your indexed knowledge and generate an answer.
Optional filter to restrict search to specific record types (rows, tables, files, pages, cells).
The record type in the vector database.
rows, tables, files, pages, cells Optional filter to restrict results to one display type (dataset, document, image, or channel). Applied before pagination, so pages cover the full filtered result pool. Honored when paginated search is enabled for the teamspace (Gen Search phase 3).
dataset, document, image, channel Maximum number of search results to consider when generating the answer.
Number of results to skip before the returned page, for paginating search results. Combine with skip_ai_generation: true to fetch subsequent pages without regenerating the AI answer. Honored when paginated search is enabled for the teamspace (Gen Search phase 3).
When true, returns the requested page of search results without generating an AI answer (answer is null and sources is empty). Cannot be combined with streaming. Honored when paginated search is enabled for the teamspace (Gen Search phase 3).
Response
An AI-generated answer with source citations and the underlying search tree results.
AI-generated answer with source citations and the underlying search results.
The object type, always search_ai_result.
search_ai_result AI-generated natural language answer based on the search results. Contains numbered citations like [1], [2] that reference entries in the sources array. Null when the request set skip_ai_generation: true.
Sources cited in the answer, ordered by citation index. Each source links back to the original data in your teamspace.
Show child attributes
Show child attributes
The full search tree results used to generate the answer. Useful for displaying raw results alongside the AI summary.
Show child attributes
Show child attributes
Credit consumption for this search. When present, consumed reflects the actual variable cost of the retrieval work performed for this request. null when the billing write fails or the request is aborted before billing completes.
Show child attributes
Show child attributes