Skip to main content
GET
/
search
/
tree
Python
import os
from datagrid_ai import Datagrid

client = Datagrid(
    api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
)
search_tree_result = client.search.search_tree(
    query="query",
)
print(search_tree_result.credits)
{
  "object": "search_tree",
  "query": "<string>",
  "data": [
    {}
  ],
  "nav_items": [
    {}
  ],
  "has_more": true,
  "credits": {
    "consumed": 123
  },
  "next": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

query
string
required

The natural language search query.

record_types
enum<string>[]

Filter results by record type in the vector database. When omitted, all record types are searched.

The record type in the vector database.

Available options:
rows,
tables,
files,
pages,
cells
next
string

A cursor to use in pagination to continue a query from the previous request. This is automatically added when the request has more results to fetch.

limit
integer
default:50

The limit on the number of objects to return, ranging between 1 and 100.

Required range: 1 <= x <= 100

Response

A tree of search results grouped by source, with navigation items and pagination.

Hierarchical search results grouped by source (datasets, files, pages) with navigation items.

object
enum<string>
required

The object type, always search_tree.

Available options:
search_tree
query
string
required

The original search query.

data
object[]
required

Tree nodes representing search results grouped by source. Each node contains the matched content, metadata, score, and child nodes for hierarchical display.

nav_items
object[]
required

Navigation items providing quick links to the datasets, tables, and files that matched the query. Each item includes a name, emoji, URL, and type.

has_more
boolean
required

Whether more results are available beyond this page. Use the next cursor to fetch additional results.

credits
object
required

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.

next
string | null

Pagination cursor (numeric offset as string). Pass this value as the next query parameter to /search/tree to fetch the next page.