What you’ll learn

• How to POST raw text to /content/raw
• How to call /search and read the AI answer + cited sources

Endpoints used

POST /content/raw · POST /search

# hello_world_search.py
#
# 1) Upload “Hello World!” as raw content
# 2) Ask the workspace what the file says

import os, requests, time

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

# 1) SOURCE – upload raw text
hello_txt = "Hello World!  Senso makes context easy."
content = requests.post(
    f"{API}/content/raw",
    headers=HDR,
    json={"title": "hello.txt", "text": hello_txt}
).json()
cid = content["id"]
print("Uploaded content_id →", cid)

# (wait until processing is done – usually a few seconds)
while content["processing_status"] != "completed":
    time.sleep(2)
    content = requests.get(f"{API}/content/{cid}", headers=HDR).json()

# 2) WORKSPACE – ask a question
answer = requests.post(
    f"{API}/search",
    headers=HDR,
    json={"query": "What did the file say?"}
).json()

print("\nAI answer →", answer["answer"])
print("\nFirst cited source →", answer["results"][0]["chunk_text"])

Run:

export SENSO_KEY=your_api_key
python hello_world_search.py