Skip to Content
DocsAPICorpus Endpoints

Corpus Endpoints

All endpoints operate on the working directory’s input/, output/, logs/, and archives/.

Uploads & Files

  • POST /api/corpus/upload — multipart form with files (PDFs). Writes to input/ and updates output/uploads.json.
  • GET /api/corpus/file?name=<file> — Inline-serve a file from input/ (or input/_pdfs for archived PDFs). Supports .pdf and .txt.
  • POST /api/corpus/remove — Body { name }. Removes a file from input/ and marks it removed in the registry.

Indexing

  • GET /api/corpus/index/stream — Starts indexing and streams progress via SSE. Also converts PDFs→TXT if needed and writes log history.
  • POST /api/corpus/index/stop — No-op placeholder (single-process stream lifecycle).

State

  • GET /api/corpus/state — Returns uploads registry and output stats if present. Also persists a merged uploads.json.
  • POST /api/corpus/kg/rename — Body { name }. Sets output/kg.json friendly name.

Archives

  • POST /api/corpus/archive/create — Archives working set into archives/kg-<timestamp>/ and resets a clean workspace.
  • GET /api/corpus/archive/list — Lists archives with computed size and name (from kg.json).
  • POST /api/corpus/archive/restore — Body { name }. Swaps current working set with the target archive contents.
  • POST /api/corpus/archive/rename — Body { from, to }. Changes archive folder name.
  • POST /api/corpus/archive/delete — Body { name }. Removes archive folder.

Nuke

  • POST /api/corpus/nuke — Body { "confirm": "NUKE INDEX" }. Moves working dirs to a timestamped folder and resets input/ and output/.
Last updated on