What you’ll learn

• How to upload a file with /content/file
• How to instruct /generate to transform that file into a summary

Endpoints used

POST /content/file · POST /generate

# one_click_pdf_summary.py
#
# 1) Upload a PDF document
# 2) Ask the model to summarise it in five bullets

import os, requests, time

API = "https://sdk.senso.ai/api/v1"
HDR = {"X-API-Key": os.environ["SENSO_KEY"]}

# 1) SOURCE – upload the PDF
with open("sample.pdf", "rb") as fp:
    resp = requests.post(
        f"{API}/content/file",
        headers=HDR,
        files={"file": fp},
        data={"title": "Sample PDF"}
    ).json()

cid = resp["id"]
print("Uploaded content_id →", cid)

# Wait for ingestion to finish
status = resp["processing_status"]
while status != "completed":
    time.sleep(3)
    status = requests.get(f"{API}/content/{cid}", headers=HDR).json()["processing_status"]

# 2) WORKSPACE – generate a summary
summary = requests.post(
    f"{API}/generate",
    headers=HDR,
    json={
        "content_type": "summary",
        "instructions": "Summarize this document in 5 bullet points.",
        "max_results": 5,
        "save": False,
        "category_id": None,
        "topic_id": None
    }
).json()

print("\nBullet-point summary:\n", summary["generated_text"])

Run:

export SENSO_KEY=your_api_key
python one_click_pdf_summary.py