Skip to content

Retrieval

Retrieve
POST/api/v1/retrieval/retrieve
Find Files
POST/api/v1/retrieval/files/find
Grep File
POST/api/v1/retrieval/files/grep
Read File
POST/api/v1/retrieval/files/read
ModelsExpand Collapse
RetrievalRetrieveResponse = object { results }

Response containing retrieval results.

results: array of object { content, metadata, rerank_score, 2 more }

Ordered list of retrieved chunks.

content: string

Text content of the retrieved chunk.

metadata: optional map[string or number or number or 3 more]

User-defined metadata associated with the chunk.

One of the following:
string
number
number
boolean
unknown
MetadataListValue = array of string
rerank_score: optional number

Relevance score from the reranker, if reranking was applied.

score: optional number

Hybrid search relevance score.

static_fields: optional object { attachments, chunk_end_char, chunk_index, 5 more }

Built-in fields stored for every exported chunk.

attachments: optional array of object { attachment_name, source_id, type }

Attachments associated with the chunk

attachment_name: string

Attachment-relative path, e.g. ‘screenshots/page_7.jpg’.

source_id: string

File ID to pass as source_id when fetching the attachment.

type: string

Attachment kind, e.g. ‘screenshot’, ‘items’.

chunk_end_char: optional number

End character offset of the chunk.

chunk_index: optional number

Index of the chunk within the file.

chunk_start_char: optional number

Start character offset of the chunk.

chunk_token_count: optional number

Token count of the chunk.

page_range_end: optional number

Last page number covered by this chunk.

page_range_start: optional number

First page number covered by this chunk.

parsed_directory_file_id: optional string

ID of the parsed file.

RetrievalFindResponse = object { file_id, file_name }

A file returned by find.

file_id: string

ID of the file.

file_name: string

Display name of the file.

RetrievalGrepResponse = object { content, end_char, start_char }

A single grep match within a file.

content: string

Matched text content.

end_char: number

End character offset of the match.

start_char: number

Start character offset of the match.

RetrievalReadResponse = object { content }

File read result.

content: string

Parsed text content of the file.

Note for AI agents: this documentation is built for programmatic access. - Overview of all docs: https://developers.llamaindex.ai/llms.txt - Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md - Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters. - A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/python/shared/mcp/