Skip to content

API reference ​

Every endpoint of the Scholar Lens API, grouped by router. This page is generated from the OpenAPI schema by python -m scripts.api_docs in backend; don't edit it by hand. A running API serves the full schema, with every field, at /openapi.json and an interactive version at /docs.

All endpoints are under /api. They take and return JSON unless a body says multipart. The browser authenticates with cookies (see Security and access); the browser extension with a bearer token, limited to the capture endpoints. Errors return {"detail": {"code": "...", "message": "..."}}.

admin ​

MethodPathWhat it doesBodyReturns
POST/api/admin/restartRestart the API (and the worker) so saved settings take effect; back in a few seconds.RestartOut
GET/api/admin/settingsRead SettingsSettingsOut
PATCH/api/admin/settingsSave SettingsSettingsPatchSettingsOut
POST/api/admin/settings/testCheck a service with the values on the page (blank secrets: the saved ones).TestRequestTestOut
GET/api/admin/voicesRead VoicesVoicesOut
PUT/api/admin/voicesSave VoicesVoicesInVoicesOut
POST/api/admin/voices/local/testVoice two short lines on the local service with these voices; returns a WAV.LocalIn
POST/api/admin/voices/local/voicesAsk the local service which engine it runs and which voices it has (Kokoro, Chatterbox …).LocalInLocalVoicesOut
POST/api/admin/voices/testVoice two short lines with these values (the saved key when none is given); returns a WAV.ProviderIn
POST/api/admin/voices/{provider_id}/wakeTry a resting provider again from the next recording.VoicesOut

agent ​

MethodPathWhat it doesBodyReturns
GET/api/agent/graphNodes and edges of the compiled graph; conditional edges are the routing decisions.

auth ​

MethodPathWhat it doesBodyReturns
POST/api/auth/loginLoginCredentialsUserOut
POST/api/auth/logoutLogout204, no body
POST/api/auth/logout-allLogout All204, no body
POST/api/auth/refreshRefreshUserOut
POST/api/auth/setupCreate the first admin account. Only allowed while the database has no users.Credentials201, UserOut
POST/api/auth/signupSelf sign-up (when an admin has turned it on): the account waits for an admin's approval.Credentials202, SignupAccepted
GET/api/auth/statusStatusAuthStatus
GET/api/meMeUserOut
GET/api/me/accountThe Account page: who you are, where you're signed in, how much you store.AccountOut
POST/api/me/passwordChange PasswordPasswordChange204, no body
DELETE/api/me/sessions/{session_id}Sign out one device (its refresh token stops working; its access token runs out within minutes).204, no body

capture ​

