Welcome to the Polyvia API documentation. Our API enables you to upload documents, track ingestion status, and ask natural-language questions across your workspace.
Authentication
All API requests require authentication using an API key. Include your key in the Authorization header:
Authorization: Bearer poly_<your-key>
Keep your API key secure. Never expose it in client-side code or public repositories.
Getting Your API Key
- Sign in to Polyvia
- Go to Settings → API
- Click Create API Key, give it a name, and optionally set an expiry date
- Copy the key — it is shown only once
All keys start with poly_. To revoke a key, return to Settings → API and click the delete icon next to it.
Base URL
All endpoints are prefixed with /api/v1.
Quick Start
Here’s a complete example: ingest a document and query for insights.
import httpx
import time
API_KEY = "poly_<your-key>"
BASE = "https://app.polyvia.ai"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}
# 1. Upload
with open("report.pdf", "rb") as f:
resp = httpx.post(
f"{BASE}/api/v1/ingest",
headers=HEADERS,
files={"file": ("report.pdf", f, "application/pdf")},
data={"name": "Q4 Report"},
)
resp.raise_for_status()
task_id = resp.json()["task_id"]
document_id = resp.json()["document_id"]
# 2. Poll until ingestion completes
while True:
status = httpx.get(f"{BASE}/api/v1/ingest/{task_id}", headers=HEADERS).json()["status"]
print(f"Status: {status}")
if status in ("completed", "failed"):
break
time.sleep(5)
# 3. Query
answer = httpx.post(
f"{BASE}/api/v1/query",
headers=HEADERS,
json={"query": "What are the key findings?", "document_id": document_id},
).json()["answer"]
print(answer)
Support
Need help? Reach out to our team: