Skip to Content
🎉 PageIndex Dashboard is now live! Access it now →
API ReferenceRetrieval

🔍 PageIndex Retrieval API

Retrieval function requires a completed PageIndex tree generation.

Currently, only single-document retrieval is supported. Multi-document retrieval is coming soon. See also the Doc Search page for document search examples.

Retrieve from a PageIndex Document

  • Endpoint: POST https://api.pageindex.ai/retrieval/
  • Description: Submit a query to create a retrieval task for a specific PageIndex document. Returns a retrieval task ID.

Parameters (in JSON body):

  • doc_id (string, required): The PageIndex document ID to retrieve from.
  • query (string, required): The user question or information need.
  • thinking (boolean, optional): If set to true, the model will first plan what information is required before performing retrieval, helping you gather more comprehensive and relevant information. Default is false.

Example:

import requests api_key = "YOUR_API_KEY" payload = { "doc_id": "abc123def456", "query": "What are the main sources of revenue?", "thinking": False } response = requests.post( "https://api.pageindex.ai/retrieval/", headers={"api_key": api_key}, json=payload )

Example Response:

{ "retrieval_id": "xyz789ghi012" }

Get Retrieval Status & Results

  • Endpoint: GET https://api.pageindex.ai/retrieval/{retrieval_id}/
  • Description: Get the status and, when ready, the result for a specific retrieval query.

Parameters (URL Path):

  • retrieval_id (string, required)

Example:

import requests api_key = "YOUR_API_KEY" retrieval_id = "xyz789ghi012" response = requests.get( f"https://api.pageindex.ai/retrieval/{retrieval_id}/", headers={"api_key": api_key} )

Example Response (Processing):

{ "retrieval_id": "xyz789ghi012", "status": "processing" }

Example Response (Completed):

{ "retrieval_id": "xyz789ghi012", "doc_id": "abc123def456", "status": "completed", "query": "What are the recent trends in the labor market?", "retrieved_nodes": [ { "title": "March 2024 Summary", "node_id": "0005", "relevant_contents": [ { "physical_index": 10, "relevant_content": "The labor market has gained averaging 239,000 per month since June 2023..." } ] } ] }

đź’¬ Support

Last updated on