MethodPathWhat it doesBodyReturns
POST/api/captureSave the page the student is looking at: its rendered HTML (html), or the file the tab shows (file, e.g. a PDF). It becomes a private Library item, indexed as usual and added to the chosen Space, with the citation metadata the page carries or metadata sent with a file (a reference's title, authors, DOI…). Saving the same address (or the same file) again returns the earlier item; a file for an item saved as a reference only fills it in.multipart201, CaptureOut
GET/api/capture/checkWhether the page is already in the student's Library (the popup says so before saving).CaptureCheck
POST/api/capture/explainA line or two on each of the top references (at most 10): what it covers and what it can explain for this article, written by the local model from the title and abstract.ExplainRequestExplainOut
POST/api/capture/highlightA highlight from the browser, saved as a note on the student's item for this page: searchable, and citable as "Your note". 404 not_saved when the page isn't in the Library yet (the extension then saves it first).HighlightCreate201, NoteOut
POST/api/capture/linkA web page the captured page links to (a blog, a guide), ticked by the student: Scholar Lens fetches it like a URL pasted in the Library (public addresses only). The student's earlier item for the same address is reused.VideoCapture201, CaptureOut
POST/api/capture/referencesBring the ticked references into the Library and the Space: open-access ones are fetched by Scholar Lens (arXiv, OpenAlex copies) and indexed; the rest are saved as references only. One already in the Library is just added to the Space.ImportReferences201, list of CaptureOut
POST/api/capture/resolveTitles, abstracts and availability for the references a page lists, most related to the article and Space first, so the student can tick the few they need. Nothing is saved.ResolveRequestlist of ResolvedReference
POST/api/capture/videoA YouTube video found on a page, into the Library (its captions, with timestamps) and the Space. The student's earlier import of the same video is reused.VideoCapture201, CaptureOut
GET/api/me/tokensList Tokenslist of ApiTokenOut
POST/api/me/tokensA token for the browser extension. The secret is in this response only; it is stored hashed.ApiTokenCreate201, ApiTokenCreated
DELETE/api/me/tokens/{token_id}The extension using this token stops working at its next call.204, no body

code ​

MethodPathWhat it doesBodyReturns
DELETE/api/cells/{cell_id}Delete Cell204, no body
GET/api/cells/{cell_id}/files/{index}Cell File
POST/api/cells/{cell_id}/runRun a cell again, edited or not; its outputs are replaced.CellRerunCellOut
GET/api/threads/{thread_id}/cellsList Cellslist of CellOut
POST/api/threads/{thread_id}/cellsRun new code in the chat's kernel (variables from earlier cells are there).CellIn201, CellOut
GET/api/threads/{thread_id}/cells/exportExport Cells
POST/api/threads/{thread_id}/kernel/restartForget the chat's variables: the next cell starts a fresh kernel.

invites ​

MethodPathWhat it doesBodyReturns
GET/api/invites/{token}What a link is for, so the page can say "join <Space> as a viewer" or "create your account".InviteInfo
POST/api/invites/{token}/acceptAccept Space InviteSpaceOut
GET/api/spaces/{space_id}/invitesList Space Inviteslist of InviteOut
POST/api/spaces/{space_id}/invitesCreate Space InviteInviteCreate201, InviteOut
DELETE/api/spaces/{space_id}/invites/{invite_id}Revoke Space Invite204, no body

library ​

MethodPathWhat it doesBodyReturns
GET/api/duplicatesThe warnings waiting for the student's decision, newest first.list of DuplicatePairOut
POST/api/duplicates/checkThe first pass, before saving: items that look the same from their header details.DuplicateCheckDuplicateCheckOut
POST/api/duplicates/{pair_id}replace: the new item takes the existing one's place (Spaces, notes, study sets) and the existing one is deleted. keep: both stay and this pair is not raised again. ignore: the new item is deleted.DuplicateDecisionDuplicateDecided
GET/api/figures/{figure_id}/imageA figure as PNG, for whoever may read its document (answers show it inline).
GET/api/libraryview=mine: the user's own items (published ones too); view=shared: the shared Library; view=all: both (what the user can add to a Space).list of DocumentOut
GET/api/library/chunks/{chunk_id}Get ChunkChunkOut
POST/api/library/importQueue an import of a web page, YouTube video, arXiv paper or DOI. Fetching happens in the worker.ImportRequest202, DocumentOut
GET/api/library/publish-requestsAdmins see everyone's requests (pending first); a user sees their own.list of PublishRequestOut
DELETE/api/library/publish-requests/{request_id}The requester withdraws a request that is still waiting.204, no body
POST/api/library/publish-requests/{request_id}/approveApprove Publish RequestPublishDecisionPublishRequestOut
POST/api/library/publish-requests/{request_id}/rejectReject Publish RequestPublishDecisionPublishRequestOut
POST/api/library/searchSearchSearchRequestSearchResponse
POST/api/library/uploadUpload Documentmultipart202, DocumentOut
DELETE/api/library/{document_id}Delete Document204, no body
GET/api/library/{document_id}Get DocumentDocumentOut
PATCH/api/library/{document_id}Patch DocumentDocumentPatchDocumentOut
GET/api/library/{document_id}/figuresThe figures, tables and large images found in a PDF item, in page order.list of FigureOut
GET/api/library/{document_id}/fileDownload File
GET/api/library/{document_id}/page-numberingHow book pages map to PDF pages: "book page 45 is PDF page 61"; none when they are the same.PageNumbering
PUT/api/library/{document_id}/page-numberingCorrect the book page numbers: the student reads one page's printed number ("PDF page 61 shows 45").PageNumberingInPageNumbering
POST/api/library/{document_id}/previewThe indexed text of a scope, by section (the preview of an item that is not a PDF).ScopeRequestlist of TextPart
POST/api/library/{document_id}/publishAn admin puts an item in the shared Library: their own, or one a user asked about.DocumentOut
POST/api/library/{document_id}/publish-requestAsk an admin to put one of your items in the shared Library.PublishRequestCreate201, PublishRequestOut
POST/api/library/{document_id}/reindexReindex Document202, DocumentOut
POST/api/library/{document_id}/resolve-scopeShow what a scope like "9.1-9.6" or "pp. 239-262" (book pages), or picked sections, resolves to.ScopeRequestScopeOut
GET/api/library/{document_id}/textThe item's indexed text in reading order, by section: what answers search and cite. Neighbouring chunks repeat a little of each other (the splitter's overlap); that is removed here.DocumentText
GET/api/library/{document_id}/tocGet Toclist of TocEntry
POST/api/library/{document_id}/unpublishTake an item out of the shared Library. It goes back to being its owner's alone; other people's Spaces that used it lose it.DocumentOut
GET/api/statsStats

