Skip to content

Search from the terminal

Three calls with curl. You need a token with search and read.

Terminal window
export INSEAM_TOKEN="ias_…"
export INSEAM="https://app.inseam.io"
Terminal window
curl -s "$INSEAM/v1/search" \
-H "Authorization: Bearer $INSEAM_TOKEN" \
-H "Content-Type: application/json" \
-d '{"q": "quarterly report", "topK": 5}' | jq '.hits[] | {address, title, score}'
{ "address": "inseam://n7q2…/h1a2b3c4d5e6/Reports/Q3.md", "title": "Q3 report", "score": 0.0312 }
{ "address": "inseam://n7q2…/pad/notes/board-prep.md", "title": "Board prep", "score": 0.0188 }

See which hosts were searched, and which were not and why:

Terminal window
curl -s "$INSEAM/v1/search" -H "Authorization: Bearer $INSEAM_TOKEN" -H "Content-Type: application/json" \
-d '{"q": "quarterly report"}' | jq '.hosts[] | {id, name, searched, reason}'
Terminal window
curl -s "$INSEAM/v1/get?address=h1a2b3c4d5e6/Reports/Q3.md" -H "Authorization: Bearer $INSEAM_TOKEN" | jq .record

The short form {host}/{path} saves URL-encoding the full address. Add &text=1 to include the indexed text.

Terminal window
curl -s "$INSEAM/v1/o/h1a2b3c4d5e6/Reports/Q3.md" -H "Authorization: Bearer $INSEAM_TOKEN" -o Q3.md

If the Mac that holds the file is asleep, the answer is 503 with {"error": {"code": "steward-offline"}}. The record is still there; the bytes come back when the Mac wakes. A Range header fetches part of a large file:

Terminal window
curl -s "$INSEAM/v1/o/h1a2b3c4d5e6/Reports/Q3.md" -H "Authorization: Bearer $INSEAM_TOKEN" -H "Range: bytes=0-1023"
Terminal window
curl -s "$INSEAM/v1/list?prefix=h1a2b3c4d5e6/Reports/&limit=50" -H "Authorization: Bearer $INSEAM_TOKEN" \
| jq -r '.entries[].address'
Terminal window
curl -s "$INSEAM/v1/status" -H "Authorization: Bearer $INSEAM_TOKEN" | jq '{state, items, hosts: [.hosts[] | {id, state, queued}]}'