Skill Tracer
Skills › Scientific Agent Skills › open-notebook › api_reference.md

api_reference.md

291 lines · skills/open-notebook/references/api_reference.md at 5f2bc03

Open on GitHub
1# Open Notebook API Reference
2
3Reviewed 2026-09-30 against **v1.14.0** and main commit
4`3127f14ea9dbb519f0e4ddc64a0742ca644ba6ef`. Routes below are from the official
5[router source](https://github.com/lfnovo/open-notebook/tree/v1.14.0/api/routers),
6[request/response models](https://github.com/lfnovo/open-notebook/blob/v1.14.0/api/models.py),
7and [podcast service](https://github.com/lfnovo/open-notebook/blob/v1.14.0/api/podcast_service.py).
8Source verification and local mocked tests are not authenticated end-to-end tests.
9The installed instance's `/openapi.json` is authoritative for its version.

Open Notebook API Reference

Reviewed 2026-09-30 against v1.14.0 and main commit 3127f14ea9dbb519f0e4ddc64a0742ca644ba6ef. Routes below are from the official router source, request/response models, and podcast service. Source verification and local mocked tests are not authenticated end-to-end tests. The installed instance's /openapi.json is authoritative for its version.

Raw lines 1 to 10
11## Transport and authentication
13Base: `http://localhost:5055/api`. Tables use full `/api` paths. Interactive docs
14are `/docs` and `/redoc` on the backend origin, not below `/api`.
15If `OPEN_NOTEBOOK_PASSWORD` is set on the server, send
16`Authorization: Bearer <instance-password>` on every protected request, including
17downloads. Otherwise authentication is disabled. The encryption key is for server
18credential storage; it is neither a bearer token nor a client requirement.
20The [middleware configuration](https://github.com/lfnovo/open-notebook/blob/v1.14.0/api/main.py)
21excludes `/`, `/health`, `/docs`, `/openapi.json`, `/redoc`, `/api/auth/status`, and
22`/api/config`; CORS `OPTIONS` is also exempt. There is no OAuth token exchange in
23this password mechanism.
25Use finite HTTP timeouts, check status before parsing, preserve record IDs returned
26by the server (`notebook:...`, `source:...`, `model:...`), and URL-encode path segments.
27Mutating requests have no documented idempotency-key contract; do not blindly retry
28a timed-out creation or generation request. Check for an existing record/job first.
29Most responses are JSON with success status 200; credential creation is 201.

Transport and authentication

Base: http://localhost:5055/api. Tables use full /api paths. Interactive docs are /docs and /redoc on the backend origin, not below /api. If OPEN_NOTEBOOK_PASSWORD is set on the server, send Authorization: Bearer <instance-password> on every protected request, including downloads. Otherwise authentication is disabled. The encryption key is for server credential storage; it is neither a bearer token nor a client requirement.

The middleware configuration excludes /, /health, /docs, /openapi.json, /redoc, /api/auth/status, and /api/config; CORS OPTIONS is also exempt. There is no OAuth token exchange in this password mechanism.

Use finite HTTP timeouts, check status before parsing, preserve record IDs returned by the server (notebook:..., source:..., model:...), and URL-encode path segments. Mutating requests have no documented idempotency-key contract; do not blindly retry a timed-out creation or generation request. Check for an existing record/job first. Most responses are JSON with success status 200; credential creation is 201.

Raw lines 11 to 30
31## Notebooks
33| Method and path | Inputs and response |
34| --- | --- |
35| `GET /api/notebooks` | Optional `archived` boolean; `order_by` defaults to `updated desc`, accepts `name`, `created`, `updated` with optional `asc`/`desc`. Returns an array; no limit/offset. |
36| `POST /api/notebooks` | JSON required `name`, optional `description` default `""`; returns notebook. |
37| `GET /api/notebooks/{notebook_id}` | Returns notebook; also records its last-viewed timestamp. |
38| `PUT /api/notebooks/{notebook_id}` | JSON optional `name`, `description`, `archived`; returns notebook. |
39| `GET /api/notebooks/{notebook_id}/delete-preview` | Returns `notebook_id`, `notebook_name`, `note_count`, `exclusive_source_count`, `shared_source_count`. |
40| `DELETE /api/notebooks/{notebook_id}` | Query `delete_exclusive_sources=false`. Always removes associated notes/chat sessions, unlinks shared sources, optionally deletes exclusive sources. Returns `message`, `deleted_notes`, `deleted_sources`, `unlinked_sources`, `deleted_chat_sessions`. |
41| `POST /api/notebooks/{notebook_id}/sources/{source_id}` | No body; links source and returns `message`. Verify membership before repeated calls; do not depend on duplicate-link prevention. |
42| `DELETE /api/notebooks/{notebook_id}/sources/{source_id}` | No body; removes association, returns `message`. Does not delete the source. |
44Notebook objects have `id`, `name`, `description`, `archived`, `created`, `updated`,
45`source_count`, and `note_count`. There is no `updated_at` sort field or
46`delete_sources` query parameter. The source-link handler's existing-reference
47lookup uses the reverse edge direction from its insertion at this reviewed version;
48its advertised idempotence is therefore not treated as a reliable contract here.

Notebooks

Method and pathInputs and response
GET /api/notebooksOptional archived boolean; order_by defaults to updated desc, accepts name, created, updated with optional asc/desc. Returns an array; no limit/offset.
POST /api/notebooksJSON required name, optional description default ""; returns notebook.
GET /api/notebooks/{notebook_id}Returns notebook; also records its last-viewed timestamp.
PUT /api/notebooks/{notebook_id}JSON optional name, description, archived; returns notebook.
GET /api/notebooks/{notebook_id}/delete-previewReturns notebook_id, notebook_name, note_count, exclusive_source_count, shared_source_count.
DELETE /api/notebooks/{notebook_id}Query delete_exclusive_sources=false. Always removes associated notes/chat sessions, unlinks shared sources, optionally deletes exclusive sources. Returns message, deleted_notes, deleted_sources, unlinked_sources, deleted_chat_sessions.
POST /api/notebooks/{notebook_id}/sources/{source_id}No body; links source and returns message. Verify membership before repeated calls; do not depend on duplicate-link prevention.
DELETE /api/notebooks/{notebook_id}/sources/{source_id}No body; removes association, returns message. Does not delete the source.

Notebook objects have id, name, description, archived, created, updated, source_count, and note_count. There is no updated_at sort field or delete_sources query parameter. The source-link handler's existing-reference lookup uses the reverse edge direction from its insertion at this reviewed version; its advertised idempotence is therefore not treated as a reliable contract here.

Raw lines 31 to 49
50## Sources
52| Method and path | Inputs and response |
53| --- | --- |
54| `GET /api/sources` | Optional `notebook_id`; `limit=50` (1–100), `offset=0` (nonnegative), `sort_by=updated`, `sort_order=desc`. Allowed sorts: `type`, `title`, `created`, `updated`, `insights_count`, `embedded`. Array of summaries, no total/cursor. |
55| `POST /api/sources` | Form fields below; multipart when uploading bytes. Returns source. |
56| `POST /api/sources/json` | JSON `SourceCreate` with equivalent native booleans/lists; legacy supported JSON route. Server `file_path` is allowed only within its uploads directory; local client paths do not upload files. |
57| `GET /api/sources/{source_id}` | Full source including `full_text`, notebook associations and processing fields; records a view. |
58| `PUT /api/sources/{source_id}` | JSON optional `title`, `topics` (list of strings, plural); returns source. |
59| `DELETE /api/sources/{source_id}` | Deletes source; returns `message`. |
60| `GET /api/sources/{source_id}/status` | Returns nullable `status`, `message`, nullable `processing_info`, nullable `command_id`. |
61| `GET /api/sources/{source_id}/download` | Binary original uploaded file; 404 if missing, 403 if outside allowed storage. |
62| `HEAD /api/sources/{source_id}/download` | 200 without body if file is available; same access/existence checks. |
63| `POST /api/sources/{source_id}/retry` | No body; returns newly queued source with `command_id`. Requires notebook association and reusable content. Retry requests embeddings regardless of original `embed`. |
64| `GET /api/sources/{source_id}/insights` | Array with `id`, `source_id`, `insight_type`, `content`, nullable `created`/`updated`. |
66Form contract:
68| Field | Meaning |
69| --- | --- |
70| `type` | Required: `link`, `upload`, or `text`. |
71| `url` | Required for `link`; server fetches it and rejects disallowed destinations. |
72| `file` | Multipart bytes for `upload`. |
73| `content` | Required for `text`; `text` is not this field. |
74| `title` | Optional source title. |
75| `notebooks` | JSON-encoded list of notebook IDs, max 50. |
76| `notebook_id` | Deprecated single-notebook alternative; do not combine with `notebooks`. |
77| `transformations` | JSON-encoded list of transformation IDs, max 50; default `[]`. |
78| `embed` | String boolean, default `false`; explicitly enable for vector retrieval. |
79| `delete_source` | String boolean, default `false`; deletes original uploaded file after processing when enabled. |
80| `async_processing` | String boolean, default `false`; `process_async` is ignored. |
82Source objects include `id`, nullable `title`, `topics`, `asset` (`file_path`, `url`),
83`full_text`, `embedded`, `embedded_chunks`, nullable `file_available`, `created`,
84`updated`, nullable `command_id`, `status`, `processing_info`, and `notebooks`.
85List summaries omit `full_text`/`notebooks` and include `insights_count`.
86Paginate until a short/empty page, using fixed sort order; offset pages can shift
87if the collection is modified during traversal.
89For asynchronous processing, expect new/queued/running/completed/failed states; other
90worker states can appear. Only completed is a positive job result. Unknown/missing
91statuses must not imply success. A synchronous/legacy source may have `status=null`
92and no command: fetch it and inspect text. Successful extraction is distinct from
93embedding completion. Inspect errors before an explicit retry; the reviewed retry
94handler can swallow its own active-job check, so clients should refuse active jobs.

Sources

Method and pathInputs and response
GET /api/sourcesOptional notebook_id; limit=50 (1–100), offset=0 (nonnegative), sort_by=updated, sort_order=desc. Allowed sorts: type, title, created, updated, insights_count, embedded. Array of summaries, no total/cursor.
POST /api/sourcesForm fields below; multipart when uploading bytes. Returns source.
POST /api/sources/jsonJSON SourceCreate with equivalent native booleans/lists; legacy supported JSON route. Server file_path is allowed only within its uploads directory; local client paths do not upload files.
GET /api/sources/{source_id}Full source including full_text, notebook associations and processing fields; records a view.
PUT /api/sources/{source_id}JSON optional title, topics (list of strings, plural); returns source.
DELETE /api/sources/{source_id}Deletes source; returns message.
GET /api/sources/{source_id}/statusReturns nullable status, message, nullable processing_info, nullable command_id.
GET /api/sources/{source_id}/downloadBinary original uploaded file; 404 if missing, 403 if outside allowed storage.
HEAD /api/sources/{source_id}/download200 without body if file is available; same access/existence checks.
POST /api/sources/{source_id}/retryNo body; returns newly queued source with command_id. Requires notebook association and reusable content. Retry requests embeddings regardless of original embed.
GET /api/sources/{source_id}/insightsArray with id, source_id, insight_type, content, nullable created/updated.

Form contract:

FieldMeaning
typeRequired: link, upload, or text.
urlRequired for link; server fetches it and rejects disallowed destinations.
fileMultipart bytes for upload.
contentRequired for text; text is not this field.
titleOptional source title.
notebooksJSON-encoded list of notebook IDs, max 50.
notebook_idDeprecated single-notebook alternative; do not combine with notebooks.
transformationsJSON-encoded list of transformation IDs, max 50; default [].
embedString boolean, default false; explicitly enable for vector retrieval.
delete_sourceString boolean, default false; deletes original uploaded file after processing when enabled.
async_processingString boolean, default false; process_async is ignored.

Source objects include id, nullable title, topics, asset (file_path, url), full_text, embedded, embedded_chunks, nullable file_available, created, updated, nullable command_id, status, processing_info, and notebooks. List summaries omit full_text/notebooks and include insights_count. Paginate until a short/empty page, using fixed sort order; offset pages can shift if the collection is modified during traversal.

For asynchronous processing, expect new/queued/running/completed/failed states; other worker states can appear. Only completed is a positive job result. Unknown/missing statuses must not imply success. A synchronous/legacy source may have status=null and no command: fetch it and inspect text. Successful extraction is distinct from embedding completion. Inspect errors before an explicit retry; the reviewed retry handler can swallow its own active-job check, so clients should refuse active jobs.

Raw lines 50 to 95
96## Notes
98| Method and path | Inputs and response |
99| --- | --- |
100| `GET /api/notes` | Optional `notebook_id`; array, no pagination. |
101| `POST /api/notes` | JSON required `content`; optional `title`, `note_type` default `human`, `notebook_id`. Returns note. |
102| `GET /api/notes/{note_id}` | Returns note. |
103| `PUT /api/notes/{note_id}` | JSON optional `title`, `content`, `note_type`; returns note. |
104| `DELETE /api/notes/{note_id}` | Deletes note; returns `message`. |
106Use `human` or `ai` for `note_type`. An AI note with content and no title invokes a
107model to generate the title. Responses have `id`, nullable `title`, `content`,
108`note_type`, `created`, `updated`, and nullable `command_id` for background work.

Notes

Method and pathInputs and response
GET /api/notesOptional notebook_id; array, no pagination.
POST /api/notesJSON required content; optional title, note_type default human, notebook_id. Returns note.
GET /api/notes/{note_id}Returns note.
PUT /api/notes/{note_id}JSON optional title, content, note_type; returns note.
DELETE /api/notes/{note_id}Deletes note; returns message.

Use human or ai for note_type. An AI note with content and no title invokes a model to generate the title. Responses have id, nullable title, content, note_type, created, updated, and nullable command_id for background work.

Raw lines 96 to 109
110## Chat
112| Method and path | Inputs and response |
113| --- | --- |
114| `GET /api/chat/sessions` | **Required** query `notebook_id`; returns session array. |
115| `POST /api/chat/sessions` | JSON required `notebook_id`, optional `title`, `model_override`; returns session. |
116| `GET /api/chat/sessions/{session_id}` | Session plus `messages[]`. |
117| `PUT /api/chat/sessions/{session_id}` | JSON optional `title`, `model_override`; returns session. |
118| `DELETE /api/chat/sessions/{session_id}` | Returns `{success, message}`. |
119| `POST /api/chat/context` | Required JSON `notebook_id`, `context_config`; returns `{context, token_count, char_count}`. |
120| `POST /api/chat/execute` | Required JSON `session_id`, `message`, `context`; optional `model_override`; returns `{session_id, messages}` JSON. |
122A session has `id`, `title`, nullable `notebook_id`, `created`, `updated`, nullable
123`message_count` and `model_override`. Messages use `id`, `type` (`human`/`ai`),
124`content`, nullable `timestamp`—not a `role` key. Execute returns updated history;
125take the last AI message rather than expecting a top-level `response` string.
127Explicit context configuration:
129```json
131 "notebook_id": "notebook:example",
132 "context_config": {
133 "sources": {"source:example": "full content"},
134 "notes": {}
135 }
137```
139Source states are `full content`, `insights`, `not in context`; notes support full
140content or exclusion. `{}` requests all notebook items with short context;
141`{"sources": {}, "notes": {}}` selects none. The server can skip unavailable IDs
142without failing the request. Check returned IDs/content and token count. Pass
143only the returned `context` member into Execute. `include_sources`/`include_notes`
144and top-level source/note ID lists are not a context-building protocol.

Chat

Method and pathInputs and response
GET /api/chat/sessionsRequired query notebook_id; returns session array.
POST /api/chat/sessionsJSON required notebook_id, optional title, model_override; returns session.
GET /api/chat/sessions/{session_id}Session plus messages[].
PUT /api/chat/sessions/{session_id}JSON optional title, model_override; returns session.
DELETE /api/chat/sessions/{session_id}Returns {success, message}.
POST /api/chat/contextRequired JSON notebook_id, context_config; returns {context, token_count, char_count}.
POST /api/chat/executeRequired JSON session_id, message, context; optional model_override; returns {session_id, messages} JSON.

A session has id, title, nullable notebook_id, created, updated, nullable message_count and model_override. Messages use id, type (human/ai), content, nullable timestamp—not a role key. Execute returns updated history; take the last AI message rather than expecting a top-level response string.

Explicit context configuration:

{
  "notebook_id": "notebook:example",
  "context_config": {
    "sources": {"source:example": "full content"},
    "notes": {}
  }
}

Source states are full content, insights, not in context; notes support full content or exclusion. {} requests all notebook items with short context; {"sources": {}, "notes": {}} selects none. The server can skip unavailable IDs without failing the request. Check returned IDs/content and token count. Pass only the returned context member into Execute. include_sources/include_notes and top-level source/note ID lists are not a context-building protocol.

Raw lines 110 to 145
146## Search and Ask
148| Method and path | Inputs and response |
149| --- | --- |
150| `POST /api/search` | JSON below; returns `{results: [...], total_count, search_type}`. |
151| `POST /api/search/ask/simple` | Required `question`, `strategy_model`, `answer_model`, `final_answer_model`; returns `{answer, question}`. |
152| `POST /api/search/ask` | Same Ask body; returns `text/event-stream`. |
154```json
156 "query": "treatment allocation",
157 "type": "vector",
158 "limit": 10,
159 "search_sources": true,
160 "search_notes": true,
161 "minimum_score": 0.2
163```
165`type` defaults to `text`; vector mode requires a configured default embedding
166model and embedded content. `limit` is 1–1000 (default 100), `minimum_score` is 0–1
167(default 0.2). `total_count` is the length of the returned list, not the total number
168of matching corpus records. Results are dictionaries; vector results can include
169`similarity`. No offset/cursor pagination is exposed by this search endpoint.
171The v1.14.0 schema has **no notebook or source filters**. `search_type`,
172`source_ids`, `note_ids`, and `min_similarity` in request bodies can be silently
173ignored. Current main adds `notebook_id` and `notebook_ids` (max 50) to both Search
174and Ask; omit/empty means global. This is a post-v1.14.0 addition, verified in
175[main's schema at the reviewed commit](https://github.com/lfnovo/open-notebook/blob/3127f14ea9dbb519f0e4ddc64a0742ca644ba6ef/api/models.py).
176Check the **deployed** schema before relying on scope; never silently retry globally.
178Ask's three model values must be registered `model:...` IDs; using the same language
179model for all three is allowed. Ask also requires an embedding model. Streaming
180messages are `data: <JSON>` events with `type`: `strategy`, `answer`, `final_answer`,
181`complete`, or `error`. Read `content` for answer events, `final_answer` on complete,
182and `message` on error. An HTTP 200 stream can still end in an error event.

Search and Ask

Method and pathInputs and response
POST /api/searchJSON below; returns {results: [...], total_count, search_type}.
POST /api/search/ask/simpleRequired question, strategy_model, answer_model, final_answer_model; returns {answer, question}.
POST /api/search/askSame Ask body; returns text/event-stream.
{
  "query": "treatment allocation",
  "type": "vector",
  "limit": 10,
  "search_sources": true,
  "search_notes": true,
  "minimum_score": 0.2
}

type defaults to text; vector mode requires a configured default embedding model and embedded content. limit is 1–1000 (default 100), minimum_score is 0–1 (default 0.2). total_count is the length of the returned list, not the total number of matching corpus records. Results are dictionaries; vector results can include similarity. No offset/cursor pagination is exposed by this search endpoint.

The v1.14.0 schema has no notebook or source filters. search_type, source_ids, note_ids, and min_similarity in request bodies can be silently ignored. Current main adds notebook_id and notebook_ids (max 50) to both Search and Ask; omit/empty means global. This is a post-v1.14.0 addition, verified in main's schema at the reviewed commit. Check the deployed schema before relying on scope; never silently retry globally.

Ask's three model values must be registered model:... IDs; using the same language model for all three is allowed. Ask also requires an embedding model. Streaming messages are data: <JSON> events with type: strategy, answer, final_answer, complete, or error. Read content for answer events, final_answer on complete, and message on error. An HTTP 200 stream can still end in an error event.

Raw lines 146 to 183
184## Podcasts
186| Method and path | Inputs and response |
187| --- | --- |
188| `GET /api/episode-profiles` | Array of profile records, including `name`; choose an existing profile. |
189| `GET /api/speaker-profiles` | Array of profiles with `name` and `speakers`; one profile can contain multiple speakers. |
190| `POST /api/podcasts/generate` | Body below; returns `job_id`, `status="submitted"`, `message`, `episode_profile`, `episode_name`. |
191| `GET /api/podcasts/jobs/{job_id}` | `job_id`, `status`, nullable `result`, `error_message`, `created`, `updated`, `progress`. Completed result contains `episode_id`. |
192| `GET /api/podcasts/episodes` | Array; no pagination/filter contract. |
193| `GET /api/podcasts/episodes/{episode_id}` | Episode including `id`, `name`, profile snapshots, `briefing`, optional audio/transcript/outline, `job_status`, `error_message`. |
194| `GET /api/podcasts/episodes/{episode_id}/audio` | Binary `audio/mpeg`; 404 if audio missing. |
195| `POST /api/podcasts/episodes/{episode_id}/retry` | Only failed/error episodes; deletes failed episode/audio and submits a new job. Returns `{job_id, message}`; prior episode ID is not retained. |
196| `DELETE /api/podcasts/episodes/{episode_id}` | Deletes episode and audio; returns `{message, episode_id}`. |
198```json
200 "episode_profile": "Existing episode profile name",
201 "speaker_profile": "Existing speaker profile name",
202 "episode_name": "Methods review",
203 "content": "Reviewed research text to narrate"
205```
207`episode_profile`, `speaker_profile`, and `episode_name` are required. Profiles are
208selected by **name**, not `episode_profile_id`/`speaker_profile_ids`. `content` or
209`notebook_id` supplies material; `briefing_suffix` is optional. Prefer explicit
210reviewed content: the notebook-only path has an upstream fallback to a string/ID if
211context gathering fails. Poll with a deadline and handle failed/error/unknown
212states; do not access a top-level `episode_id` on the job response.

Podcasts

Method and pathInputs and response
GET /api/episode-profilesArray of profile records, including name; choose an existing profile.
GET /api/speaker-profilesArray of profiles with name and speakers; one profile can contain multiple speakers.
POST /api/podcasts/generateBody below; returns job_id, status="submitted", message, episode_profile, episode_name.
GET /api/podcasts/jobs/{job_id}job_id, status, nullable result, error_message, created, updated, progress. Completed result contains episode_id.
GET /api/podcasts/episodesArray; no pagination/filter contract.
GET /api/podcasts/episodes/{episode_id}Episode including id, name, profile snapshots, briefing, optional audio/transcript/outline, job_status, error_message.
GET /api/podcasts/episodes/{episode_id}/audioBinary audio/mpeg; 404 if audio missing.
POST /api/podcasts/episodes/{episode_id}/retryOnly failed/error episodes; deletes failed episode/audio and submits a new job. Returns {job_id, message}; prior episode ID is not retained.
DELETE /api/podcasts/episodes/{episode_id}Deletes episode and audio; returns {message, episode_id}.
{
  "episode_profile": "Existing episode profile name",
  "speaker_profile": "Existing speaker profile name",
  "episode_name": "Methods review",
  "content": "Reviewed research text to narrate"
}

episode_profile, speaker_profile, and episode_name are required. Profiles are selected by name, not episode_profile_id/speaker_profile_ids. content or notebook_id supplies material; briefing_suffix is optional. Prefer explicit reviewed content: the notebook-only path has an upstream fallback to a string/ID if context gathering fails. Poll with a deadline and handle failed/error/unknown states; do not access a top-level episode_id on the job response.

Raw lines 184 to 213
214## Transformations
216| Method and path | Inputs and response |
217| --- | --- |
218| `GET /api/transformations` | Array, no pagination. |
219| `POST /api/transformations` | Required `name`, `title`, `description`, `prompt`; optional `apply_default=false`, `model_id`; returns transformation. |
220| `GET /api/transformations/{transformation_id}` | Transformation object. |
221| `PUT /api/transformations/{transformation_id}` | Same fields, all optional; returns transformation. |
222| `DELETE /api/transformations/{transformation_id}` | Returns `message`. |
223| `POST /api/transformations/execute` | Required `transformation_id`, `input_text`; optional `model_id`; returns `output`, `transformation_id`, nullable `model_id`. |
224| `GET /api/transformations/default-prompt` | Returns `{transformation_instructions}`. |
225| `PUT /api/transformations/default-prompt` | Required JSON `transformation_instructions`; returns same shape. |
227Transformation records add `id`, `created`, and `updated` to their input fields.
228Executing raw text returns output; it does not automatically create a persisted
229note or insight. Preserve provenance when saving generated text.

Transformations

Method and pathInputs and response
GET /api/transformationsArray, no pagination.
POST /api/transformationsRequired name, title, description, prompt; optional apply_default=false, model_id; returns transformation.
GET /api/transformations/{transformation_id}Transformation object.
PUT /api/transformations/{transformation_id}Same fields, all optional; returns transformation.
DELETE /api/transformations/{transformation_id}Returns message.
POST /api/transformations/executeRequired transformation_id, input_text; optional model_id; returns output, transformation_id, nullable model_id.
GET /api/transformations/default-promptReturns {transformation_instructions}.
PUT /api/transformations/default-promptRequired JSON transformation_instructions; returns same shape.

Transformation records add id, created, and updated to their input fields. Executing raw text returns output; it does not automatically create a persisted note or insight. Preserve provenance when saving generated text.

Raw lines 214 to 230
231## Models
233| Method and path | Inputs and response |
234| --- | --- |
235| `GET /api/models` | Optional query `type`: `language`, `embedding`, `speech_to_text`, `text_to_speech`; array. |
236| `POST /api/models` | JSON required `name`, `provider`, `type`; optional credential record ID in `credential`. Returns model; duplicates fail. |
237| `DELETE /api/models/{model_id}` | Returns `message`. |
238| `POST /api/models/{model_id}/test` | No body; returns `success`, `message`, nullable `details`; can contact the provider. |
239| `GET /api/models/defaults` | Default slot object below. |
240| `PUT /api/models/defaults` | Partial object of slots; omitted fields unchanged, explicit null clears optional slots. Chat/embedding cannot be cleared. |
241| `GET /api/models/providers` | `{available: [...], unavailable: [...], supported_types: {provider: [...]}}`. |
242| `GET /api/models/discover/{provider}` | Array of `{name, provider, model_type, description}`; no registration. |
243| `POST /api/models/sync/{provider}` | Discovers/registers models; returns `{provider, discovered, new, existing}` counts. |
244| `POST /api/models/sync` | Returns `{results: {provider: counts}, total_discovered, total_new}`. |
245| `POST /api/models/auto-assign` | Assigns only empty **chat and embedding** required slots; returns `{assigned, skipped, missing}`. |
246| `GET /api/models/count/{provider}` | `{provider, counts: {type: count}, total}`. |
247| `GET /api/models/by-provider/{provider}` | Array of registered model records. |
249Model records have `id`, `name`, `provider`, `type`, nullable `credential`, `created`,
250`updated`. Use registered IDs for chat/Ask/default assignments, provider model names
251for model registration. Default slots are `default_chat_model`,
252`default_transformation_model`, `large_context_model`, `default_text_to_speech_model`,
253`default_speech_to_text_model`, `default_embedding_model`, `default_tools_model`.
254There are no `podcast` or `summary` slots. Explicitly assign optional speech models;
255auto-assign does not populate them. Verify provider data flow before assigning defaults.

Models

Method and pathInputs and response
GET /api/modelsOptional query type: language, embedding, speech_to_text, text_to_speech; array.
POST /api/modelsJSON required name, provider, type; optional credential record ID in credential. Returns model; duplicates fail.
DELETE /api/models/{model_id}Returns message.
POST /api/models/{model_id}/testNo body; returns success, message, nullable details; can contact the provider.
GET /api/models/defaultsDefault slot object below.
PUT /api/models/defaultsPartial object of slots; omitted fields unchanged, explicit null clears optional slots. Chat/embedding cannot be cleared.
GET /api/models/providers{available: [...], unavailable: [...], supported_types: {provider: [...]}}.
GET /api/models/discover/{provider}Array of {name, provider, model_type, description}; no registration.
POST /api/models/sync/{provider}Discovers/registers models; returns {provider, discovered, new, existing} counts.
POST /api/models/syncReturns {results: {provider: counts}, total_discovered, total_new}.
POST /api/models/auto-assignAssigns only empty chat and embedding required slots; returns {assigned, skipped, missing}.
GET /api/models/count/{provider}{provider, counts: {type: count}, total}.
GET /api/models/by-provider/{provider}Array of registered model records.

Model records have id, name, provider, type, nullable credential, created, updated. Use registered IDs for chat/Ask/default assignments, provider model names for model registration. Default slots are default_chat_model, default_transformation_model, large_context_model, default_text_to_speech_model, default_speech_to_text_model, default_embedding_model, default_tools_model. There are no podcast or summary slots. Explicitly assign optional speech models; auto-assign does not populate them. Verify provider data flow before assigning defaults.

Raw lines 231 to 256
257## Credentials
259| Method and path | Inputs and response |
260| --- | --- |
261| `GET /api/credentials/status` | `{configured: {provider: bool}, source: {provider: database/environment/none}, encryption_configured}`. |
262| `GET /api/credentials/env-status` | Map of provider to environment-configuration boolean. |
263| `GET /api/credentials` | Optional `provider`; array of safe credential records. |
264| `GET /api/credentials/by-provider/{provider}` | Credential array for provider. |
265| `POST /api/credentials` | Required JSON `name`, `provider`; provider-specific settings below. 201 credential record. |
266| `GET /api/credentials/{credential_id}` | Safe credential record. |
267| `PUT /api/credentials/{credential_id}` | Optional mutable settings; provider cannot be changed. Returns safe record. |
268| `DELETE /api/credentials/{credential_id}` | Optional query `migrate_to` credential ID; otherwise **cascade-deletes linked models**. Returns `{message, deleted_models}`. |
269| `POST /api/credentials/{credential_id}/test` | `{provider, success, message}`; check success, not just HTTP status. Some provider tests only validate key format. |
270| `POST /api/credentials/{credential_id}/discover` | `{credential_id, provider, discovered: [{name, provider, model_type, description}]}`; model_type can be null. |
271| `POST /api/credentials/{credential_id}/register-models` | JSON `{models: [{name, provider, model_type}]}`; returns `{created, existing}` counts. |
273Settings include `modalities`, `api_key`, `base_url`; Azure has `endpoint`,
274`api_version`; separate endpoints may use `endpoint_llm`, `endpoint_embedding`,
275`endpoint_stt`, `endpoint_tts`; Vertex uses `project`, `location`, `credentials_path`;
276Ollama supports `num_ctx`. Validate the chosen provider in the instance schema;
277requirements differ by provider. Stored API keys are encrypted server-side and
278never returned. Responses expose `has_api_key`, `model_count`, and nullable
279`decryption_error` plus non-secret configuration and timestamps. Do not print
280credential request bodies or copy keys into examples.

Credentials

Method and pathInputs and response
GET /api/credentials/status{configured: {provider: bool}, source: {provider: database/environment/none}, encryption_configured}.
GET /api/credentials/env-statusMap of provider to environment-configuration boolean.
GET /api/credentialsOptional provider; array of safe credential records.
GET /api/credentials/by-provider/{provider}Credential array for provider.
POST /api/credentialsRequired JSON name, provider; provider-specific settings below. 201 credential record.
GET /api/credentials/{credential_id}Safe credential record.
PUT /api/credentials/{credential_id}Optional mutable settings; provider cannot be changed. Returns safe record.
DELETE /api/credentials/{credential_id}Optional query migrate_to credential ID; otherwise cascade-deletes linked models. Returns {message, deleted_models}.
POST /api/credentials/{credential_id}/test{provider, success, message}; check success, not just HTTP status. Some provider tests only validate key format.
POST /api/credentials/{credential_id}/discover{credential_id, provider, discovered: [{name, provider, model_type, description}]}; model_type can be null.
POST /api/credentials/{credential_id}/register-modelsJSON {models: [{name, provider, model_type}]}; returns {created, existing} counts.

Settings include modalities, api_key, base_url; Azure has endpoint, api_version; separate endpoints may use endpoint_llm, endpoint_embedding, endpoint_stt, endpoint_tts; Vertex uses project, location, credentials_path; Ollama supports num_ctx. Validate the chosen provider in the instance schema; requirements differ by provider. Stored API keys are encrypted server-side and never returned. Responses expose has_api_key, model_count, and nullable decryption_error plus non-secret configuration and timestamps. Do not print credential request bodies or copy keys into examples.

Raw lines 257 to 281
282## Errors
284Always check HTTP status before parsing a success shape. FastAPI validation uses
285422 with a `detail` list of field errors; other handlers commonly return a `detail`
286string. Not every failure has the same JSON structure. Expected categories include
287400 invalid input, 401 missing/invalid instance password, 403 denied file access,
288404 missing resource, 413 oversized upload, 422 schema/configuration failure,
289429 provider rate limits, 500 backend/job submission errors, and 502 provider errors.
290A queued source, HTTP 200 test response with `success=false`, and SSE `error` event
291are unsuccessful operations despite their HTTP response being successful.

Errors

Always check HTTP status before parsing a success shape. FastAPI validation uses 422 with a detail list of field errors; other handlers commonly return a detail string. Not every failure has the same JSON structure. Expected categories include 400 invalid input, 401 missing/invalid instance password, 403 denied file access, 404 missing resource, 413 oversized upload, 422 schema/configuration failure, 429 provider rate limits, 500 backend/job submission errors, and 502 provider errors. A queued source, HTTP 200 test response with success=false, and SSE error event are unsuccessful operations despite their HTTP response being successful.

Raw lines 282 to 291