memory ​

MethodPathWhat it doesBodyReturns
GET/api/memoryThe student's own memory and, with space_id, that Space's. Rejected proposals are left out.MemoryList
POST/api/memoryAdd MemoryMemoryCreate201, MemoryOut
DELETE/api/memory/{item_id}Delete Memory204, no body
PATCH/api/memory/{item_id}Edit the text, or accept (active) / reject (rejected) a proposal.MemoryPatchMemoryOut

notes ​

MethodPathWhat it doesBodyReturns
GET/api/notesThe student's notes, on one item or all of them, filtered by words in the note or the highlight.list of NoteOut
POST/api/notesCreate NoteNoteCreate201, NoteOut
DELETE/api/notes/{note_id}Delete Note204, no body
PATCH/api/notes/{note_id}Edit NoteNotePatchNoteOut

notifications ​

MethodPathWhat it doesBodyReturns
GET/api/notificationsList Notificationslist of NotificationOut
POST/api/notifications/read-allMark All Read204, no body
GET/api/notifications/unreadUnreadUnread
POST/api/notifications/{notification_id}/readMark Read204, no body

podcasts ​

MethodPathWhat it doesBodyReturns
GET/api/podcastsList Podcastslist of PodcastOut
POST/api/podcastsStart an episode: gather the material and outline it. It waits as a draft for review.PodcastCreate202, PodcastOut
POST/api/podcasts/extractRead an uploaded file (PDF, DOCX, PPTX, EPUB, Markdown, HTML, TXT) into plain text for a "text" source.multipartExtractOut
POST/api/podcasts/scriptRecord a hand-written two-host script: each segment's turns are voiced and joined into one MP3.ScriptCreate202, PodcastOut
POST/api/podcasts/uploadsKeep a file for episodes (not added to the Library). It is read with POST …/read; a file that looks like a whole book says so first (large), so the student can upload one chapter instead.multipartUploadOut
GET/api/podcasts/uploads/{upload_id}/fileUpload Download
GET/api/podcasts/uploads/{upload_id}/page-numberingUpload NumberingPageNumbering
POST/api/podcasts/uploads/{upload_id}/previewThe text of the picked pages or sections (the preview of a file without pages).UploadScopeInlist of TextPart
POST/api/podcasts/uploads/{upload_id}/readRead UploadUploadOut
POST/api/podcasts/uploads/{upload_id}/resolve-scopeUpload ResolveUploadScopeInScopeOut
GET/api/podcasts/uploads/{upload_id}/tocUpload Toclist of TocEntry
GET/api/podcasts/voicesThe voice engine and the voices it offers (empty with a reason when the service is not set up).
DELETE/api/podcasts/{podcast_id}Delete Podcast204, no body
GET/api/podcasts/{podcast_id}Get PodcastPodcastDetail
POST/api/podcasts/{podcast_id}/analyseMake the concept map and the script-quality report again (e.g. for an episode written before M14f).202, PodcastOut
GET/api/podcasts/{podcast_id}/audioThe episode's MP3 (range requests work, so the player can seek).
POST/api/podcasts/{podcast_id}/generateWrite and check the script of the reviewed outline, then record it. A failed episode whose outline was approved resumes at its first unwritten segment.202, PodcastOut
PATCH/api/podcasts/{podcast_id}/outlineSave the reviewed outline: segments kept, reordered or edited, and new instructions.OutlinePatchPodcastDetail
POST/api/podcasts/{podcast_id}/outline/regenerateOutline again, with an extra instruction for the outline (e.g. "less on history, more on matching").RegenerateIn202, PodcastOut
POST/api/podcasts/{podcast_id}/recordRecord a written episode again or for the first time (after the voice service was set up).202, PodcastOut
GET/api/podcasts/{podcast_id}/transcript.mdThe script to read or keep: segments with their core idea and key points, then the lines with page references.
GET/api/podcasts/{podcast_id}/transcript.vttCaptions for the player and offline listening: one cue per line, with the speaker's name.
GET/api/podcasts/{podcast_id}/videoDownload Video
POST/api/podcasts/{podcast_id}/videoMake the episode's video (map, source, captions; 1920x1080) in the background; a notice follows.202, PodcastDetail

