🌲 PageIndex Tree Generation API
Currently accepts PDF files only (more formats coming soon).
Submit Document for Tree Generation
- Endpoint:
POST
https://api.pageindex.ai/tree/
- Description: Upload a PDF document to generate a PageIndex hierarchical tree. Immediately returns a document identifier (
doc_id
) for subsequent operations.
Request Body (multipart/form-data):
file
(binary, required): PDF document.
Optional Fields:
Field Name | Description | Allowed Values | Default |
---|---|---|---|
if_add_node_text | Include the full text for each node | "yes" / "no" | "no" |
if_add_node_summary | Include a summary for each node | "yes" / "no" | "no" |
Example
import requests
api_key = "YOUR_API_KEY"
file_path = "./2023-annual-report.pdf"
with open(file_path, "rb") as file:
response = requests.post(
"https://api.pageindex.ai/tree/",
headers={"api_key": api_key},
files={"file": file}
)
Example with Optional Parameters
import requests
api_key = "YOUR_API_KEY"
file_path = "./2023-annual-report.pdf"
with open(file_path, "rb") as file:
response = requests.post(
"https://api.pageindex.ai/tree/",
headers={"api_key": api_key},
files={"file": file},
data={
"if_add_node_summary": "no"
}
)
Example Response:
{ "doc_id": "abc123def456" }
Get Processing Status & Tree Structure
- Endpoint:
GET
https://api.pageindex.ai/tree/{doc_id}/
- Description: Check processing status and (when complete) get the PageIndex tree for a submitted document.
Parameters (URL Path):
doc_id
(string, required): Document ID.
Example:
import requests
api_key = "YOUR_API_KEY"
doc_id = "abc123def456"
response = requests.get(
f"https://api.pageindex.ai/tree/{doc_id}/",
headers={"api_key": api_key}
)
Example Response (Processing):
{
"doc_id": "abc123def456",
"status": "processing"
}
Example Response (Completed):
{
"doc_id": "abc123def456",
"status": "completed",
"result": [
...
{
"title": "Financial Stability",
"node_id": "0006",
"start_index": 21,
"end_index": 22,
"summary": "The Federal Reserve maintains financial stability by...",
"nodes": [
{
"title": "Monitoring Financial Vulnerabilities",
"node_id": "0007",
"start_index": 22,
"end_index": 28,
"summary": "The Federal Reserve's monitoring focuses on..."
},
{
"title": "Domestic and International Cooperation and Coordination",
"node_id": "0008",
"start_index": 28,
"end_index": 31,
"summary": "In 2023, the Federal Reserve collaborated internationally..."
}
]
}
...
]
}
Delete a PageIndex Document
- Endpoint:
DELETE
https://api.pageindex.ai/tree/{doc_id}/
- Description: Permanently delete a PageIndex document and all its associated data.
Parameters (URL Path):
doc_id
(string, required): Document ID.
Example:
import requests
api_key = "YOUR_API_KEY"
doc_id = "abc123def456"
response = requests.delete(
f"https://api.pageindex.ai/tree/{doc_id}/",
headers={"api_key": api_key}
)
đź’¬ Support
- 🤝 Join our Discord 
- 📨 Contact Us 
Last updated on