openapi.json 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  1. {
  2. "openapi": "3.1.0",
  3. "info": {
  4. "title": "smartbotic-vectorapi",
  5. "version": "0.1.0",
  6. "description": "General-purpose REST API fronting smartbotic-database. Supports multi-project namespacing and multi-key authorization with per-project grants."
  7. },
  8. "components": {
  9. "securitySchemes": {
  10. "bearerAuth": {
  11. "type": "http",
  12. "scheme": "bearer",
  13. "description": "API key issued by the /api/v1/keys endpoint. Pass as Authorization: Bearer <KEY>."
  14. }
  15. },
  16. "schemas": {
  17. "Error": {
  18. "type": "object",
  19. "properties": {
  20. "error": { "type": "string" },
  21. "message": { "type": "string" }
  22. },
  23. "required": ["error", "message"]
  24. },
  25. "CollectionMeta": {
  26. "type": "object",
  27. "properties": {
  28. "name": { "type": "string" },
  29. "kind": { "type": "string", "enum": ["json", "vector"] },
  30. "vector_dimension": { "type": "integer", "minimum": 1 },
  31. "embedding_model": { "type": "string" },
  32. "created_at": { "type": "integer" }
  33. },
  34. "required": ["name", "kind"]
  35. },
  36. "ApiKeyPublic": {
  37. "type": "object",
  38. "properties": {
  39. "key_prefix": { "type": "string" },
  40. "label": { "type": "string" },
  41. "projects": { "type": "array", "items": { "type": "string" } },
  42. "admin": { "type": "boolean" },
  43. "created_at": { "type": "integer" }
  44. }
  45. }
  46. }
  47. },
  48. "security": [{ "bearerAuth": [] }],
  49. "paths": {
  50. "/healthz": {
  51. "get": {
  52. "summary": "Liveness check — always 200 if the process is running",
  53. "operationId": "healthz",
  54. "security": [],
  55. "responses": {
  56. "200": { "description": "OK" }
  57. }
  58. }
  59. },
  60. "/readyz": {
  61. "get": {
  62. "summary": "Readiness check — 200 when the database is reachable",
  63. "operationId": "readyz",
  64. "security": [],
  65. "responses": {
  66. "200": { "description": "Ready" },
  67. "503": { "description": "Database not reachable" }
  68. }
  69. }
  70. },
  71. "/api/v1/projects": {
  72. "get": {
  73. "summary": "List projects the key may access (admin sees all)",
  74. "operationId": "listProjects",
  75. "responses": {
  76. "200": {
  77. "description": "Project list",
  78. "content": {
  79. "application/json": {
  80. "schema": {
  81. "type": "object",
  82. "properties": {
  83. "projects": { "type": "array", "items": { "type": "string" } }
  84. }
  85. }
  86. }
  87. }
  88. },
  89. "401": { "description": "Unauthorized" }
  90. }
  91. },
  92. "post": {
  93. "summary": "Create a new project (admin only)",
  94. "operationId": "createProject",
  95. "requestBody": {
  96. "required": true,
  97. "content": {
  98. "application/json": {
  99. "schema": {
  100. "type": "object",
  101. "properties": {
  102. "name": { "type": "string" }
  103. },
  104. "required": ["name"]
  105. }
  106. }
  107. }
  108. },
  109. "responses": {
  110. "201": { "description": "Project created" },
  111. "401": { "description": "Unauthorized" },
  112. "403": { "description": "Forbidden — admin required" },
  113. "422": { "description": "Validation error" }
  114. }
  115. }
  116. },
  117. "/api/v1/projects/{project}": {
  118. "parameters": [
  119. {
  120. "name": "project",
  121. "in": "path",
  122. "required": true,
  123. "schema": { "type": "string" },
  124. "description": "Project name"
  125. }
  126. ],
  127. "get": {
  128. "summary": "Get project info (collection and document counts)",
  129. "operationId": "getProject",
  130. "responses": {
  131. "200": {
  132. "description": "Project info",
  133. "content": {
  134. "application/json": {
  135. "schema": {
  136. "type": "object",
  137. "properties": {
  138. "name": { "type": "string" },
  139. "collections": { "type": "integer" },
  140. "documents": { "type": "integer" }
  141. }
  142. }
  143. }
  144. }
  145. },
  146. "401": { "description": "Unauthorized" },
  147. "403": { "description": "Forbidden" },
  148. "404": { "description": "Project not found" }
  149. }
  150. },
  151. "delete": {
  152. "summary": "Drop a project (admin only; not 'default')",
  153. "operationId": "deleteProject",
  154. "responses": {
  155. "200": { "description": "Project deleted" },
  156. "401": { "description": "Unauthorized" },
  157. "403": { "description": "Forbidden — admin required or cannot drop default" },
  158. "404": { "description": "Project not found" }
  159. }
  160. }
  161. },
  162. "/api/v1/keys": {
  163. "get": {
  164. "summary": "List API keys (admin only; secret masked, only key_prefix shown)",
  165. "operationId": "listKeys",
  166. "responses": {
  167. "200": {
  168. "description": "Key list",
  169. "content": {
  170. "application/json": {
  171. "schema": {
  172. "type": "object",
  173. "properties": {
  174. "keys": {
  175. "type": "array",
  176. "items": { "$ref": "#/components/schemas/ApiKeyPublic" }
  177. }
  178. }
  179. }
  180. }
  181. }
  182. },
  183. "401": { "description": "Unauthorized" },
  184. "403": { "description": "Forbidden — admin required" }
  185. }
  186. },
  187. "post": {
  188. "summary": "Generate a new API key (admin only); returns the secret key value once",
  189. "operationId": "createKey",
  190. "requestBody": {
  191. "required": true,
  192. "content": {
  193. "application/json": {
  194. "schema": {
  195. "type": "object",
  196. "properties": {
  197. "label": { "type": "string" },
  198. "projects": {
  199. "type": "array",
  200. "items": { "type": "string" },
  201. "description": "Project names the key may access; use [\"*\"] for all projects"
  202. },
  203. "admin": { "type": "boolean", "default": false }
  204. },
  205. "required": ["label", "projects"]
  206. }
  207. }
  208. }
  209. },
  210. "responses": {
  211. "201": {
  212. "description": "Key created; contains the secret key value (shown once)",
  213. "content": {
  214. "application/json": {
  215. "schema": {
  216. "type": "object",
  217. "properties": {
  218. "key": { "type": "string" },
  219. "label": { "type": "string" },
  220. "projects": { "type": "array", "items": { "type": "string" } },
  221. "admin": { "type": "boolean" }
  222. }
  223. }
  224. }
  225. }
  226. },
  227. "401": { "description": "Unauthorized" },
  228. "403": { "description": "Forbidden — admin required" },
  229. "422": { "description": "Validation error" }
  230. }
  231. }
  232. },
  233. "/api/v1/keys/{key}": {
  234. "parameters": [
  235. {
  236. "name": "key",
  237. "in": "path",
  238. "required": true,
  239. "schema": { "type": "string" },
  240. "description": "API key value"
  241. }
  242. ],
  243. "patch": {
  244. "summary": "Update key grants (admin only)",
  245. "operationId": "updateKey",
  246. "requestBody": {
  247. "required": true,
  248. "content": {
  249. "application/json": {
  250. "schema": {
  251. "type": "object",
  252. "properties": {
  253. "label": { "type": "string" },
  254. "projects": { "type": "array", "items": { "type": "string" } },
  255. "admin": { "type": "boolean" }
  256. }
  257. }
  258. }
  259. }
  260. },
  261. "responses": {
  262. "200": { "description": "Key updated" },
  263. "401": { "description": "Unauthorized" },
  264. "403": { "description": "Forbidden — admin required" },
  265. "404": { "description": "Key not found" }
  266. }
  267. },
  268. "delete": {
  269. "summary": "Revoke an API key (admin only)",
  270. "operationId": "deleteKey",
  271. "responses": {
  272. "200": { "description": "Key revoked" },
  273. "401": { "description": "Unauthorized" },
  274. "403": { "description": "Forbidden — admin required" },
  275. "404": { "description": "Key not found" }
  276. }
  277. }
  278. },
  279. "/api/v1/projects/{project}/collections": {
  280. "parameters": [
  281. {
  282. "name": "project",
  283. "in": "path",
  284. "required": true,
  285. "schema": { "type": "string" },
  286. "description": "Project name"
  287. }
  288. ],
  289. "get": {
  290. "summary": "List collections in a project",
  291. "operationId": "listCollections",
  292. "responses": {
  293. "200": {
  294. "description": "Collection list",
  295. "content": {
  296. "application/json": {
  297. "schema": {
  298. "type": "object",
  299. "properties": {
  300. "collections": {
  301. "type": "array",
  302. "items": { "$ref": "#/components/schemas/CollectionMeta" }
  303. }
  304. }
  305. }
  306. }
  307. }
  308. },
  309. "401": { "description": "Unauthorized" },
  310. "403": { "description": "Forbidden" }
  311. }
  312. },
  313. "post": {
  314. "summary": "Create a collection in a project",
  315. "operationId": "createCollection",
  316. "requestBody": {
  317. "required": true,
  318. "content": {
  319. "application/json": {
  320. "schema": {
  321. "type": "object",
  322. "properties": {
  323. "name": { "type": "string" },
  324. "kind": { "type": "string", "enum": ["json", "vector"] },
  325. "vector_dimension": {
  326. "type": "integer",
  327. "minimum": 1,
  328. "description": "Required when kind=vector"
  329. },
  330. "embedding_model": {
  331. "type": "string",
  332. "description": "Optional; defaults to global default_embedding_model"
  333. }
  334. },
  335. "required": ["name", "kind"]
  336. }
  337. }
  338. }
  339. },
  340. "responses": {
  341. "201": { "description": "Collection created" },
  342. "401": { "description": "Unauthorized" },
  343. "403": { "description": "Forbidden" },
  344. "422": { "description": "Validation error (e.g. missing vector_dimension for vector kind)" }
  345. }
  346. }
  347. },
  348. "/api/v1/projects/{project}/collections/{name}": {
  349. "parameters": [
  350. {
  351. "name": "project",
  352. "in": "path",
  353. "required": true,
  354. "schema": { "type": "string" },
  355. "description": "Project name"
  356. },
  357. {
  358. "name": "name",
  359. "in": "path",
  360. "required": true,
  361. "schema": { "type": "string" },
  362. "description": "Collection name"
  363. }
  364. ],
  365. "get": {
  366. "summary": "Get collection metadata",
  367. "operationId": "getCollection",
  368. "responses": {
  369. "200": {
  370. "description": "Collection metadata",
  371. "content": {
  372. "application/json": {
  373. "schema": { "$ref": "#/components/schemas/CollectionMeta" }
  374. }
  375. }
  376. },
  377. "401": { "description": "Unauthorized" },
  378. "403": { "description": "Forbidden" },
  379. "404": { "description": "Collection not found" }
  380. }
  381. },
  382. "delete": {
  383. "summary": "Drop a collection and all its documents",
  384. "operationId": "deleteCollection",
  385. "responses": {
  386. "200": { "description": "Collection deleted" },
  387. "401": { "description": "Unauthorized" },
  388. "403": { "description": "Forbidden" },
  389. "404": { "description": "Collection not found" }
  390. }
  391. }
  392. },
  393. "/api/v1/projects/{project}/collections/{name}/documents": {
  394. "parameters": [
  395. {
  396. "name": "project",
  397. "in": "path",
  398. "required": true,
  399. "schema": { "type": "string" },
  400. "description": "Project name"
  401. },
  402. {
  403. "name": "name",
  404. "in": "path",
  405. "required": true,
  406. "schema": { "type": "string" },
  407. "description": "Collection name"
  408. }
  409. ],
  410. "get": {
  411. "summary": "Find documents with optional filter, pagination, and sort",
  412. "operationId": "findDocuments",
  413. "parameters": [
  414. {
  415. "name": "filter",
  416. "in": "query",
  417. "schema": { "type": "string" },
  418. "description": "Filter expression in field:op:value grammar (e.g. age:gte:30, name:eq:Alice). Multiple filters are ANDed."
  419. },
  420. {
  421. "name": "limit",
  422. "in": "query",
  423. "schema": { "type": "integer", "default": 20 }
  424. },
  425. {
  426. "name": "offset",
  427. "in": "query",
  428. "schema": { "type": "integer", "default": 0 }
  429. },
  430. {
  431. "name": "sort",
  432. "in": "query",
  433. "schema": { "type": "string" },
  434. "description": "Field to sort by"
  435. },
  436. {
  437. "name": "desc",
  438. "in": "query",
  439. "schema": { "type": "boolean", "default": false }
  440. }
  441. ],
  442. "responses": {
  443. "200": {
  444. "description": "Document list",
  445. "content": {
  446. "application/json": {
  447. "schema": {
  448. "type": "object",
  449. "properties": {
  450. "documents": { "type": "array", "items": { "type": "object" } },
  451. "count": { "type": "integer" }
  452. }
  453. }
  454. }
  455. }
  456. },
  457. "401": { "description": "Unauthorized" },
  458. "403": { "description": "Forbidden" },
  459. "404": { "description": "Collection not found" }
  460. }
  461. },
  462. "post": {
  463. "summary": "Insert a new JSON document",
  464. "operationId": "insertDocument",
  465. "requestBody": {
  466. "required": true,
  467. "content": {
  468. "application/json": {
  469. "schema": {
  470. "type": "object",
  471. "properties": {
  472. "data": {
  473. "type": "object",
  474. "description": "Arbitrary JSON document payload"
  475. }
  476. }
  477. }
  478. }
  479. }
  480. },
  481. "responses": {
  482. "201": {
  483. "description": "Document inserted",
  484. "content": {
  485. "application/json": {
  486. "schema": {
  487. "type": "object",
  488. "properties": {
  489. "id": { "type": "string" }
  490. }
  491. }
  492. }
  493. }
  494. },
  495. "401": { "description": "Unauthorized" },
  496. "403": { "description": "Forbidden" },
  497. "404": { "description": "Collection not found" },
  498. "422": { "description": "Validation error" }
  499. }
  500. }
  501. },
  502. "/api/v1/projects/{project}/collections/{name}/documents/{id}": {
  503. "parameters": [
  504. {
  505. "name": "project",
  506. "in": "path",
  507. "required": true,
  508. "schema": { "type": "string" },
  509. "description": "Project name"
  510. },
  511. {
  512. "name": "name",
  513. "in": "path",
  514. "required": true,
  515. "schema": { "type": "string" },
  516. "description": "Collection name"
  517. },
  518. {
  519. "name": "id",
  520. "in": "path",
  521. "required": true,
  522. "schema": { "type": "string" },
  523. "description": "Document ID"
  524. }
  525. ],
  526. "get": {
  527. "summary": "Get a document by ID",
  528. "operationId": "getDocument",
  529. "responses": {
  530. "200": {
  531. "description": "Document",
  532. "content": {
  533. "application/json": {
  534. "schema": { "type": "object" }
  535. }
  536. }
  537. },
  538. "401": { "description": "Unauthorized" },
  539. "403": { "description": "Forbidden" },
  540. "404": { "description": "Document not found" }
  541. }
  542. },
  543. "put": {
  544. "summary": "Replace a document (full upsert by ID)",
  545. "operationId": "replaceDocument",
  546. "requestBody": {
  547. "required": true,
  548. "content": {
  549. "application/json": {
  550. "schema": { "type": "object" }
  551. }
  552. }
  553. },
  554. "responses": {
  555. "200": { "description": "Document replaced" },
  556. "401": { "description": "Unauthorized" },
  557. "403": { "description": "Forbidden" },
  558. "404": { "description": "Collection not found" },
  559. "422": { "description": "Validation error" }
  560. }
  561. },
  562. "patch": {
  563. "summary": "Partially update a document (merge fields)",
  564. "operationId": "patchDocument",
  565. "requestBody": {
  566. "required": true,
  567. "content": {
  568. "application/json": {
  569. "schema": { "type": "object" }
  570. }
  571. }
  572. },
  573. "responses": {
  574. "200": { "description": "Document updated" },
  575. "401": { "description": "Unauthorized" },
  576. "403": { "description": "Forbidden" },
  577. "404": { "description": "Document not found" },
  578. "422": { "description": "Validation error" }
  579. }
  580. },
  581. "delete": {
  582. "summary": "Delete a document by ID",
  583. "operationId": "deleteDocument",
  584. "responses": {
  585. "200": { "description": "Document deleted" },
  586. "401": { "description": "Unauthorized" },
  587. "403": { "description": "Forbidden" },
  588. "404": { "description": "Document not found" }
  589. }
  590. }
  591. },
  592. "/api/v1/projects/{project}/collections/{name}/vectors": {
  593. "parameters": [
  594. {
  595. "name": "project",
  596. "in": "path",
  597. "required": true,
  598. "schema": { "type": "string" },
  599. "description": "Project name"
  600. },
  601. {
  602. "name": "name",
  603. "in": "path",
  604. "required": true,
  605. "schema": { "type": "string" },
  606. "description": "Collection name (must be kind=vector)"
  607. }
  608. ],
  609. "post": {
  610. "summary": "Store a vector; supply either text (auto-embedded) or an explicit vector array",
  611. "operationId": "upsertVector",
  612. "requestBody": {
  613. "required": true,
  614. "content": {
  615. "application/json": {
  616. "schema": {
  617. "type": "object",
  618. "properties": {
  619. "id": {
  620. "type": "string",
  621. "description": "Optional stable ID; auto-generated if omitted"
  622. },
  623. "text": {
  624. "type": "string",
  625. "description": "Source text; will be embedded using the collection's embedding_model"
  626. },
  627. "vector": {
  628. "type": "array",
  629. "items": { "type": "number" },
  630. "description": "Pre-computed embedding; dimension must match the collection's vector_dimension"
  631. },
  632. "metadata": {
  633. "type": "object",
  634. "description": "Arbitrary JSON payload stored alongside the vector"
  635. }
  636. }
  637. }
  638. }
  639. }
  640. },
  641. "responses": {
  642. "201": {
  643. "description": "Vector stored",
  644. "content": {
  645. "application/json": {
  646. "schema": {
  647. "type": "object",
  648. "properties": {
  649. "id": { "type": "string" }
  650. }
  651. }
  652. }
  653. }
  654. },
  655. "401": { "description": "Unauthorized" },
  656. "403": { "description": "Forbidden" },
  657. "404": { "description": "Collection not found" },
  658. "422": { "description": "Validation error (wrong dimension, not a vector collection, etc.)" }
  659. }
  660. }
  661. },
  662. "/api/v1/projects/{project}/collections/{name}/search": {
  663. "parameters": [
  664. {
  665. "name": "project",
  666. "in": "path",
  667. "required": true,
  668. "schema": { "type": "string" },
  669. "description": "Project name"
  670. },
  671. {
  672. "name": "name",
  673. "in": "path",
  674. "required": true,
  675. "schema": { "type": "string" },
  676. "description": "Collection name (must be kind=vector)"
  677. }
  678. ],
  679. "post": {
  680. "summary": "Cosine-similarity search; supply either query_text (auto-embedded) or query_vector",
  681. "operationId": "searchVectors",
  682. "requestBody": {
  683. "required": true,
  684. "content": {
  685. "application/json": {
  686. "schema": {
  687. "type": "object",
  688. "properties": {
  689. "query_text": {
  690. "type": "string",
  691. "description": "Query text; embedded with the collection's model"
  692. },
  693. "query_vector": {
  694. "type": "array",
  695. "items": { "type": "number" },
  696. "description": "Pre-computed query embedding"
  697. },
  698. "top_k": {
  699. "type": "integer",
  700. "minimum": 1,
  701. "description": "Maximum number of results to return"
  702. },
  703. "min_score": {
  704. "type": "number",
  705. "description": "Minimum cosine similarity score (0–1)"
  706. },
  707. "filters": {
  708. "type": "array",
  709. "items": { "type": "string" },
  710. "description": "Metadata filters in field:op:value grammar (e.g. src:eq:n8n)"
  711. }
  712. },
  713. "required": ["top_k"]
  714. }
  715. }
  716. }
  717. },
  718. "responses": {
  719. "200": {
  720. "description": "Search results",
  721. "content": {
  722. "application/json": {
  723. "schema": {
  724. "type": "object",
  725. "properties": {
  726. "results": {
  727. "type": "array",
  728. "items": {
  729. "type": "object",
  730. "properties": {
  731. "id": { "type": "string" },
  732. "score": { "type": "number" },
  733. "metadata": { "type": "object" }
  734. }
  735. }
  736. }
  737. }
  738. }
  739. }
  740. }
  741. },
  742. "401": { "description": "Unauthorized" },
  743. "403": { "description": "Forbidden" },
  744. "404": { "description": "Collection not found" },
  745. "422": { "description": "Validation error" }
  746. }
  747. }
  748. },
  749. "/api/v1/projects/{project}/stats": {
  750. "parameters": [
  751. {
  752. "name": "project",
  753. "in": "path",
  754. "required": true,
  755. "schema": { "type": "string" },
  756. "description": "Project name"
  757. }
  758. ],
  759. "get": {
  760. "summary": "Per-project stats (accessible by any key granted the project)",
  761. "operationId": "projectStats",
  762. "responses": {
  763. "200": {
  764. "description": "Project stats",
  765. "content": {
  766. "application/json": {
  767. "schema": {
  768. "type": "object",
  769. "properties": {
  770. "project": { "type": "string" },
  771. "collections": { "type": "integer" },
  772. "documents": { "type": "integer" }
  773. }
  774. }
  775. }
  776. }
  777. },
  778. "401": { "description": "Unauthorized" },
  779. "403": { "description": "Forbidden" }
  780. }
  781. }
  782. },
  783. "/api/v1/settings": {
  784. "get": {
  785. "summary": "Get current settings (admin only); openai_api_key is masked to a boolean openai_api_key_set",
  786. "operationId": "getSettings",
  787. "responses": {
  788. "200": {
  789. "description": "Settings (with secret masked)",
  790. "content": {
  791. "application/json": {
  792. "schema": {
  793. "type": "object",
  794. "properties": {
  795. "openai_api_base": { "type": "string" },
  796. "openai_api_key_set": { "type": "boolean" },
  797. "default_embedding_model": { "type": "string" },
  798. "cors_origins": { "type": "array", "items": { "type": "string" } },
  799. "session_ttl_minutes": { "type": "integer" },
  800. "webui_enabled": { "type": "boolean" },
  801. "default_project": { "type": "string" }
  802. }
  803. }
  804. }
  805. }
  806. },
  807. "401": { "description": "Unauthorized" },
  808. "403": { "description": "Forbidden — admin required" }
  809. }
  810. },
  811. "put": {
  812. "summary": "Update settings (admin only); omit openai_api_key to keep the existing secret",
  813. "operationId": "updateSettings",
  814. "requestBody": {
  815. "required": true,
  816. "content": {
  817. "application/json": {
  818. "schema": {
  819. "type": "object",
  820. "properties": {
  821. "openai_api_base": { "type": "string" },
  822. "openai_api_key": { "type": "string", "description": "Omit or pass empty string to preserve the existing key" },
  823. "default_embedding_model": { "type": "string" },
  824. "cors_origins": { "type": "array", "items": { "type": "string" } },
  825. "session_ttl_minutes": { "type": "integer", "minimum": 1 },
  826. "webui_enabled": { "type": "boolean" },
  827. "default_project": { "type": "string" }
  828. }
  829. }
  830. }
  831. }
  832. },
  833. "responses": {
  834. "200": { "description": "Settings updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" } } } } } },
  835. "401": { "description": "Unauthorized" },
  836. "403": { "description": "Forbidden — admin required" }
  837. }
  838. }
  839. },
  840. "/api/v1/stats": {
  841. "get": {
  842. "summary": "Server-wide stats (admin only)",
  843. "operationId": "globalStats",
  844. "responses": {
  845. "200": {
  846. "description": "Global stats",
  847. "content": {
  848. "application/json": {
  849. "schema": {
  850. "type": "object",
  851. "properties": {
  852. "projects": { "type": "integer" },
  853. "memory_pressure_level": { "type": "integer" },
  854. "collections": { "type": "integer" },
  855. "documents": { "type": "integer" }
  856. }
  857. }
  858. }
  859. }
  860. },
  861. "401": { "description": "Unauthorized" },
  862. "403": { "description": "Forbidden — admin required" }
  863. }
  864. }
  865. }
  866. }
  867. }