quality ​

MethodPathWhat it doesBodyReturns
GET/api/eval/reportsNewest first; answer-eval reports only (retrieval-only runs print to the console).list
GET/api/eval/reports/{name}One report with every question's score and judge verdict (the evidence text is left out to keep it small).

sign-in ​

MethodPathWhat it doesBodyReturns
POST/api/runs/{run_id}/sign-inOpen the gated source of a paused run in the sign-in browser.SigninStart
DELETE/api/sign-in/{session_id}Cancel Sign In204, no body
POST/api/sign-in/{session_id}/doneSave the sign-in (the site's cookies, sealed) and let the paused run continue with it.SigninDone
DELETE/api/sign-ins/{grant_id}Revoke Grant204, no body
GET/api/spaces/{space_id}/sign-insYour saved sign-ins in a Space (other members' stay private).list of GrantOut

spaces ​

MethodPathWhat it doesBodyReturns
GET/api/spacesList Spaceslist of SpaceOut
POST/api/spacesCreate SpaceSpaceCreate201, SpaceOut
DELETE/api/spaces/{space_id}Deletes the space and its chats (everyone's). Library items stay in their owners' libraries.204, no body
GET/api/spaces/{space_id}Get SpaceSpaceOut
PATCH/api/spaces/{space_id}Patch SpaceSpacePatchSpaceOut
GET/api/spaces/{space_id}/membersList Memberslist of MemberOut
DELETE/api/spaces/{space_id}/members/{user_id}The owner removes someone, or a member leaves.204, no body
PATCH/api/spaces/{space_id}/members/{user_id}Change MemberMemberPatchMemberOut
GET/api/spaces/{space_id}/sourcesList Sourceslist of SourceOut
POST/api/spaces/{space_id}/sourcesAssign a library item to the space, optionally narrowed with a scope such as "9.1-9.6". Editors add their own items or shared-Library ones; everyone in the Space can then read them.SourceAssign201, SourceOut
DELETE/api/spaces/{space_id}/sources/{document_id}Remove Source204, no body
PATCH/api/spaces/{space_id}/sources/{document_id}Patch SourceSourcePatchSourceOut

study ​

MethodPathWhat it doesBodyReturns
DELETE/api/study/attempts/{attempt_id}Delete Attempt204, no body
GET/api/study/attempts/{attempt_id}Get AttemptAttemptOut
POST/api/study/attempts/{attempt_id}/retryMark the short answers again after the model failed.202, AttemptOut
GET/api/study/guideThe student's ready study sets in a Space (all, or those listed in sets) as one study guide: Markdown, Word or PDF, cited in APA, Harvard or BibTeX.
DELETE/api/study/items/{item_id}Delete an item; a concept takes its links with it.204, no body
PATCH/api/study/items/{item_id}Edit an item's wording. Its citation stays; an item the student rewrote is theirs to vouch for.StudyItemPatchStudyItemOut
POST/api/study/items/{item_id}/reviewRecord how well the student recalled a card and schedule its next review (SM-2).ReviewRequestStudyItemOut
GET/api/study/reviewCards to review now in a Space (or one set): those due, oldest first, then up to 20 new ones.ReviewQueue
GET/api/study/setsList Setslist of StudySetOut
POST/api/study/setsQueue a set for the whole Space, or for one of its sources narrowed by a scope such as "9.6".StudySetCreate202, StudySetOut
DELETE/api/study/sets/{set_id}Delete Set204, no body
GET/api/study/sets/{set_id}Get SetStudySetDetail
GET/api/study/sets/{set_id}/attemptsList Attemptslist of AttemptOut
POST/api/study/sets/{set_id}/attemptsHand in a quiz. Multiple choice is marked at once; short answers are marked by the model (a job).AttemptCreate202, AttemptOut
GET/api/study/sets/{set_id}/exportThe set's cards (or glossary terms) as CSV or as an Anki package.
POST/api/study/sets/{set_id}/retryGenerate a failed set again (its scope may have been indexed since).202, StudySetOut

system ​

MethodPathWhat it doesBodyReturns
GET/api/healthDatabase status decides the HTTP code; model status comes from the last probe.HealthOut
GET/api/system/probeSystem Probe
GET/api/system/statusWhat the server is configured to use, without secrets, plus whether the reranker answers (Settings page).

threads ​

MethodPathWhat it doesBodyReturns
GET/api/runs/{run_id}Get Run
POST/api/runs/{run_id}/cancelCancel Run
POST/api/runs/{run_id}/continueContinue a run that failed or timed out from its last finished step (its checkpoint in this app's database), with a fresh time budget: on a slow machine a Comprehensive answer often stops in verification, after the search and the draft are done. Refused when anything came after it in the chat (another question, a regenerated answer), so two answers never compete.RunAccepted
GET/api/runs/{run_id}/eventsStream Events
GET/api/runs/{run_id}/logEvery stored event of a run in order, as JSON: the Agent Flow replays a past run from this.
POST/api/runs/{run_id}/resumeAnswer a paused run: skip the gated source, or run (or skip) the answer's code.ResumeRequestRunAccepted
POST/api/runs/{run_id}/resume/uploadAnswer a paused run with the gated source's file: it is attached to the chat, indexed, and searched for this answer in place of the source.RunAccepted
GET/api/spaces/{space_id}/threadsList Threadslist of ThreadOut
POST/api/spaces/{space_id}/threadsCreate ThreadThreadCreate201, ThreadOut
DELETE/api/threads/{thread_id}Delete Thread204, no body
GET/api/threads/{thread_id}Get ThreadThreadOut
PATCH/api/threads/{thread_id}Patch ThreadThreadPatchThreadOut
PUT/api/threads/{thread_id}/branchShow the branch through a message (its newest continuation).BranchRequestThreadOut
GET/api/threads/{thread_id}/exportExport Thread
DELETE/api/threads/{thread_id}/files/{file_id}Delete Attachment204, no body
GET/api/threads/{thread_id}/messagesList MessagesMessagePage
POST/api/threads/{thread_id}/messagesPost Message202, RunAccepted
POST/api/threads/{thread_id}/messages/{message_id}/regenerateAnswer a question again, optionally in another style; the new answer is a sibling of the old.RegenerateRequest202, RunAccepted

users ​

MethodPathWhat it doesBodyReturns
GET/api/usersAccounts waiting for approval first, then the rest by creation.list of UserOut
POST/api/usersCreate UserUserCreate201, UserOut
DELETE/api/users/{user_id}Delete an account and everything it owns (Spaces, chats, Library items, notes, study sets). Their items in the shared Library stay: they move to the admin who deletes the account.204, no body
PATCH/api/users/{user_id}Patch UserUserPatchUserOut
POST/api/users/{user_id}/approveLet a self sign-up in: the account becomes an active user.UserOut
POST/api/users/{user_id}/rejectTurn a self sign-up down: the account is removed (it has no content yet).204, no body
GET/api/users/{user_id}/viewTheir Spaces (with their own chats and study sets in each), Library items and how many notes.Overview
GET/api/users/{user_id}/view/notesView Noteslist of NoteOut
GET/api/users/{user_id}/view/study-sets/{set_id}View Study SetStudySetDetail
GET/api/users/{user_id}/view/threads/{thread_id}View ThreadThreadOut
GET/api/users/{user_id}/view/threads/{thread_id}/messagesOlder messages of a chat (paging back).MessagePage