name: logseq-local-http description: "Interact with a local Logseq graph through the HTTP API at http://127.0.0.1:12315 by sending authenticated POST /api requests with plugin SDK method names and args. Use when tasks need to search notes, retrieve related/backlinked pages, find journal notes by day or topic, or traverse page/block links in a local Logseq graph. Prefer graph-aware reading: read current page, then linked references from recent to old, then latest journals before concluding."
Logseq Local HTTP
Overview
Use this skill to query and analyze a local Logseq graph through the Logseq HTTP API server.
Quick Start
- Always run:
python3 scripts/logseq_http.py --help
before any other command to confirm command availability.
2. Confirm Logseq HTTP server is running at http://127.0.0.1:12315/.
3. Get the API token from Logseq settings and export it:
export LOGSEQ_TOKEN="your-token"
export LOGSEQ_BASE_URL="http://127.0.0.1:12315" # optional
- Run a quick connectivity check:
python3 scripts/logseq_http.py call --method logseq.Editor.getCurrentPage
- If you get
401 Unauthorized, generate a new token in Logseq: Open Logseq → Settings → API Access (or Local HTTP API), create/copy a fresh token, then set it:
export LOGSEQ_TOKEN="your-new-token"
Then rerun the helper commands.
API Contract
Use POST /api with these headers:
Content-Type: application/jsonAuthorization: Bearer <token>
Body format:
{
"method": "logseq.Editor.getPage",
"args": ["My Page"]
}
Default Reading Strategy
Do not conclude from a single page unless the user explicitly asks for narrow scope.
Use this sequence:
- Read current page (or requested page) blocks.
- Read linked references and prioritize recent-to-old.
- Read recent journal pages to capture latest context shifts.
- Synthesize across all three sources and then answer.
Core Tasks
Build graph-aware context first
Use this before deeper analysis:
python3 scripts/logseq_http.py context --output compact --linked-limit 40 --journal-limit 7 --journal-days 30
Use explicit page instead of current page:
python3 scripts/logseq_http.py context --page "Project Alpha" --output compact
Search notes
Use the helper for title + block-content search:
python3 scripts/logseq_http.py search --query "project alpha" --output compact --limit 20
How it works:
- Call
logseq.Editor.getAllPages. - Match query against page names/titles.
- Call
logseq.Editor.getPageBlocksTreeper page and match block content.
Control response size:
--limit 20(alias--max-results) caps returned matched pages.--offset 20paginates to the next page of matches.--max-block-hits-per-page 3caps hit blocks per page.--output compact|names|fullcontrols payload detail (nameskeeps page + IDs + counts).--format outlineprints compact, human-readable output.--format jsonlprints one JSON object per line.--compact-jsonprints one-line JSON for piping.
Retrieve related pages
Use backlinks + outgoing links:
python3 scripts/logseq_http.py related --page "Project Alpha"
How it works:
- Call
logseq.Editor.getPageLinkedReferencesfor backlinks. - Call
logseq.Editor.getPageBlocksTreeand extract[[Page]]links for outgoing links. - Optionally call
logseq.Editor.getPagesFromNamespacefor namespace neighbors.
Find notes from a particular day
Use a date in YYYY-MM-DD:
python3 scripts/logseq_http.py journal --date "2026-03-02"
How it works:
- Convert date to journal day integer
YYYYMMDD. - Call
logseq.Editor.getAllPages. - Filter pages where journal flag is true and
journalDaymatches. - Load page blocks with
logseq.Editor.getPageBlocksTree.
Find notes by topic
Use a topic/page/tag name:
python3 scripts/logseq_http.py topic --name "machine-learning"
How it works:
- Treat topic as a page/tag and call
logseq.Editor.getPageLinkedReferences. - Call
logseq.Editor.getTagObjectsand match tag names.
Traverse the note graph
Run bounded BFS from a seed page:
python3 scripts/logseq_http.py traverse --start-page "Project Alpha" --depth 2 --max-nodes 120
How it works:
- Neighbors come from outgoing
[[Page]]links and backlink sources. - BFS expands by depth with a visited set and node cap.
- Returns JSON with
nodesandedges.
Method Reference
Read references/logseq-http-recipes.md for method lists and request templates.
Script Reference
Use scripts/logseq_http.py for all API calls and reusable workflows instead of rewriting request code each time.