Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

5400 lignes
144KB

  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "Agent Memory API",
  5. "version": "1.0.0-phase3",
  6. "description": "Universal AI Agent Memory platform, phases 1-3: memories with revisions and verification, sessions with checkpoints, Markdown/text document ingestion with chunk locators, lexical search and recall, health. Authenticate with `Authorization: Bearer <api key>`; the tenant is derived from the key. Anything the caller cannot see is reported as 404. Phase 3: POST /context assembles a budgeted task briefing. Retrieval is hybrid (lexical + embeddings via a local Ollama model and a Qdrant index) and degrades to lexical with a warning. Relevance scores are ranking signals: negated bm25 when lexical, reciprocal-rank-fusion values when hybrid. Learning loop: experiences (POST /sessions/{id}/events), candidates proposed with POST /learn and reviewed by another principal (POST /candidates/{id}/review), evidence (GET /memories/{id}/sources) and feedback on retrieval results (POST /feedback, using the query_id of recall/search/context)."
  7. },
  8. "servers": [
  9. {
  10. "url": "/api/v1"
  11. }
  12. ],
  13. "components": {
  14. "securitySchemes": {
  15. "bearerAuth": {
  16. "type": "http",
  17. "scheme": "bearer"
  18. }
  19. },
  20. "schemas": {
  21. "Error": {
  22. "type": "object",
  23. "properties": {
  24. "error": {
  25. "type": "object",
  26. "properties": {
  27. "code": {
  28. "type": "string"
  29. },
  30. "message": {
  31. "type": "string"
  32. },
  33. "details": {
  34. "type": "array",
  35. "items": {
  36. "type": "string"
  37. }
  38. },
  39. "request_id": {
  40. "type": "string"
  41. }
  42. }
  43. }
  44. }
  45. },
  46. "RememberRequest": {
  47. "type": "object",
  48. "required": [
  49. "namespace_id",
  50. "type",
  51. "title",
  52. "content"
  53. ],
  54. "properties": {
  55. "namespace_id": {
  56. "type": "string",
  57. "format": "uuid"
  58. },
  59. "type": {
  60. "type": "string",
  61. "enum": [
  62. "working",
  63. "episodic",
  64. "semantic",
  65. "procedural",
  66. "preference",
  67. "decision",
  68. "constraint",
  69. "lesson",
  70. "hypothesis",
  71. "goal",
  72. "solution"
  73. ]
  74. },
  75. "title": {
  76. "type": "string",
  77. "maxLength": 200
  78. },
  79. "content": {
  80. "type": "string",
  81. "maxLength": 100000
  82. },
  83. "summary": {
  84. "type": "string",
  85. "maxLength": 2000,
  86. "nullable": true
  87. },
  88. "tags": {
  89. "type": "array",
  90. "items": {
  91. "type": "string",
  92. "maxLength": 64
  93. },
  94. "maxItems": 32
  95. },
  96. "attributes": {
  97. "type": "object",
  98. "description": "Free-form JSON object, max 16 KB"
  99. },
  100. "confidence": {
  101. "type": "number",
  102. "minimum": 0,
  103. "maximum": 1
  104. },
  105. "importance": {
  106. "type": "number",
  107. "minimum": 0,
  108. "maximum": 1
  109. }
  110. }
  111. },
  112. "RememberResponse": {
  113. "type": "object",
  114. "properties": {
  115. "id": {
  116. "type": "string",
  117. "format": "uuid"
  118. },
  119. "revision": {
  120. "type": "integer"
  121. },
  122. "status": {
  123. "type": "string"
  124. },
  125. "verification_status": {
  126. "type": "string"
  127. },
  128. "indexing_status": {
  129. "type": "string",
  130. "example": "not_indexed"
  131. },
  132. "duplicate": {
  133. "type": "boolean",
  134. "description": "true when an identical active memory already existed (HTTP 200)"
  135. }
  136. }
  137. },
  138. "Memory": {
  139. "type": "object",
  140. "properties": {
  141. "id": {
  142. "type": "string"
  143. },
  144. "namespace_id": {
  145. "type": "string"
  146. },
  147. "type": {
  148. "type": "string"
  149. },
  150. "status": {
  151. "type": "string",
  152. "enum": [
  153. "active",
  154. "retired",
  155. "superseded"
  156. ]
  157. },
  158. "current_revision": {
  159. "type": "integer"
  160. },
  161. "revision": {
  162. "type": "integer"
  163. },
  164. "verification_status": {
  165. "type": "string",
  166. "enum": [
  167. "unverified",
  168. "verified",
  169. "disputed",
  170. "rejected"
  171. ]
  172. },
  173. "title": {
  174. "type": "string"
  175. },
  176. "summary": {
  177. "type": "string",
  178. "nullable": true
  179. },
  180. "content": {
  181. "type": "string"
  182. },
  183. "attributes": {
  184. "type": "object",
  185. "nullable": true
  186. },
  187. "tags": {
  188. "type": "array",
  189. "items": {
  190. "type": "string"
  191. }
  192. },
  193. "confidence": {
  194. "type": "number",
  195. "nullable": true
  196. },
  197. "importance": {
  198. "type": "number",
  199. "nullable": true
  200. },
  201. "change_reason": {
  202. "type": "string",
  203. "nullable": true
  204. },
  205. "created_by": {
  206. "type": "string"
  207. },
  208. "created_at": {
  209. "type": "string"
  210. },
  211. "updated_at": {
  212. "type": "string"
  213. }
  214. }
  215. },
  216. "IngestRequest": {
  217. "type": "object",
  218. "required": [
  219. "namespace_id",
  220. "content"
  221. ],
  222. "properties": {
  223. "namespace_id": {
  224. "type": "string",
  225. "format": "uuid"
  226. },
  227. "title": {
  228. "type": "string",
  229. "maxLength": 200,
  230. "description": "Optional for html: defaults to the page <title>. Required for markdown and text."
  231. },
  232. "content": {
  233. "type": "string",
  234. "maxLength": 262144
  235. },
  236. "format": {
  237. "type": "string",
  238. "enum": [
  239. "markdown",
  240. "text",
  241. "html"
  242. ],
  243. "default": "markdown",
  244. "description": "markdown (default), text or html. html is converted to Markdown before it is stored (script, style, comments, nav and other invisible content removed; headings, lists, tables and pre kept; entities decoded) and the document is stored with format markdown; the response then has source_format html. Nothing referenced by the page is fetched."
  245. },
  246. "source_uri": {
  247. "type": "string",
  248. "maxLength": 500,
  249. "description": "Identifier only; never fetched. The same source_uri in a namespace is one document."
  250. },
  251. "async": {
  252. "type": "boolean",
  253. "default": false,
  254. "description": "true: store the job and answer 202 at once; the worker processes it (poll GET /jobs/{id}). false: processed inside the request (201 new revision, 200 unchanged)."
  255. }
  256. }
  257. },
  258. "JobQueued": {
  259. "type": "object",
  260. "properties": {
  261. "job": {
  262. "type": "object",
  263. "properties": {
  264. "id": {
  265. "type": "string",
  266. "format": "uuid"
  267. },
  268. "type": {
  269. "type": "string"
  270. },
  271. "state": {
  272. "type": "string",
  273. "enum": [
  274. "queued"
  275. ]
  276. }
  277. }
  278. },
  279. "status_url": {
  280. "type": "string"
  281. }
  282. }
  283. },
  284. "Job": {
  285. "type": "object",
  286. "properties": {
  287. "id": {
  288. "type": "string",
  289. "format": "uuid"
  290. },
  291. "type": {
  292. "type": "string",
  293. "enum": [
  294. "ingest"
  295. ]
  296. },
  297. "state": {
  298. "type": "string",
  299. "enum": [
  300. "queued",
  301. "running",
  302. "succeeded",
  303. "failed"
  304. ]
  305. },
  306. "attempts": {
  307. "type": "integer"
  308. },
  309. "max_attempts": {
  310. "type": "integer"
  311. },
  312. "auto_retry": {
  313. "type": "boolean",
  314. "description": "true when the worker will retry this failed job by itself"
  315. },
  316. "document_id": {
  317. "type": "string",
  318. "nullable": true
  319. },
  320. "error_code": {
  321. "type": "string",
  322. "nullable": true,
  323. "description": "internal_error (retried automatically), invalid_payload, namespace_not_found, forbidden, interrupted"
  324. },
  325. "error_message": {
  326. "type": "string",
  327. "nullable": true
  328. },
  329. "created_at": {
  330. "type": "string"
  331. },
  332. "updated_at": {
  333. "type": "string"
  334. }
  335. }
  336. },
  337. "IngestResponse": {
  338. "type": "object",
  339. "properties": {
  340. "job": {
  341. "type": "object",
  342. "properties": {
  343. "id": {
  344. "type": "string"
  345. },
  346. "type": {
  347. "type": "string"
  348. },
  349. "state": {
  350. "type": "string"
  351. }
  352. }
  353. },
  354. "document_id": {
  355. "type": "string"
  356. },
  357. "revision": {
  358. "type": "integer"
  359. },
  360. "chunk_count": {
  361. "type": "integer"
  362. },
  363. "unchanged": {
  364. "type": "boolean",
  365. "description": "true when identical text was already the current revision (no new chunks)"
  366. },
  367. "indexing_status": {
  368. "type": "string",
  369. "example": "lexical_indexed"
  370. },
  371. "source_format": {
  372. "type": "string",
  373. "enum": [
  374. "html"
  375. ],
  376. "description": "Present when an adapter converted the input"
  377. }
  378. }
  379. },
  380. "SearchRequest": {
  381. "type": "object",
  382. "required": [
  383. "query"
  384. ],
  385. "properties": {
  386. "query": {
  387. "type": "string",
  388. "maxLength": 1000
  389. },
  390. "namespace_ids": {
  391. "type": "array",
  392. "items": {
  393. "type": "string",
  394. "format": "uuid"
  395. }
  396. },
  397. "max_results": {
  398. "type": "integer",
  399. "minimum": 1,
  400. "maximum": 50
  401. },
  402. "detail_level": {
  403. "type": "string",
  404. "enum": [
  405. "full",
  406. "snippet"
  407. ]
  408. }
  409. }
  410. },
  411. "RecallRequest": {
  412. "type": "object",
  413. "required": [
  414. "query"
  415. ],
  416. "properties": {
  417. "query": {
  418. "type": "string",
  419. "maxLength": 1000
  420. },
  421. "namespace_ids": {
  422. "type": "array",
  423. "items": {
  424. "type": "string",
  425. "format": "uuid"
  426. }
  427. },
  428. "types": {
  429. "type": "array",
  430. "items": {
  431. "type": "string"
  432. }
  433. },
  434. "tags": {
  435. "type": "array",
  436. "items": {
  437. "type": "string"
  438. }
  439. },
  440. "max_results": {
  441. "type": "integer"
  442. },
  443. "detail_level": {
  444. "type": "string",
  445. "enum": [
  446. "full",
  447. "summary"
  448. ]
  449. },
  450. "verification_filter": {
  451. "type": "string",
  452. "enum": [
  453. "verified_only",
  454. "include_unverified"
  455. ],
  456. "default": "verified_only"
  457. }
  458. }
  459. },
  460. "VerifyRequest": {
  461. "type": "object",
  462. "required": [
  463. "result",
  464. "method",
  465. "revision"
  466. ],
  467. "properties": {
  468. "result": {
  469. "type": "string",
  470. "enum": [
  471. "verified",
  472. "disputed",
  473. "rejected"
  474. ]
  475. },
  476. "method": {
  477. "type": "string",
  478. "maxLength": 200
  479. },
  480. "notes": {
  481. "type": "string",
  482. "maxLength": 2000
  483. },
  484. "revision": {
  485. "type": "integer",
  486. "description": "Must be the current revision"
  487. }
  488. }
  489. },
  490. "SaveStateRequest": {
  491. "type": "object",
  492. "required": [
  493. "state"
  494. ],
  495. "properties": {
  496. "state": {
  497. "type": "object",
  498. "description": "Structured working state, max 64 KB"
  499. },
  500. "expected_revision": {
  501. "type": "integer"
  502. }
  503. }
  504. },
  505. "ContextRequest": {
  506. "type": "object",
  507. "required": [
  508. "task"
  509. ],
  510. "properties": {
  511. "task": {
  512. "type": "string",
  513. "maxLength": 2000,
  514. "description": "What the agent is about to do; used as the lexical query for decisions, lessons, knowledge and references."
  515. },
  516. "namespace_ids": {
  517. "type": "array",
  518. "items": {
  519. "type": "string"
  520. },
  521. "description": "Restrict to these namespaces (intersected with what the caller can read)."
  522. },
  523. "session_id": {
  524. "type": "string",
  525. "description": "Include the session's latest checkpoint as working_state. 404 when the session is not visible."
  526. },
  527. "include": {
  528. "type": "array",
  529. "items": {
  530. "type": "string",
  531. "enum": [
  532. "constraints",
  533. "preferences",
  534. "decisions",
  535. "lessons",
  536. "knowledge",
  537. "references",
  538. "working_state"
  539. ]
  540. },
  541. "description": "Sections to assemble (default all). Constraints and conflicts are always included."
  542. },
  543. "verification_filter": {
  544. "type": "string",
  545. "enum": [
  546. "verified_only",
  547. "include_unverified"
  548. ],
  549. "default": "verified_only"
  550. },
  551. "detail_level": {
  552. "type": "string",
  553. "enum": [
  554. "full",
  555. "summary"
  556. ],
  557. "default": "full",
  558. "description": "summary returns the stored summary (or first 240 characters); constraints are always full."
  559. },
  560. "max_context_tokens": {
  561. "type": "integer",
  562. "minimum": 100,
  563. "maximum": 32000,
  564. "default": 4000
  565. },
  566. "max_items": {
  567. "type": "integer",
  568. "minimum": 1,
  569. "maximum": 50,
  570. "default": 10,
  571. "description": "Per-section cap for conflicts, decisions, lessons, knowledge and unverified (preferences: 50)."
  572. },
  573. "max_references": {
  574. "type": "integer",
  575. "minimum": 0,
  576. "maximum": 20,
  577. "default": 5
  578. },
  579. "format": {
  580. "type": "string",
  581. "enum": [
  582. "structured"
  583. ],
  584. "default": "structured"
  585. }
  586. },
  587. "example": {
  588. "task": "Implement a customer repository",
  589. "session_id": "<session id>",
  590. "include": [
  591. "constraints",
  592. "decisions",
  593. "preferences",
  594. "lessons",
  595. "references",
  596. "working_state"
  597. ],
  598. "max_context_tokens": 4000
  599. }
  600. },
  601. "ContextResponse": {
  602. "type": "object",
  603. "description": "Sections in budget priority order: constraints (required), working_state, preferences, conflicts, decisions, lessons, knowledge, references, unverified. Memory items carry id, revision, type, namespace_id, title, content|summary, verification_status, content_trust (verified_memory|unverified_memory|disputed_memory), authority (policy for verified constraints), tags, confidence, importance, relevance_score (lexical matches), valid_until, provenance {created_by, updated_at} and token_estimate. References carry chunk/document ids, locator, content and content_trust untrusted_reference.",
  604. "properties": {
  605. "context_id": {
  606. "type": "string"
  607. },
  608. "task": {
  609. "type": "string"
  610. },
  611. "strategy": {
  612. "type": "string",
  613. "enum": [
  614. "hybrid",
  615. "lexical"
  616. ],
  617. "description": "hybrid when semantic retrieval ran for every section; lexical (with a warning) when it is not configured or unavailable"
  618. },
  619. "budget": {
  620. "type": "object",
  621. "properties": {
  622. "max_context_tokens": {
  623. "type": "integer"
  624. },
  625. "used_tokens": {
  626. "type": "integer"
  627. },
  628. "counting_method": {
  629. "type": "string",
  630. "example": "estimate_chars_div_4"
  631. },
  632. "complete": {
  633. "type": "boolean",
  634. "description": "False when not every applicable constraint/preference could be considered; do not treat the briefing as complete."
  635. },
  636. "truncated": {
  637. "type": "boolean",
  638. "description": "True when items were left out to fit the budget."
  639. }
  640. }
  641. },
  642. "omitted": {
  643. "type": "object",
  644. "properties": {
  645. "over_budget": {
  646. "type": "integer"
  647. },
  648. "over_limit": {
  649. "type": "integer"
  650. },
  651. "duplicates": {
  652. "type": "integer"
  653. },
  654. "unverified_excluded": {
  655. "type": "integer"
  656. }
  657. }
  658. },
  659. "constraints": {
  660. "type": "array",
  661. "items": {
  662. "type": "object"
  663. }
  664. },
  665. "working_state": {
  666. "type": "object",
  667. "nullable": true
  668. },
  669. "preferences": {
  670. "type": "array",
  671. "items": {
  672. "type": "object"
  673. }
  674. },
  675. "conflicts": {
  676. "type": "array",
  677. "items": {
  678. "type": "object"
  679. }
  680. },
  681. "decisions": {
  682. "type": "array",
  683. "items": {
  684. "type": "object"
  685. }
  686. },
  687. "lessons": {
  688. "type": "array",
  689. "items": {
  690. "type": "object"
  691. }
  692. },
  693. "knowledge": {
  694. "type": "array",
  695. "items": {
  696. "type": "object"
  697. }
  698. },
  699. "references": {
  700. "type": "array",
  701. "items": {
  702. "type": "object"
  703. }
  704. },
  705. "unverified": {
  706. "type": "array",
  707. "items": {
  708. "type": "object"
  709. },
  710. "description": "Only with verification_filter include_unverified."
  711. },
  712. "warnings": {
  713. "type": "array",
  714. "items": {
  715. "type": "string"
  716. }
  717. },
  718. "query_id": {
  719. "type": "string",
  720. "description": "Pass to POST /feedback to rate an included memory or reference"
  721. }
  722. }
  723. },
  724. "EvidenceInput": {
  725. "type": "object",
  726. "required": [
  727. "kind",
  728. "id"
  729. ],
  730. "properties": {
  731. "kind": {
  732. "type": "string",
  733. "enum": [
  734. "experience",
  735. "chunk",
  736. "memory",
  737. "document"
  738. ]
  739. },
  740. "id": {
  741. "type": "string",
  742. "format": "uuid"
  743. },
  744. "role": {
  745. "type": "string",
  746. "enum": [
  747. "supports",
  748. "contradicts",
  749. "context"
  750. ],
  751. "default": "supports"
  752. },
  753. "excerpt": {
  754. "type": "string",
  755. "maxLength": 2000
  756. }
  757. }
  758. },
  759. "ExperienceRequest": {
  760. "type": "object",
  761. "required": [
  762. "task",
  763. "outcome"
  764. ],
  765. "properties": {
  766. "task": {
  767. "type": "string",
  768. "maxLength": 2000
  769. },
  770. "outcome": {
  771. "type": "string",
  772. "enum": [
  773. "success",
  774. "failure",
  775. "partial",
  776. "unknown"
  777. ]
  778. },
  779. "problem": {
  780. "type": "string",
  781. "maxLength": 4000
  782. },
  783. "action": {
  784. "type": "string",
  785. "maxLength": 4000
  786. },
  787. "result": {
  788. "type": "string",
  789. "maxLength": 4000
  790. },
  791. "environment": {
  792. "type": "object",
  793. "description": "Free-form JSON object, max 16 KB"
  794. }
  795. }
  796. },
  797. "Experience": {
  798. "type": "object",
  799. "properties": {
  800. "id": {
  801. "type": "string"
  802. },
  803. "task": {
  804. "type": "string"
  805. },
  806. "problem": {
  807. "type": "string"
  808. },
  809. "action": {
  810. "type": "string"
  811. },
  812. "result": {
  813. "type": "string"
  814. },
  815. "outcome": {
  816. "type": "string"
  817. },
  818. "recorded_by": {
  819. "type": "string"
  820. },
  821. "created_at": {
  822. "type": "string"
  823. },
  824. "environment": {
  825. "type": "object",
  826. "nullable": true
  827. }
  828. }
  829. },
  830. "LearnRequest": {
  831. "type": "object",
  832. "required": [
  833. "namespace_id",
  834. "type",
  835. "title",
  836. "content"
  837. ],
  838. "properties": {
  839. "namespace_id": {
  840. "type": "string",
  841. "format": "uuid"
  842. },
  843. "type": {
  844. "type": "string"
  845. },
  846. "title": {
  847. "type": "string",
  848. "maxLength": 200
  849. },
  850. "content": {
  851. "type": "string",
  852. "maxLength": 100000
  853. },
  854. "summary": {
  855. "type": "string",
  856. "maxLength": 2000
  857. },
  858. "tags": {
  859. "type": "array",
  860. "items": {
  861. "type": "string"
  862. },
  863. "maxItems": 32
  864. },
  865. "confidence": {
  866. "type": "number",
  867. "minimum": 0,
  868. "maximum": 1
  869. },
  870. "target_memory_id": {
  871. "type": "string",
  872. "format": "uuid",
  873. "description": "Propose a new revision of this memory (same namespace and type)"
  874. },
  875. "base_revision": {
  876. "type": "integer",
  877. "description": "Required with target_memory_id: the revision the proposal is based on"
  878. },
  879. "evidence": {
  880. "type": "array",
  881. "maxItems": 20,
  882. "items": {
  883. "$ref": "#/components/schemas/EvidenceInput"
  884. }
  885. }
  886. }
  887. },
  888. "Candidate": {
  889. "type": "object",
  890. "properties": {
  891. "id": {
  892. "type": "string"
  893. },
  894. "namespace_id": {
  895. "type": "string"
  896. },
  897. "type": {
  898. "type": "string"
  899. },
  900. "title": {
  901. "type": "string"
  902. },
  903. "summary": {
  904. "type": "string",
  905. "nullable": true
  906. },
  907. "content": {
  908. "type": "string",
  909. "description": "Detail only"
  910. },
  911. "tags": {
  912. "type": "array",
  913. "items": {
  914. "type": "string"
  915. }
  916. },
  917. "confidence": {
  918. "type": "number",
  919. "nullable": true
  920. },
  921. "target_memory_id": {
  922. "type": "string",
  923. "nullable": true
  924. },
  925. "base_revision": {
  926. "type": "integer",
  927. "nullable": true
  928. },
  929. "state": {
  930. "type": "string",
  931. "enum": [
  932. "proposed",
  933. "accepted",
  934. "rejected"
  935. ]
  936. },
  937. "author": {
  938. "type": "string"
  939. },
  940. "reviewer": {
  941. "type": "string",
  942. "nullable": true
  943. },
  944. "review_notes": {
  945. "type": "string",
  946. "nullable": true
  947. },
  948. "resulting_memory_id": {
  949. "type": "string",
  950. "nullable": true
  951. },
  952. "resulting_revision": {
  953. "type": "integer",
  954. "nullable": true
  955. },
  956. "created_at": {
  957. "type": "string"
  958. },
  959. "reviewed_at": {
  960. "type": "string",
  961. "nullable": true
  962. },
  963. "content_trust": {
  964. "type": "string",
  965. "enum": [
  966. "proposed_knowledge"
  967. ]
  968. },
  969. "evidence": {
  970. "type": "array",
  971. "items": {
  972. "$ref": "#/components/schemas/EvidenceItem"
  973. },
  974. "description": "Detail only"
  975. }
  976. }
  977. },
  978. "EvidenceItem": {
  979. "type": "object",
  980. "properties": {
  981. "kind": {
  982. "type": "string"
  983. },
  984. "id": {
  985. "type": "string",
  986. "description": "Omitted when available is false"
  987. },
  988. "revision": {
  989. "type": "integer",
  990. "nullable": true,
  991. "description": "Target revision pinned when the link was made"
  992. },
  993. "available": {
  994. "type": "boolean",
  995. "description": "False when the target is gone or the caller cannot read it"
  996. },
  997. "role": {
  998. "type": "string"
  999. },
  1000. "excerpt": {
  1001. "type": "string",
  1002. "nullable": true
  1003. },
  1004. "content_trust": {
  1005. "type": "string",
  1006. "enum": [
  1007. "evidence",
  1008. "untrusted_reference"
  1009. ]
  1010. }
  1011. }
  1012. },
  1013. "ReviewRequest": {
  1014. "type": "object",
  1015. "required": [
  1016. "decision"
  1017. ],
  1018. "properties": {
  1019. "decision": {
  1020. "type": "string",
  1021. "enum": [
  1022. "accept",
  1023. "reject"
  1024. ]
  1025. },
  1026. "notes": {
  1027. "type": "string",
  1028. "maxLength": 2000
  1029. },
  1030. "verify": {
  1031. "type": "boolean",
  1032. "default": false,
  1033. "description": "Accept as verified (records a verification by the reviewer)"
  1034. }
  1035. }
  1036. },
  1037. "Sources": {
  1038. "type": "object",
  1039. "properties": {
  1040. "memory_id": {
  1041. "type": "string"
  1042. },
  1043. "revision": {
  1044. "type": "integer"
  1045. },
  1046. "current_revision": {
  1047. "type": "integer"
  1048. },
  1049. "from_candidate": {
  1050. "type": "string",
  1051. "nullable": true
  1052. },
  1053. "evidence": {
  1054. "type": "array",
  1055. "items": {
  1056. "$ref": "#/components/schemas/EvidenceItem"
  1057. }
  1058. },
  1059. "verifications": {
  1060. "type": "array",
  1061. "items": {
  1062. "type": "object",
  1063. "properties": {
  1064. "method": {
  1065. "type": "string"
  1066. },
  1067. "result": {
  1068. "type": "string"
  1069. },
  1070. "notes": {
  1071. "type": "string"
  1072. },
  1073. "reviewer": {
  1074. "type": "string"
  1075. },
  1076. "created_at": {
  1077. "type": "string"
  1078. }
  1079. }
  1080. }
  1081. }
  1082. }
  1083. },
  1084. "FeedbackRequest": {
  1085. "type": "object",
  1086. "required": [
  1087. "query_id",
  1088. "result_id",
  1089. "usefulness"
  1090. ],
  1091. "properties": {
  1092. "query_id": {
  1093. "type": "string",
  1094. "description": "query_id returned by recall, search or context"
  1095. },
  1096. "result_id": {
  1097. "type": "string",
  1098. "format": "uuid",
  1099. "description": "Memory id or chunk id from that response"
  1100. },
  1101. "usefulness": {
  1102. "type": "string",
  1103. "enum": [
  1104. "useful",
  1105. "not_useful",
  1106. "incorrect",
  1107. "harmful"
  1108. ]
  1109. },
  1110. "comment": {
  1111. "type": "string",
  1112. "maxLength": 2000
  1113. }
  1114. }
  1115. },
  1116. "Feedback": {
  1117. "type": "object",
  1118. "properties": {
  1119. "id": {
  1120. "type": "string"
  1121. },
  1122. "query_id": {
  1123. "type": "string"
  1124. },
  1125. "target_kind": {
  1126. "type": "string",
  1127. "enum": [
  1128. "memory",
  1129. "chunk"
  1130. ]
  1131. },
  1132. "target_id": {
  1133. "type": "string"
  1134. },
  1135. "target_revision": {
  1136. "type": "integer"
  1137. },
  1138. "usefulness": {
  1139. "type": "string"
  1140. }
  1141. }
  1142. },
  1143. "ExportRequest": {
  1144. "type": "object",
  1145. "properties": {
  1146. "namespace_ids": {
  1147. "type": "array",
  1148. "items": {
  1149. "type": "string",
  1150. "format": "uuid"
  1151. },
  1152. "description": "Limit the export to these namespaces (unreadable ones are skipped silently). Default: all readable namespaces."
  1153. }
  1154. }
  1155. },
  1156. "Export": {
  1157. "type": "object",
  1158. "required": [
  1159. "format",
  1160. "schema_version",
  1161. "data",
  1162. "integrity"
  1163. ],
  1164. "properties": {
  1165. "format": {
  1166. "type": "string",
  1167. "enum": [
  1168. "agent-memory-export"
  1169. ]
  1170. },
  1171. "schema_version": {
  1172. "type": "integer",
  1173. "enum": [
  1174. 1
  1175. ]
  1176. },
  1177. "exported_at": {
  1178. "type": "string"
  1179. },
  1180. "data": {
  1181. "type": "object",
  1182. "description": "namespaces [{path}], memories [{id, namespace, type, lifecycle_status, valid_from, valid_until, created_by, created_at, updated_at, current_revision, revisions[], verifications[]}], documents [{id, namespace, source_uri, format, title, current_revision, created_by, created_at, updated_at, revisions[{..., chunks[]}]}], evidence_links [{id, owner_kind, owner_id, owner_revision, target_kind, target_id, target_revision, role, excerpt, created_by, created_at}]. Not in version 1: sessions, experiences, candidates, feedback, retrieval telemetry, audit events.",
  1183. "properties": {
  1184. "namespaces": {
  1185. "type": "array",
  1186. "items": {
  1187. "type": "object"
  1188. }
  1189. },
  1190. "memories": {
  1191. "type": "array",
  1192. "items": {
  1193. "type": "object"
  1194. }
  1195. },
  1196. "documents": {
  1197. "type": "array",
  1198. "items": {
  1199. "type": "object"
  1200. }
  1201. },
  1202. "evidence_links": {
  1203. "type": "array",
  1204. "items": {
  1205. "type": "object"
  1206. }
  1207. }
  1208. }
  1209. },
  1210. "counts": {
  1211. "type": "object",
  1212. "additionalProperties": {
  1213. "type": "integer"
  1214. },
  1215. "description": "namespaces, memories, memory_revisions, verifications, documents, document_revisions, chunks, evidence_links, evidence_links_omitted"
  1216. },
  1217. "integrity": {
  1218. "type": "object",
  1219. "properties": {
  1220. "algorithm": {
  1221. "type": "string",
  1222. "enum": [
  1223. "sha256"
  1224. ]
  1225. },
  1226. "digest": {
  1227. "type": "string",
  1228. "description": "Hex SHA-256 of the exact UTF-8 text of the data value as it appears in the document; any reformatting breaks it."
  1229. }
  1230. }
  1231. }
  1232. }
  1233. },
  1234. "ImportResult": {
  1235. "type": "object",
  1236. "properties": {
  1237. "imported": {
  1238. "type": "object",
  1239. "additionalProperties": {
  1240. "type": "integer"
  1241. },
  1242. "description": "namespaces, memories, memory_revisions, verifications, documents, document_revisions, chunks, evidence_links, placeholder_principals (author ids unknown to this installation, created without keys or grants)"
  1243. },
  1244. "indexing": {
  1245. "type": "object",
  1246. "properties": {
  1247. "lexical": {
  1248. "type": "string"
  1249. },
  1250. "semantic": {
  1251. "type": "string"
  1252. }
  1253. }
  1254. }
  1255. }
  1256. },
  1257. "Grant": {
  1258. "type": "object",
  1259. "properties": {
  1260. "id": {
  1261. "type": "string",
  1262. "format": "uuid"
  1263. },
  1264. "principal_id": {
  1265. "type": "string",
  1266. "format": "uuid"
  1267. },
  1268. "namespace_id": {
  1269. "type": "string",
  1270. "format": "uuid"
  1271. },
  1272. "path": {
  1273. "type": "string"
  1274. },
  1275. "permissions": {
  1276. "type": "array",
  1277. "items": {
  1278. "type": "string",
  1279. "enum": [
  1280. "read",
  1281. "write",
  1282. "delete",
  1283. "verify",
  1284. "admin"
  1285. ]
  1286. }
  1287. },
  1288. "inherit": {
  1289. "type": "boolean"
  1290. },
  1291. "expires_at": {
  1292. "type": "string",
  1293. "nullable": true
  1294. },
  1295. "created_at": {
  1296. "type": "string",
  1297. "example": "2026-12-05 18:00:00"
  1298. }
  1299. }
  1300. },
  1301. "Me": {
  1302. "type": "object",
  1303. "properties": {
  1304. "principal_id": {
  1305. "type": "string",
  1306. "format": "uuid"
  1307. },
  1308. "tenant_id": {
  1309. "type": "string",
  1310. "format": "uuid"
  1311. },
  1312. "name": {
  1313. "type": "string"
  1314. },
  1315. "type": {
  1316. "type": "string"
  1317. },
  1318. "grants": {
  1319. "type": "array",
  1320. "items": {
  1321. "$ref": "#/components/schemas/Grant"
  1322. }
  1323. }
  1324. }
  1325. },
  1326. "Namespace": {
  1327. "type": "object",
  1328. "properties": {
  1329. "id": {
  1330. "type": "string",
  1331. "format": "uuid"
  1332. },
  1333. "path": {
  1334. "type": "string"
  1335. },
  1336. "parent_id": {
  1337. "type": "string",
  1338. "nullable": true
  1339. },
  1340. "permissions": {
  1341. "type": "array",
  1342. "items": {
  1343. "type": "string",
  1344. "enum": [
  1345. "read",
  1346. "write",
  1347. "delete",
  1348. "verify",
  1349. "admin"
  1350. ]
  1351. }
  1352. },
  1353. "created_at": {
  1354. "type": "string",
  1355. "example": "2026-12-05 18:00:00"
  1356. }
  1357. }
  1358. },
  1359. "NamespaceRequest": {
  1360. "type": "object",
  1361. "required": [
  1362. "path"
  1363. ],
  1364. "properties": {
  1365. "path": {
  1366. "type": "string",
  1367. "example": "/team/project-x",
  1368. "description": "Lower-case a-z, 0-9, '-', '_' and '.' segments separated by '/' (upper case is folded)."
  1369. }
  1370. }
  1371. },
  1372. "NamespaceCreated": {
  1373. "type": "object",
  1374. "properties": {
  1375. "id": {
  1376. "type": "string",
  1377. "format": "uuid"
  1378. },
  1379. "path": {
  1380. "type": "string"
  1381. },
  1382. "parent_id": {
  1383. "type": "string",
  1384. "nullable": true
  1385. },
  1386. "namespaces_created": {
  1387. "type": "integer",
  1388. "description": "1 plus the number of missing parents created"
  1389. }
  1390. }
  1391. },
  1392. "Principal": {
  1393. "type": "object",
  1394. "properties": {
  1395. "id": {
  1396. "type": "string",
  1397. "format": "uuid"
  1398. },
  1399. "name": {
  1400. "type": "string"
  1401. },
  1402. "type": {
  1403. "type": "string",
  1404. "enum": [
  1405. "human",
  1406. "agent",
  1407. "service"
  1408. ]
  1409. },
  1410. "status": {
  1411. "type": "string",
  1412. "enum": [
  1413. "active",
  1414. "disabled",
  1415. "imported"
  1416. ]
  1417. },
  1418. "created_at": {
  1419. "type": "string",
  1420. "example": "2026-12-05 18:00:00"
  1421. }
  1422. }
  1423. },
  1424. "PrincipalRequest": {
  1425. "type": "object",
  1426. "required": [
  1427. "name",
  1428. "type"
  1429. ],
  1430. "properties": {
  1431. "name": {
  1432. "type": "string",
  1433. "maxLength": 200
  1434. },
  1435. "type": {
  1436. "type": "string",
  1437. "enum": [
  1438. "human",
  1439. "agent",
  1440. "service"
  1441. ]
  1442. }
  1443. }
  1444. },
  1445. "PrincipalUpdate": {
  1446. "type": "object",
  1447. "required": [
  1448. "status"
  1449. ],
  1450. "properties": {
  1451. "status": {
  1452. "type": "string",
  1453. "enum": [
  1454. "active",
  1455. "disabled"
  1456. ]
  1457. }
  1458. }
  1459. },
  1460. "ApiKeyCreated": {
  1461. "type": "object",
  1462. "properties": {
  1463. "id": {
  1464. "type": "string",
  1465. "format": "uuid"
  1466. },
  1467. "key": {
  1468. "type": "string",
  1469. "description": "The secret, shown only in this response"
  1470. },
  1471. "prefix": {
  1472. "type": "string"
  1473. },
  1474. "created_at": {
  1475. "type": "string",
  1476. "example": "2026-12-05 18:00:00"
  1477. },
  1478. "note": {
  1479. "type": "string"
  1480. }
  1481. }
  1482. },
  1483. "PrincipalCreated": {
  1484. "type": "object",
  1485. "properties": {
  1486. "principal": {
  1487. "$ref": "#/components/schemas/Principal"
  1488. },
  1489. "api_key": {
  1490. "$ref": "#/components/schemas/ApiKeyCreated"
  1491. }
  1492. }
  1493. },
  1494. "KeyCreated": {
  1495. "type": "object",
  1496. "properties": {
  1497. "principal_id": {
  1498. "type": "string",
  1499. "format": "uuid"
  1500. },
  1501. "api_key": {
  1502. "$ref": "#/components/schemas/ApiKeyCreated"
  1503. }
  1504. }
  1505. },
  1506. "PrincipalDetail": {
  1507. "allOf": [
  1508. {
  1509. "$ref": "#/components/schemas/Principal"
  1510. },
  1511. {
  1512. "type": "object",
  1513. "properties": {
  1514. "keys": {
  1515. "type": "array",
  1516. "nullable": true,
  1517. "description": "null when the caller may not manage this principal",
  1518. "items": {
  1519. "type": "object",
  1520. "properties": {
  1521. "id": {
  1522. "type": "string",
  1523. "format": "uuid"
  1524. },
  1525. "prefix": {
  1526. "type": "string"
  1527. },
  1528. "status": {
  1529. "type": "string"
  1530. },
  1531. "created_at": {
  1532. "type": "string",
  1533. "example": "2026-12-05 18:00:00"
  1534. },
  1535. "expires_at": {
  1536. "type": "string",
  1537. "nullable": true
  1538. },
  1539. "last_used_at": {
  1540. "type": "string",
  1541. "nullable": true
  1542. }
  1543. }
  1544. }
  1545. },
  1546. "grants": {
  1547. "type": "array",
  1548. "items": {
  1549. "$ref": "#/components/schemas/Grant"
  1550. }
  1551. }
  1552. }
  1553. }
  1554. ]
  1555. },
  1556. "GrantRequest": {
  1557. "type": "object",
  1558. "required": [
  1559. "principal_id",
  1560. "namespace_id",
  1561. "permissions"
  1562. ],
  1563. "properties": {
  1564. "principal_id": {
  1565. "type": "string",
  1566. "format": "uuid"
  1567. },
  1568. "namespace_id": {
  1569. "type": "string",
  1570. "format": "uuid"
  1571. },
  1572. "permissions": {
  1573. "type": "array",
  1574. "items": {
  1575. "type": "string",
  1576. "enum": [
  1577. "read",
  1578. "write",
  1579. "delete",
  1580. "verify",
  1581. "admin"
  1582. ]
  1583. }
  1584. },
  1585. "inherit": {
  1586. "type": "boolean",
  1587. "default": true
  1588. },
  1589. "expires_at": {
  1590. "type": "string",
  1591. "description": "UTC, YYYY-MM-DD HH:MM:SS, in the future"
  1592. }
  1593. }
  1594. },
  1595. "ConsolidationRequest": {
  1596. "type": "object",
  1597. "required": [
  1598. "namespace_id"
  1599. ],
  1600. "properties": {
  1601. "namespace_id": {
  1602. "type": "string",
  1603. "format": "uuid",
  1604. "description": "Experiences of this namespace only (not its descendants)"
  1605. },
  1606. "since": {
  1607. "type": "string",
  1608. "example": "2026-12-01",
  1609. "description": "Only experiences recorded at or after this UTC date/time"
  1610. },
  1611. "min_size": {
  1612. "type": "integer",
  1613. "minimum": 2,
  1614. "maximum": 50,
  1615. "default": 2
  1616. },
  1617. "similarity": {
  1618. "type": "number",
  1619. "minimum": 0.1,
  1620. "maximum": 0.95,
  1621. "default": 0.35,
  1622. "description": "Jaccard threshold over significant words; pairs must also share at least 2 words"
  1623. },
  1624. "max_experiences": {
  1625. "type": "integer",
  1626. "minimum": 10,
  1627. "maximum": 500,
  1628. "default": 300,
  1629. "description": "Most recent experiences considered"
  1630. },
  1631. "propose": {
  1632. "type": "boolean",
  1633. "default": false
  1634. }
  1635. }
  1636. },
  1637. "ConsolidationResult": {
  1638. "type": "object",
  1639. "properties": {
  1640. "namespace_id": {
  1641. "type": "string"
  1642. },
  1643. "experiences_considered": {
  1644. "type": "integer"
  1645. },
  1646. "similarity": {
  1647. "type": "number"
  1648. },
  1649. "min_size": {
  1650. "type": "integer"
  1651. },
  1652. "candidates_created": {
  1653. "type": "integer"
  1654. },
  1655. "groups": {
  1656. "type": "array",
  1657. "items": {
  1658. "type": "object",
  1659. "properties": {
  1660. "size": {
  1661. "type": "integer"
  1662. },
  1663. "sessions": {
  1664. "type": "integer"
  1665. },
  1666. "outcomes": {
  1667. "type": "object",
  1668. "properties": {
  1669. "success": {
  1670. "type": "integer"
  1671. },
  1672. "failure": {
  1673. "type": "integer"
  1674. },
  1675. "partial": {
  1676. "type": "integer"
  1677. },
  1678. "unknown": {
  1679. "type": "integer"
  1680. }
  1681. }
  1682. },
  1683. "first_seen": {
  1684. "type": "string"
  1685. },
  1686. "last_seen": {
  1687. "type": "string"
  1688. },
  1689. "terms": {
  1690. "type": "array",
  1691. "items": {
  1692. "type": "string"
  1693. }
  1694. },
  1695. "experience_ids": {
  1696. "type": "array",
  1697. "items": {
  1698. "type": "string"
  1699. },
  1700. "description": "Newest first"
  1701. },
  1702. "already_cited": {
  1703. "type": "integer",
  1704. "description": "Members already cited as evidence by a candidate"
  1705. },
  1706. "draft": {
  1707. "type": "object",
  1708. "properties": {
  1709. "type": {
  1710. "type": "string",
  1711. "enum": [
  1712. "lesson",
  1713. "solution"
  1714. ]
  1715. },
  1716. "title": {
  1717. "type": "string"
  1718. },
  1719. "content": {
  1720. "type": "string"
  1721. }
  1722. }
  1723. },
  1724. "candidate_id": {
  1725. "type": "string",
  1726. "nullable": true
  1727. }
  1728. }
  1729. }
  1730. }
  1731. }
  1732. }
  1733. }
  1734. },
  1735. "paths": {
  1736. "/remember": {
  1737. "post": {
  1738. "summary": "Create a memory",
  1739. "security": [
  1740. {
  1741. "bearerAuth": []
  1742. }
  1743. ],
  1744. "parameters": [
  1745. {
  1746. "name": "Idempotency-Key",
  1747. "in": "header",
  1748. "required": false,
  1749. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  1750. "schema": {
  1751. "type": "string",
  1752. "maxLength": 200
  1753. }
  1754. }
  1755. ],
  1756. "requestBody": {
  1757. "required": true,
  1758. "content": {
  1759. "application/json": {
  1760. "schema": {
  1761. "$ref": "#/components/schemas/RememberRequest"
  1762. }
  1763. }
  1764. }
  1765. },
  1766. "responses": {
  1767. "201": {
  1768. "description": "Created",
  1769. "content": {
  1770. "application/json": {
  1771. "schema": {
  1772. "$ref": "#/components/schemas/RememberResponse"
  1773. }
  1774. }
  1775. }
  1776. },
  1777. "200": {
  1778. "description": "Exact duplicate (or idempotent replay of a 200)",
  1779. "content": {
  1780. "application/json": {
  1781. "schema": {
  1782. "$ref": "#/components/schemas/RememberResponse"
  1783. }
  1784. }
  1785. }
  1786. },
  1787. "400": {
  1788. "description": "Invalid JSON / body",
  1789. "content": {
  1790. "application/json": {
  1791. "schema": {
  1792. "$ref": "#/components/schemas/Error"
  1793. }
  1794. }
  1795. }
  1796. },
  1797. "409": {
  1798. "description": "Idempotency-Key reused with a different body",
  1799. "content": {
  1800. "application/json": {
  1801. "schema": {
  1802. "$ref": "#/components/schemas/Error"
  1803. }
  1804. }
  1805. }
  1806. },
  1807. "422": {
  1808. "description": "Validation failed",
  1809. "content": {
  1810. "application/json": {
  1811. "schema": {
  1812. "$ref": "#/components/schemas/Error"
  1813. }
  1814. }
  1815. }
  1816. },
  1817. "401": {
  1818. "description": "Missing, invalid, revoked or expired API key",
  1819. "content": {
  1820. "application/json": {
  1821. "schema": {
  1822. "$ref": "#/components/schemas/Error"
  1823. }
  1824. }
  1825. }
  1826. },
  1827. "404": {
  1828. "description": "Not found or not visible to the caller",
  1829. "content": {
  1830. "application/json": {
  1831. "schema": {
  1832. "$ref": "#/components/schemas/Error"
  1833. }
  1834. }
  1835. }
  1836. },
  1837. "500": {
  1838. "description": "Internal error",
  1839. "content": {
  1840. "application/json": {
  1841. "schema": {
  1842. "$ref": "#/components/schemas/Error"
  1843. }
  1844. }
  1845. }
  1846. }
  1847. }
  1848. }
  1849. },
  1850. "/memories": {
  1851. "get": {
  1852. "summary": "List memories (newest first)",
  1853. "security": [
  1854. {
  1855. "bearerAuth": []
  1856. }
  1857. ],
  1858. "parameters": [
  1859. {
  1860. "name": "namespace_id",
  1861. "in": "query",
  1862. "schema": {
  1863. "type": "string",
  1864. "format": "uuid"
  1865. }
  1866. },
  1867. {
  1868. "name": "type",
  1869. "in": "query",
  1870. "schema": {
  1871. "type": "string"
  1872. }
  1873. },
  1874. {
  1875. "name": "status",
  1876. "in": "query",
  1877. "schema": {
  1878. "type": "string",
  1879. "enum": [
  1880. "active",
  1881. "retired",
  1882. "superseded",
  1883. "all"
  1884. ],
  1885. "default": "active"
  1886. }
  1887. },
  1888. {
  1889. "name": "verification_status",
  1890. "in": "query",
  1891. "schema": {
  1892. "type": "string",
  1893. "enum": [
  1894. "unverified",
  1895. "verified",
  1896. "disputed",
  1897. "rejected"
  1898. ]
  1899. }
  1900. },
  1901. {
  1902. "name": "limit",
  1903. "in": "query",
  1904. "schema": {
  1905. "type": "integer",
  1906. "minimum": 1,
  1907. "maximum": 100,
  1908. "default": 20
  1909. }
  1910. },
  1911. {
  1912. "name": "cursor",
  1913. "in": "query",
  1914. "description": "next_cursor from the previous page",
  1915. "schema": {
  1916. "type": "string"
  1917. }
  1918. }
  1919. ],
  1920. "responses": {
  1921. "200": {
  1922. "description": "Page of memories",
  1923. "content": {
  1924. "application/json": {
  1925. "schema": {
  1926. "type": "object",
  1927. "properties": {
  1928. "data": {
  1929. "type": "array",
  1930. "items": {
  1931. "$ref": "#/components/schemas/Memory"
  1932. }
  1933. },
  1934. "next_cursor": {
  1935. "type": "string",
  1936. "nullable": true
  1937. }
  1938. }
  1939. }
  1940. }
  1941. }
  1942. },
  1943. "400": {
  1944. "description": "Invalid cursor",
  1945. "content": {
  1946. "application/json": {
  1947. "schema": {
  1948. "$ref": "#/components/schemas/Error"
  1949. }
  1950. }
  1951. }
  1952. },
  1953. "422": {
  1954. "description": "Invalid filter",
  1955. "content": {
  1956. "application/json": {
  1957. "schema": {
  1958. "$ref": "#/components/schemas/Error"
  1959. }
  1960. }
  1961. }
  1962. },
  1963. "401": {
  1964. "description": "Missing, invalid, revoked or expired API key",
  1965. "content": {
  1966. "application/json": {
  1967. "schema": {
  1968. "$ref": "#/components/schemas/Error"
  1969. }
  1970. }
  1971. }
  1972. },
  1973. "404": {
  1974. "description": "Not found or not visible to the caller",
  1975. "content": {
  1976. "application/json": {
  1977. "schema": {
  1978. "$ref": "#/components/schemas/Error"
  1979. }
  1980. }
  1981. }
  1982. },
  1983. "500": {
  1984. "description": "Internal error",
  1985. "content": {
  1986. "application/json": {
  1987. "schema": {
  1988. "$ref": "#/components/schemas/Error"
  1989. }
  1990. }
  1991. }
  1992. }
  1993. }
  1994. }
  1995. },
  1996. "/memories/{id}": {
  1997. "get": {
  1998. "summary": "Get a memory (optionally an older revision)",
  1999. "security": [
  2000. {
  2001. "bearerAuth": []
  2002. }
  2003. ],
  2004. "parameters": [
  2005. {
  2006. "name": "id",
  2007. "in": "path",
  2008. "required": true,
  2009. "schema": {
  2010. "type": "string",
  2011. "format": "uuid"
  2012. }
  2013. },
  2014. {
  2015. "name": "revision",
  2016. "in": "query",
  2017. "schema": {
  2018. "type": "integer"
  2019. }
  2020. }
  2021. ],
  2022. "responses": {
  2023. "200": {
  2024. "description": "The memory",
  2025. "content": {
  2026. "application/json": {
  2027. "schema": {
  2028. "type": "object",
  2029. "properties": {
  2030. "data": {
  2031. "$ref": "#/components/schemas/Memory"
  2032. }
  2033. }
  2034. }
  2035. }
  2036. }
  2037. },
  2038. "401": {
  2039. "description": "Missing, invalid, revoked or expired API key",
  2040. "content": {
  2041. "application/json": {
  2042. "schema": {
  2043. "$ref": "#/components/schemas/Error"
  2044. }
  2045. }
  2046. }
  2047. },
  2048. "404": {
  2049. "description": "Not found or not visible to the caller",
  2050. "content": {
  2051. "application/json": {
  2052. "schema": {
  2053. "$ref": "#/components/schemas/Error"
  2054. }
  2055. }
  2056. }
  2057. },
  2058. "500": {
  2059. "description": "Internal error",
  2060. "content": {
  2061. "application/json": {
  2062. "schema": {
  2063. "$ref": "#/components/schemas/Error"
  2064. }
  2065. }
  2066. }
  2067. }
  2068. }
  2069. },
  2070. "patch": {
  2071. "summary": "Correct a memory: creates the next revision, unverified",
  2072. "security": [
  2073. {
  2074. "bearerAuth": []
  2075. }
  2076. ],
  2077. "parameters": [
  2078. {
  2079. "name": "id",
  2080. "in": "path",
  2081. "required": true,
  2082. "schema": {
  2083. "type": "string",
  2084. "format": "uuid"
  2085. }
  2086. },
  2087. {
  2088. "name": "If-Match",
  2089. "in": "header",
  2090. "required": false,
  2091. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  2092. "schema": {
  2093. "type": "string"
  2094. }
  2095. }
  2096. ],
  2097. "requestBody": {
  2098. "required": true,
  2099. "content": {
  2100. "application/json": {
  2101. "schema": {
  2102. "type": "object",
  2103. "properties": {
  2104. "title": {
  2105. "type": "string"
  2106. },
  2107. "summary": {
  2108. "type": "string"
  2109. },
  2110. "content": {
  2111. "type": "string"
  2112. },
  2113. "tags": {
  2114. "type": "array",
  2115. "items": {
  2116. "type": "string"
  2117. }
  2118. },
  2119. "attributes": {
  2120. "type": "object"
  2121. },
  2122. "confidence": {
  2123. "type": "number"
  2124. },
  2125. "importance": {
  2126. "type": "number"
  2127. },
  2128. "change_reason": {
  2129. "type": "string"
  2130. },
  2131. "expected_revision": {
  2132. "type": "integer"
  2133. }
  2134. }
  2135. }
  2136. }
  2137. }
  2138. },
  2139. "responses": {
  2140. "200": {
  2141. "description": "New revision",
  2142. "content": {
  2143. "application/json": {
  2144. "schema": {
  2145. "$ref": "#/components/schemas/RememberResponse"
  2146. }
  2147. }
  2148. }
  2149. },
  2150. "400": {
  2151. "description": "Bad body / revision",
  2152. "content": {
  2153. "application/json": {
  2154. "schema": {
  2155. "$ref": "#/components/schemas/Error"
  2156. }
  2157. }
  2158. }
  2159. },
  2160. "409": {
  2161. "description": "Memory is not active",
  2162. "content": {
  2163. "application/json": {
  2164. "schema": {
  2165. "$ref": "#/components/schemas/Error"
  2166. }
  2167. }
  2168. }
  2169. },
  2170. "412": {
  2171. "description": "Stale revision (ETag header carries the current one)",
  2172. "content": {
  2173. "application/json": {
  2174. "schema": {
  2175. "$ref": "#/components/schemas/Error"
  2176. }
  2177. }
  2178. }
  2179. },
  2180. "422": {
  2181. "description": "Validation failed",
  2182. "content": {
  2183. "application/json": {
  2184. "schema": {
  2185. "$ref": "#/components/schemas/Error"
  2186. }
  2187. }
  2188. }
  2189. },
  2190. "428": {
  2191. "description": "If-Match missing",
  2192. "content": {
  2193. "application/json": {
  2194. "schema": {
  2195. "$ref": "#/components/schemas/Error"
  2196. }
  2197. }
  2198. }
  2199. },
  2200. "401": {
  2201. "description": "Missing, invalid, revoked or expired API key",
  2202. "content": {
  2203. "application/json": {
  2204. "schema": {
  2205. "$ref": "#/components/schemas/Error"
  2206. }
  2207. }
  2208. }
  2209. },
  2210. "404": {
  2211. "description": "Not found or not visible to the caller",
  2212. "content": {
  2213. "application/json": {
  2214. "schema": {
  2215. "$ref": "#/components/schemas/Error"
  2216. }
  2217. }
  2218. }
  2219. },
  2220. "500": {
  2221. "description": "Internal error",
  2222. "content": {
  2223. "application/json": {
  2224. "schema": {
  2225. "$ref": "#/components/schemas/Error"
  2226. }
  2227. }
  2228. }
  2229. }
  2230. }
  2231. },
  2232. "delete": {
  2233. "summary": "Forget: permanently delete the memory and its revisions (needs delete permission)",
  2234. "security": [
  2235. {
  2236. "bearerAuth": []
  2237. }
  2238. ],
  2239. "parameters": [
  2240. {
  2241. "name": "id",
  2242. "in": "path",
  2243. "required": true,
  2244. "schema": {
  2245. "type": "string",
  2246. "format": "uuid"
  2247. }
  2248. }
  2249. ],
  2250. "responses": {
  2251. "200": {
  2252. "description": "Deleted"
  2253. },
  2254. "401": {
  2255. "description": "Missing, invalid, revoked or expired API key",
  2256. "content": {
  2257. "application/json": {
  2258. "schema": {
  2259. "$ref": "#/components/schemas/Error"
  2260. }
  2261. }
  2262. }
  2263. },
  2264. "404": {
  2265. "description": "Not found or not visible to the caller",
  2266. "content": {
  2267. "application/json": {
  2268. "schema": {
  2269. "$ref": "#/components/schemas/Error"
  2270. }
  2271. }
  2272. }
  2273. },
  2274. "500": {
  2275. "description": "Internal error",
  2276. "content": {
  2277. "application/json": {
  2278. "schema": {
  2279. "$ref": "#/components/schemas/Error"
  2280. }
  2281. }
  2282. }
  2283. }
  2284. }
  2285. }
  2286. },
  2287. "/memories/{id}/retire": {
  2288. "post": {
  2289. "summary": "Retire: exclude from ordinary listing",
  2290. "security": [
  2291. {
  2292. "bearerAuth": []
  2293. }
  2294. ],
  2295. "parameters": [
  2296. {
  2297. "name": "id",
  2298. "in": "path",
  2299. "required": true,
  2300. "schema": {
  2301. "type": "string",
  2302. "format": "uuid"
  2303. }
  2304. }
  2305. ],
  2306. "responses": {
  2307. "200": {
  2308. "description": "Retired"
  2309. },
  2310. "401": {
  2311. "description": "Missing, invalid, revoked or expired API key",
  2312. "content": {
  2313. "application/json": {
  2314. "schema": {
  2315. "$ref": "#/components/schemas/Error"
  2316. }
  2317. }
  2318. }
  2319. },
  2320. "404": {
  2321. "description": "Not found or not visible to the caller",
  2322. "content": {
  2323. "application/json": {
  2324. "schema": {
  2325. "$ref": "#/components/schemas/Error"
  2326. }
  2327. }
  2328. }
  2329. },
  2330. "500": {
  2331. "description": "Internal error",
  2332. "content": {
  2333. "application/json": {
  2334. "schema": {
  2335. "$ref": "#/components/schemas/Error"
  2336. }
  2337. }
  2338. }
  2339. }
  2340. }
  2341. }
  2342. },
  2343. "/memories/{id}/versions": {
  2344. "get": {
  2345. "summary": "Revision history, newest first",
  2346. "security": [
  2347. {
  2348. "bearerAuth": []
  2349. }
  2350. ],
  2351. "parameters": [
  2352. {
  2353. "name": "id",
  2354. "in": "path",
  2355. "required": true,
  2356. "schema": {
  2357. "type": "string",
  2358. "format": "uuid"
  2359. }
  2360. }
  2361. ],
  2362. "responses": {
  2363. "200": {
  2364. "description": "Revisions"
  2365. },
  2366. "401": {
  2367. "description": "Missing, invalid, revoked or expired API key",
  2368. "content": {
  2369. "application/json": {
  2370. "schema": {
  2371. "$ref": "#/components/schemas/Error"
  2372. }
  2373. }
  2374. }
  2375. },
  2376. "404": {
  2377. "description": "Not found or not visible to the caller",
  2378. "content": {
  2379. "application/json": {
  2380. "schema": {
  2381. "$ref": "#/components/schemas/Error"
  2382. }
  2383. }
  2384. }
  2385. },
  2386. "500": {
  2387. "description": "Internal error",
  2388. "content": {
  2389. "application/json": {
  2390. "schema": {
  2391. "$ref": "#/components/schemas/Error"
  2392. }
  2393. }
  2394. }
  2395. }
  2396. }
  2397. }
  2398. },
  2399. "/sessions": {
  2400. "post": {
  2401. "summary": "Start a session",
  2402. "security": [
  2403. {
  2404. "bearerAuth": []
  2405. }
  2406. ],
  2407. "parameters": [
  2408. {
  2409. "name": "Idempotency-Key",
  2410. "in": "header",
  2411. "required": false,
  2412. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  2413. "schema": {
  2414. "type": "string",
  2415. "maxLength": 200
  2416. }
  2417. }
  2418. ],
  2419. "requestBody": {
  2420. "required": true,
  2421. "content": {
  2422. "application/json": {
  2423. "schema": {
  2424. "type": "object",
  2425. "required": [
  2426. "namespace_id",
  2427. "objective"
  2428. ],
  2429. "properties": {
  2430. "namespace_id": {
  2431. "type": "string",
  2432. "format": "uuid"
  2433. },
  2434. "objective": {
  2435. "type": "string",
  2436. "maxLength": 2000
  2437. }
  2438. }
  2439. }
  2440. }
  2441. }
  2442. },
  2443. "responses": {
  2444. "201": {
  2445. "description": "Started"
  2446. },
  2447. "422": {
  2448. "description": "Validation failed",
  2449. "content": {
  2450. "application/json": {
  2451. "schema": {
  2452. "$ref": "#/components/schemas/Error"
  2453. }
  2454. }
  2455. }
  2456. },
  2457. "409": {
  2458. "description": "Idempotency conflict",
  2459. "content": {
  2460. "application/json": {
  2461. "schema": {
  2462. "$ref": "#/components/schemas/Error"
  2463. }
  2464. }
  2465. }
  2466. },
  2467. "401": {
  2468. "description": "Missing, invalid, revoked or expired API key",
  2469. "content": {
  2470. "application/json": {
  2471. "schema": {
  2472. "$ref": "#/components/schemas/Error"
  2473. }
  2474. }
  2475. }
  2476. },
  2477. "404": {
  2478. "description": "Not found or not visible to the caller",
  2479. "content": {
  2480. "application/json": {
  2481. "schema": {
  2482. "$ref": "#/components/schemas/Error"
  2483. }
  2484. }
  2485. }
  2486. },
  2487. "500": {
  2488. "description": "Internal error",
  2489. "content": {
  2490. "application/json": {
  2491. "schema": {
  2492. "$ref": "#/components/schemas/Error"
  2493. }
  2494. }
  2495. }
  2496. }
  2497. }
  2498. }
  2499. },
  2500. "/sessions/{id}/state": {
  2501. "get": {
  2502. "summary": "Restore the latest checkpoint (revision 0 / state null when none)",
  2503. "security": [
  2504. {
  2505. "bearerAuth": []
  2506. }
  2507. ],
  2508. "parameters": [
  2509. {
  2510. "name": "id",
  2511. "in": "path",
  2512. "required": true,
  2513. "schema": {
  2514. "type": "string",
  2515. "format": "uuid"
  2516. }
  2517. }
  2518. ],
  2519. "responses": {
  2520. "200": {
  2521. "description": "Checkpoint; ETag = revision"
  2522. },
  2523. "401": {
  2524. "description": "Missing, invalid, revoked or expired API key",
  2525. "content": {
  2526. "application/json": {
  2527. "schema": {
  2528. "$ref": "#/components/schemas/Error"
  2529. }
  2530. }
  2531. }
  2532. },
  2533. "404": {
  2534. "description": "Not found or not visible to the caller",
  2535. "content": {
  2536. "application/json": {
  2537. "schema": {
  2538. "$ref": "#/components/schemas/Error"
  2539. }
  2540. }
  2541. }
  2542. },
  2543. "500": {
  2544. "description": "Internal error",
  2545. "content": {
  2546. "application/json": {
  2547. "schema": {
  2548. "$ref": "#/components/schemas/Error"
  2549. }
  2550. }
  2551. }
  2552. }
  2553. }
  2554. },
  2555. "put": {
  2556. "summary": "Save a checkpoint (If-Match = current checkpoint revision, 0 for the first)",
  2557. "security": [
  2558. {
  2559. "bearerAuth": []
  2560. }
  2561. ],
  2562. "parameters": [
  2563. {
  2564. "name": "id",
  2565. "in": "path",
  2566. "required": true,
  2567. "schema": {
  2568. "type": "string",
  2569. "format": "uuid"
  2570. }
  2571. },
  2572. {
  2573. "name": "If-Match",
  2574. "in": "header",
  2575. "required": false,
  2576. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  2577. "schema": {
  2578. "type": "string"
  2579. }
  2580. }
  2581. ],
  2582. "requestBody": {
  2583. "required": true,
  2584. "content": {
  2585. "application/json": {
  2586. "schema": {
  2587. "$ref": "#/components/schemas/SaveStateRequest"
  2588. }
  2589. }
  2590. }
  2591. },
  2592. "responses": {
  2593. "200": {
  2594. "description": "Saved; ETag = new revision"
  2595. },
  2596. "409": {
  2597. "description": "Session closed",
  2598. "content": {
  2599. "application/json": {
  2600. "schema": {
  2601. "$ref": "#/components/schemas/Error"
  2602. }
  2603. }
  2604. }
  2605. },
  2606. "412": {
  2607. "description": "Stale revision",
  2608. "content": {
  2609. "application/json": {
  2610. "schema": {
  2611. "$ref": "#/components/schemas/Error"
  2612. }
  2613. }
  2614. }
  2615. },
  2616. "422": {
  2617. "description": "Validation failed",
  2618. "content": {
  2619. "application/json": {
  2620. "schema": {
  2621. "$ref": "#/components/schemas/Error"
  2622. }
  2623. }
  2624. }
  2625. },
  2626. "428": {
  2627. "description": "If-Match missing",
  2628. "content": {
  2629. "application/json": {
  2630. "schema": {
  2631. "$ref": "#/components/schemas/Error"
  2632. }
  2633. }
  2634. }
  2635. },
  2636. "401": {
  2637. "description": "Missing, invalid, revoked or expired API key",
  2638. "content": {
  2639. "application/json": {
  2640. "schema": {
  2641. "$ref": "#/components/schemas/Error"
  2642. }
  2643. }
  2644. }
  2645. },
  2646. "404": {
  2647. "description": "Not found or not visible to the caller",
  2648. "content": {
  2649. "application/json": {
  2650. "schema": {
  2651. "$ref": "#/components/schemas/Error"
  2652. }
  2653. }
  2654. }
  2655. },
  2656. "500": {
  2657. "description": "Internal error",
  2658. "content": {
  2659. "application/json": {
  2660. "schema": {
  2661. "$ref": "#/components/schemas/Error"
  2662. }
  2663. }
  2664. }
  2665. }
  2666. }
  2667. }
  2668. },
  2669. "/sessions/{id}/complete": {
  2670. "post": {
  2671. "summary": "Complete a session",
  2672. "security": [
  2673. {
  2674. "bearerAuth": []
  2675. }
  2676. ],
  2677. "parameters": [
  2678. {
  2679. "name": "id",
  2680. "in": "path",
  2681. "required": true,
  2682. "schema": {
  2683. "type": "string",
  2684. "format": "uuid"
  2685. }
  2686. }
  2687. ],
  2688. "requestBody": {
  2689. "required": false,
  2690. "content": {
  2691. "application/json": {
  2692. "schema": {
  2693. "type": "object",
  2694. "properties": {
  2695. "outcome": {
  2696. "type": "string",
  2697. "maxLength": 4000
  2698. }
  2699. }
  2700. }
  2701. }
  2702. }
  2703. },
  2704. "responses": {
  2705. "200": {
  2706. "description": "Completed"
  2707. },
  2708. "409": {
  2709. "description": "Already closed",
  2710. "content": {
  2711. "application/json": {
  2712. "schema": {
  2713. "$ref": "#/components/schemas/Error"
  2714. }
  2715. }
  2716. }
  2717. },
  2718. "401": {
  2719. "description": "Missing, invalid, revoked or expired API key",
  2720. "content": {
  2721. "application/json": {
  2722. "schema": {
  2723. "$ref": "#/components/schemas/Error"
  2724. }
  2725. }
  2726. }
  2727. },
  2728. "404": {
  2729. "description": "Not found or not visible to the caller",
  2730. "content": {
  2731. "application/json": {
  2732. "schema": {
  2733. "$ref": "#/components/schemas/Error"
  2734. }
  2735. }
  2736. }
  2737. },
  2738. "500": {
  2739. "description": "Internal error",
  2740. "content": {
  2741. "application/json": {
  2742. "schema": {
  2743. "$ref": "#/components/schemas/Error"
  2744. }
  2745. }
  2746. }
  2747. }
  2748. }
  2749. }
  2750. },
  2751. "/memories/{id}/verifications": {
  2752. "post": {
  2753. "summary": "Record a verification of the current revision (needs the verify permission)",
  2754. "security": [
  2755. {
  2756. "bearerAuth": []
  2757. }
  2758. ],
  2759. "parameters": [
  2760. {
  2761. "name": "id",
  2762. "in": "path",
  2763. "required": true,
  2764. "schema": {
  2765. "type": "string",
  2766. "format": "uuid"
  2767. }
  2768. }
  2769. ],
  2770. "requestBody": {
  2771. "required": true,
  2772. "content": {
  2773. "application/json": {
  2774. "schema": {
  2775. "$ref": "#/components/schemas/VerifyRequest"
  2776. }
  2777. }
  2778. }
  2779. },
  2780. "responses": {
  2781. "200": {
  2782. "description": "Recorded; returns the new verification_status"
  2783. },
  2784. "409": {
  2785. "description": "Not the current revision",
  2786. "content": {
  2787. "application/json": {
  2788. "schema": {
  2789. "$ref": "#/components/schemas/Error"
  2790. }
  2791. }
  2792. }
  2793. },
  2794. "422": {
  2795. "description": "Validation failed",
  2796. "content": {
  2797. "application/json": {
  2798. "schema": {
  2799. "$ref": "#/components/schemas/Error"
  2800. }
  2801. }
  2802. }
  2803. },
  2804. "401": {
  2805. "description": "Missing, invalid, revoked or expired API key",
  2806. "content": {
  2807. "application/json": {
  2808. "schema": {
  2809. "$ref": "#/components/schemas/Error"
  2810. }
  2811. }
  2812. }
  2813. },
  2814. "404": {
  2815. "description": "Not found or not visible to the caller",
  2816. "content": {
  2817. "application/json": {
  2818. "schema": {
  2819. "$ref": "#/components/schemas/Error"
  2820. }
  2821. }
  2822. }
  2823. },
  2824. "500": {
  2825. "description": "Internal error",
  2826. "content": {
  2827. "application/json": {
  2828. "schema": {
  2829. "$ref": "#/components/schemas/Error"
  2830. }
  2831. }
  2832. }
  2833. }
  2834. }
  2835. }
  2836. },
  2837. "/recall": {
  2838. "post": {
  2839. "summary": "Hybrid recall over active memories (FTS5/bm25 fused with vector similarity by reciprocal rank fusion; lexical only, with a warning, when the embedding provider is off or down). Unverified memories are hidden unless verification_filter=include_unverified",
  2840. "security": [
  2841. {
  2842. "bearerAuth": []
  2843. }
  2844. ],
  2845. "requestBody": {
  2846. "required": true,
  2847. "content": {
  2848. "application/json": {
  2849. "schema": {
  2850. "$ref": "#/components/schemas/RecallRequest"
  2851. }
  2852. }
  2853. }
  2854. },
  2855. "responses": {
  2856. "200": {
  2857. "description": "Ranked results with warnings"
  2858. },
  2859. "422": {
  2860. "description": "Validation failed",
  2861. "content": {
  2862. "application/json": {
  2863. "schema": {
  2864. "$ref": "#/components/schemas/Error"
  2865. }
  2866. }
  2867. }
  2868. },
  2869. "401": {
  2870. "description": "Missing, invalid, revoked or expired API key",
  2871. "content": {
  2872. "application/json": {
  2873. "schema": {
  2874. "$ref": "#/components/schemas/Error"
  2875. }
  2876. }
  2877. }
  2878. },
  2879. "404": {
  2880. "description": "Not found or not visible to the caller",
  2881. "content": {
  2882. "application/json": {
  2883. "schema": {
  2884. "$ref": "#/components/schemas/Error"
  2885. }
  2886. }
  2887. }
  2888. },
  2889. "500": {
  2890. "description": "Internal error",
  2891. "content": {
  2892. "application/json": {
  2893. "schema": {
  2894. "$ref": "#/components/schemas/Error"
  2895. }
  2896. }
  2897. }
  2898. }
  2899. },
  2900. "description": " Feedback (POST /feedback) on a result's current revision adjusts its rank; such results carry feedback {useful, not_useful, incorrect_or_harmful} and demoted results are named in warnings."
  2901. }
  2902. },
  2903. "/ingestion/jobs": {
  2904. "post": {
  2905. "summary": "Ingest a Markdown/text document (chunked, indexed) Ingestion is a durable job: the input is stored first, so an interrupted or failed job is retried by the worker (at most 3 attempts) without duplicate chunks.",
  2906. "security": [
  2907. {
  2908. "bearerAuth": []
  2909. }
  2910. ],
  2911. "parameters": [
  2912. {
  2913. "name": "Idempotency-Key",
  2914. "in": "header",
  2915. "required": false,
  2916. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  2917. "schema": {
  2918. "type": "string",
  2919. "maxLength": 200
  2920. }
  2921. }
  2922. ],
  2923. "requestBody": {
  2924. "required": true,
  2925. "content": {
  2926. "application/json": {
  2927. "schema": {
  2928. "$ref": "#/components/schemas/IngestRequest"
  2929. }
  2930. }
  2931. }
  2932. },
  2933. "responses": {
  2934. "201": {
  2935. "description": "Ingested (new document or new revision)",
  2936. "content": {
  2937. "application/json": {
  2938. "schema": {
  2939. "$ref": "#/components/schemas/IngestResponse"
  2940. }
  2941. }
  2942. }
  2943. },
  2944. "200": {
  2945. "description": "Unchanged or idempotent replay",
  2946. "content": {
  2947. "application/json": {
  2948. "schema": {
  2949. "$ref": "#/components/schemas/IngestResponse"
  2950. }
  2951. }
  2952. }
  2953. },
  2954. "400": {
  2955. "description": "Invalid JSON",
  2956. "content": {
  2957. "application/json": {
  2958. "schema": {
  2959. "$ref": "#/components/schemas/Error"
  2960. }
  2961. }
  2962. }
  2963. },
  2964. "409": {
  2965. "description": "Idempotency-Key reused with a different body",
  2966. "content": {
  2967. "application/json": {
  2968. "schema": {
  2969. "$ref": "#/components/schemas/Error"
  2970. }
  2971. }
  2972. }
  2973. },
  2974. "422": {
  2975. "description": "Validation failed",
  2976. "content": {
  2977. "application/json": {
  2978. "schema": {
  2979. "$ref": "#/components/schemas/Error"
  2980. }
  2981. }
  2982. }
  2983. },
  2984. "401": {
  2985. "description": "Missing, invalid, revoked or expired API key",
  2986. "content": {
  2987. "application/json": {
  2988. "schema": {
  2989. "$ref": "#/components/schemas/Error"
  2990. }
  2991. }
  2992. }
  2993. },
  2994. "404": {
  2995. "description": "Not found or not visible to the caller",
  2996. "content": {
  2997. "application/json": {
  2998. "schema": {
  2999. "$ref": "#/components/schemas/Error"
  3000. }
  3001. }
  3002. }
  3003. },
  3004. "500": {
  3005. "description": "Internal error. When the job was already stored, its input is kept and the worker retries it (Location: the job)",
  3006. "content": {
  3007. "application/json": {
  3008. "schema": {
  3009. "$ref": "#/components/schemas/Error"
  3010. }
  3011. }
  3012. }
  3013. },
  3014. "202": {
  3015. "description": "Queued (async): job reference; the worker publishes the revision",
  3016. "content": {
  3017. "application/json": {
  3018. "schema": {
  3019. "$ref": "#/components/schemas/JobQueued"
  3020. }
  3021. }
  3022. }
  3023. }
  3024. }
  3025. }
  3026. },
  3027. "/jobs/{id}": {
  3028. "get": {
  3029. "summary": "Ingestion job state",
  3030. "security": [
  3031. {
  3032. "bearerAuth": []
  3033. }
  3034. ],
  3035. "parameters": [
  3036. {
  3037. "name": "id",
  3038. "in": "path",
  3039. "required": true,
  3040. "schema": {
  3041. "type": "string",
  3042. "format": "uuid"
  3043. }
  3044. }
  3045. ],
  3046. "responses": {
  3047. "200": {
  3048. "description": "Job",
  3049. "content": {
  3050. "application/json": {
  3051. "schema": {
  3052. "$ref": "#/components/schemas/Job"
  3053. }
  3054. }
  3055. }
  3056. },
  3057. "401": {
  3058. "description": "Missing, invalid, revoked or expired API key",
  3059. "content": {
  3060. "application/json": {
  3061. "schema": {
  3062. "$ref": "#/components/schemas/Error"
  3063. }
  3064. }
  3065. }
  3066. },
  3067. "404": {
  3068. "description": "Not found or not visible to the caller",
  3069. "content": {
  3070. "application/json": {
  3071. "schema": {
  3072. "$ref": "#/components/schemas/Error"
  3073. }
  3074. }
  3075. }
  3076. },
  3077. "500": {
  3078. "description": "Internal error",
  3079. "content": {
  3080. "application/json": {
  3081. "schema": {
  3082. "$ref": "#/components/schemas/Error"
  3083. }
  3084. }
  3085. }
  3086. }
  3087. }
  3088. }
  3089. },
  3090. "/jobs/{id}/retry": {
  3091. "post": {
  3092. "summary": "Requeue a failed job (attempts reset). Needs write permission on the job's namespace. Automatic retries cover internal errors only; use this after fixing the cause of another failure.",
  3093. "security": [
  3094. {
  3095. "bearerAuth": []
  3096. }
  3097. ],
  3098. "parameters": [
  3099. {
  3100. "name": "id",
  3101. "in": "path",
  3102. "required": true,
  3103. "schema": {
  3104. "type": "string",
  3105. "format": "uuid"
  3106. }
  3107. }
  3108. ],
  3109. "responses": {
  3110. "202": {
  3111. "description": "Queued",
  3112. "content": {
  3113. "application/json": {
  3114. "schema": {
  3115. "$ref": "#/components/schemas/JobQueued"
  3116. }
  3117. }
  3118. }
  3119. },
  3120. "401": {
  3121. "description": "Missing, invalid, revoked or expired API key",
  3122. "content": {
  3123. "application/json": {
  3124. "schema": {
  3125. "$ref": "#/components/schemas/Error"
  3126. }
  3127. }
  3128. }
  3129. },
  3130. "404": {
  3131. "description": "Not found, or no write permission on the job's namespace",
  3132. "content": {
  3133. "application/json": {
  3134. "schema": {
  3135. "$ref": "#/components/schemas/Error"
  3136. }
  3137. }
  3138. }
  3139. },
  3140. "409": {
  3141. "description": "job_not_retryable: the job is not failed, or its input is no longer stored",
  3142. "content": {
  3143. "application/json": {
  3144. "schema": {
  3145. "$ref": "#/components/schemas/Error"
  3146. }
  3147. }
  3148. }
  3149. },
  3150. "500": {
  3151. "description": "Internal error",
  3152. "content": {
  3153. "application/json": {
  3154. "schema": {
  3155. "$ref": "#/components/schemas/Error"
  3156. }
  3157. }
  3158. }
  3159. }
  3160. }
  3161. }
  3162. },
  3163. "/documents/{id}": {
  3164. "get": {
  3165. "summary": "Document metadata (?include_content=true adds the normalized text)",
  3166. "security": [
  3167. {
  3168. "bearerAuth": []
  3169. }
  3170. ],
  3171. "parameters": [
  3172. {
  3173. "name": "id",
  3174. "in": "path",
  3175. "required": true,
  3176. "schema": {
  3177. "type": "string",
  3178. "format": "uuid"
  3179. }
  3180. },
  3181. {
  3182. "name": "include_content",
  3183. "in": "query",
  3184. "schema": {
  3185. "type": "boolean"
  3186. }
  3187. }
  3188. ],
  3189. "responses": {
  3190. "200": {
  3191. "description": "Document"
  3192. },
  3193. "401": {
  3194. "description": "Missing, invalid, revoked or expired API key",
  3195. "content": {
  3196. "application/json": {
  3197. "schema": {
  3198. "$ref": "#/components/schemas/Error"
  3199. }
  3200. }
  3201. }
  3202. },
  3203. "404": {
  3204. "description": "Not found or not visible to the caller",
  3205. "content": {
  3206. "application/json": {
  3207. "schema": {
  3208. "$ref": "#/components/schemas/Error"
  3209. }
  3210. }
  3211. }
  3212. },
  3213. "500": {
  3214. "description": "Internal error",
  3215. "content": {
  3216. "application/json": {
  3217. "schema": {
  3218. "$ref": "#/components/schemas/Error"
  3219. }
  3220. }
  3221. }
  3222. }
  3223. }
  3224. }
  3225. },
  3226. "/chunks/{id}": {
  3227. "get": {
  3228. "summary": "One chunk with heading path and source locator (character offsets into the normalized document text)",
  3229. "security": [
  3230. {
  3231. "bearerAuth": []
  3232. }
  3233. ],
  3234. "parameters": [
  3235. {
  3236. "name": "id",
  3237. "in": "path",
  3238. "required": true,
  3239. "schema": {
  3240. "type": "string",
  3241. "format": "uuid"
  3242. }
  3243. }
  3244. ],
  3245. "responses": {
  3246. "200": {
  3247. "description": "Chunk"
  3248. },
  3249. "401": {
  3250. "description": "Missing, invalid, revoked or expired API key",
  3251. "content": {
  3252. "application/json": {
  3253. "schema": {
  3254. "$ref": "#/components/schemas/Error"
  3255. }
  3256. }
  3257. }
  3258. },
  3259. "404": {
  3260. "description": "Not found or not visible to the caller",
  3261. "content": {
  3262. "application/json": {
  3263. "schema": {
  3264. "$ref": "#/components/schemas/Error"
  3265. }
  3266. }
  3267. }
  3268. },
  3269. "500": {
  3270. "description": "Internal error",
  3271. "content": {
  3272. "application/json": {
  3273. "schema": {
  3274. "$ref": "#/components/schemas/Error"
  3275. }
  3276. }
  3277. }
  3278. }
  3279. }
  3280. }
  3281. },
  3282. "/search": {
  3283. "post": {
  3284. "summary": "Hybrid search over current document chunks (lexical fused with vector similarity; lexical only, with a warning, when the embedding provider is off or down). Results are untrusted reference content",
  3285. "security": [
  3286. {
  3287. "bearerAuth": []
  3288. }
  3289. ],
  3290. "requestBody": {
  3291. "required": true,
  3292. "content": {
  3293. "application/json": {
  3294. "schema": {
  3295. "$ref": "#/components/schemas/SearchRequest"
  3296. }
  3297. }
  3298. }
  3299. },
  3300. "responses": {
  3301. "200": {
  3302. "description": "Ranked chunks with locators and content_trust"
  3303. },
  3304. "422": {
  3305. "description": "Validation failed",
  3306. "content": {
  3307. "application/json": {
  3308. "schema": {
  3309. "$ref": "#/components/schemas/Error"
  3310. }
  3311. }
  3312. }
  3313. },
  3314. "401": {
  3315. "description": "Missing, invalid, revoked or expired API key",
  3316. "content": {
  3317. "application/json": {
  3318. "schema": {
  3319. "$ref": "#/components/schemas/Error"
  3320. }
  3321. }
  3322. }
  3323. },
  3324. "404": {
  3325. "description": "Not found or not visible to the caller",
  3326. "content": {
  3327. "application/json": {
  3328. "schema": {
  3329. "$ref": "#/components/schemas/Error"
  3330. }
  3331. }
  3332. }
  3333. },
  3334. "500": {
  3335. "description": "Internal error",
  3336. "content": {
  3337. "application/json": {
  3338. "schema": {
  3339. "$ref": "#/components/schemas/Error"
  3340. }
  3341. }
  3342. }
  3343. }
  3344. },
  3345. "description": " Feedback (POST /feedback) on a result's current revision adjusts its rank; such results carry feedback {useful, not_useful, incorrect_or_harmful} and demoted results are named in warnings."
  3346. }
  3347. },
  3348. "/health/live": {
  3349. "get": {
  3350. "summary": "Liveness",
  3351. "responses": {
  3352. "200": {
  3353. "description": "Live"
  3354. }
  3355. }
  3356. }
  3357. },
  3358. "/health/ready": {
  3359. "get": {
  3360. "summary": "Readiness (database reachable)",
  3361. "responses": {
  3362. "200": {
  3363. "description": "Ready"
  3364. },
  3365. "503": {
  3366. "description": "Unavailable"
  3367. }
  3368. }
  3369. }
  3370. },
  3371. "/metrics": {
  3372. "get": {
  3373. "summary": "Prometheus text metrics: API request counters and latency histogram per controller action (since process start), plus installation-wide counts (memories, candidates, jobs, embedding index, retrieval calls, feedback). Counts only. Enabled when the container has AMK_METRICS_TOKEN (16+ characters); send it as a bearer token. API keys are not accepted.",
  3374. "tags": [
  3375. "health"
  3376. ],
  3377. "responses": {
  3378. "200": {
  3379. "description": "Metrics",
  3380. "content": {
  3381. "text/plain": {
  3382. "schema": {
  3383. "type": "string"
  3384. }
  3385. }
  3386. }
  3387. },
  3388. "401": {
  3389. "description": "Missing or wrong metrics token",
  3390. "content": {
  3391. "application/json": {
  3392. "schema": {
  3393. "$ref": "#/components/schemas/Error"
  3394. }
  3395. }
  3396. }
  3397. },
  3398. "404": {
  3399. "description": "Metrics are disabled (no AMK_METRICS_TOKEN)",
  3400. "content": {
  3401. "application/json": {
  3402. "schema": {
  3403. "$ref": "#/components/schemas/Error"
  3404. }
  3405. }
  3406. }
  3407. }
  3408. }
  3409. }
  3410. },
  3411. "/context": {
  3412. "post": {
  3413. "summary": "Assemble a token-budgeted task briefing: constraints by scope, working state, preferences, conflicts, hybrid matches and reference passages",
  3414. "security": [
  3415. {
  3416. "bearerAuth": []
  3417. }
  3418. ],
  3419. "requestBody": {
  3420. "required": true,
  3421. "content": {
  3422. "application/json": {
  3423. "schema": {
  3424. "$ref": "#/components/schemas/ContextRequest"
  3425. }
  3426. }
  3427. }
  3428. },
  3429. "responses": {
  3430. "200": {
  3431. "description": "Briefing",
  3432. "content": {
  3433. "application/json": {
  3434. "schema": {
  3435. "$ref": "#/components/schemas/ContextResponse"
  3436. }
  3437. }
  3438. }
  3439. },
  3440. "400": {
  3441. "description": "Empty body or invalid JSON",
  3442. "content": {
  3443. "application/json": {
  3444. "schema": {
  3445. "$ref": "#/components/schemas/Error"
  3446. }
  3447. }
  3448. }
  3449. },
  3450. "401": {
  3451. "description": "Missing, invalid, revoked or expired API key",
  3452. "content": {
  3453. "application/json": {
  3454. "schema": {
  3455. "$ref": "#/components/schemas/Error"
  3456. }
  3457. }
  3458. }
  3459. },
  3460. "404": {
  3461. "description": "session_id not found or not visible to the caller",
  3462. "content": {
  3463. "application/json": {
  3464. "schema": {
  3465. "$ref": "#/components/schemas/Error"
  3466. }
  3467. }
  3468. }
  3469. },
  3470. "422": {
  3471. "description": "Validation failed, unsupported_character (code points above U+FFFF), or context_budget_exceeded (the applicable constraints do not fit max_context_tokens; the error also carries required_tokens)",
  3472. "content": {
  3473. "application/json": {
  3474. "schema": {
  3475. "$ref": "#/components/schemas/Error"
  3476. }
  3477. }
  3478. }
  3479. },
  3480. "500": {
  3481. "description": "Internal error",
  3482. "content": {
  3483. "application/json": {
  3484. "schema": {
  3485. "$ref": "#/components/schemas/Error"
  3486. }
  3487. }
  3488. }
  3489. }
  3490. }
  3491. }
  3492. },
  3493. "/sessions/{id}/events": {
  3494. "post": {
  3495. "summary": "Record an experience (task, problem, action, result, outcome) in an active session",
  3496. "tags": [
  3497. "learning"
  3498. ],
  3499. "security": [
  3500. {
  3501. "bearerAuth": []
  3502. }
  3503. ],
  3504. "parameters": [
  3505. {
  3506. "name": "id",
  3507. "in": "path",
  3508. "required": true,
  3509. "schema": {
  3510. "type": "string",
  3511. "format": "uuid"
  3512. }
  3513. },
  3514. {
  3515. "name": "Idempotency-Key",
  3516. "in": "header",
  3517. "required": false,
  3518. "schema": {
  3519. "type": "string",
  3520. "maxLength": 200
  3521. },
  3522. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  3523. }
  3524. ],
  3525. "requestBody": {
  3526. "required": true,
  3527. "content": {
  3528. "application/json": {
  3529. "schema": {
  3530. "$ref": "#/components/schemas/ExperienceRequest"
  3531. }
  3532. }
  3533. }
  3534. },
  3535. "responses": {
  3536. "201": {
  3537. "description": "Recorded",
  3538. "content": {
  3539. "application/json": {
  3540. "schema": {
  3541. "type": "object",
  3542. "properties": {
  3543. "id": {
  3544. "type": "string"
  3545. },
  3546. "session_id": {
  3547. "type": "string"
  3548. },
  3549. "outcome": {
  3550. "type": "string"
  3551. },
  3552. "created_at": {
  3553. "type": "string"
  3554. }
  3555. }
  3556. }
  3557. }
  3558. }
  3559. },
  3560. "400": {
  3561. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  3562. "content": {
  3563. "application/json": {
  3564. "schema": {
  3565. "$ref": "#/components/schemas/Error"
  3566. }
  3567. }
  3568. }
  3569. },
  3570. "401": {
  3571. "description": "Missing, invalid, revoked or expired API key",
  3572. "content": {
  3573. "application/json": {
  3574. "schema": {
  3575. "$ref": "#/components/schemas/Error"
  3576. }
  3577. }
  3578. }
  3579. },
  3580. "404": {
  3581. "description": "Session not found, or no write permission on its namespace",
  3582. "content": {
  3583. "application/json": {
  3584. "schema": {
  3585. "$ref": "#/components/schemas/Error"
  3586. }
  3587. }
  3588. }
  3589. },
  3590. "409": {
  3591. "description": "session_not_active (completed session) or idempotency_conflict",
  3592. "content": {
  3593. "application/json": {
  3594. "schema": {
  3595. "$ref": "#/components/schemas/Error"
  3596. }
  3597. }
  3598. }
  3599. },
  3600. "422": {
  3601. "description": "Validation failed or unsupported_character",
  3602. "content": {
  3603. "application/json": {
  3604. "schema": {
  3605. "$ref": "#/components/schemas/Error"
  3606. }
  3607. }
  3608. }
  3609. },
  3610. "500": {
  3611. "description": "Internal error",
  3612. "content": {
  3613. "application/json": {
  3614. "schema": {
  3615. "$ref": "#/components/schemas/Error"
  3616. }
  3617. }
  3618. }
  3619. }
  3620. }
  3621. },
  3622. "get": {
  3623. "summary": "List the experiences of a session, oldest first (max 200)",
  3624. "tags": [
  3625. "learning"
  3626. ],
  3627. "security": [
  3628. {
  3629. "bearerAuth": []
  3630. }
  3631. ],
  3632. "parameters": [
  3633. {
  3634. "name": "id",
  3635. "in": "path",
  3636. "required": true,
  3637. "schema": {
  3638. "type": "string",
  3639. "format": "uuid"
  3640. }
  3641. }
  3642. ],
  3643. "responses": {
  3644. "200": {
  3645. "description": "Experiences",
  3646. "content": {
  3647. "application/json": {
  3648. "schema": {
  3649. "type": "object",
  3650. "properties": {
  3651. "session_id": {
  3652. "type": "string"
  3653. },
  3654. "data": {
  3655. "type": "array",
  3656. "items": {
  3657. "$ref": "#/components/schemas/Experience"
  3658. }
  3659. }
  3660. }
  3661. }
  3662. }
  3663. }
  3664. },
  3665. "401": {
  3666. "description": "Missing, invalid, revoked or expired API key",
  3667. "content": {
  3668. "application/json": {
  3669. "schema": {
  3670. "$ref": "#/components/schemas/Error"
  3671. }
  3672. }
  3673. }
  3674. },
  3675. "404": {
  3676. "description": "Session not found or not readable",
  3677. "content": {
  3678. "application/json": {
  3679. "schema": {
  3680. "$ref": "#/components/schemas/Error"
  3681. }
  3682. }
  3683. }
  3684. },
  3685. "500": {
  3686. "description": "Internal error",
  3687. "content": {
  3688. "application/json": {
  3689. "schema": {
  3690. "$ref": "#/components/schemas/Error"
  3691. }
  3692. }
  3693. }
  3694. }
  3695. }
  3696. }
  3697. },
  3698. "/learn": {
  3699. "post": {
  3700. "summary": "Propose knowledge as a learning candidate (a new memory, or a new revision of target_memory_id at base_revision), with evidence",
  3701. "tags": [
  3702. "learning"
  3703. ],
  3704. "security": [
  3705. {
  3706. "bearerAuth": []
  3707. }
  3708. ],
  3709. "parameters": [
  3710. {
  3711. "name": "Idempotency-Key",
  3712. "in": "header",
  3713. "required": false,
  3714. "schema": {
  3715. "type": "string",
  3716. "maxLength": 200
  3717. },
  3718. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  3719. }
  3720. ],
  3721. "requestBody": {
  3722. "required": true,
  3723. "content": {
  3724. "application/json": {
  3725. "schema": {
  3726. "$ref": "#/components/schemas/LearnRequest"
  3727. }
  3728. }
  3729. }
  3730. },
  3731. "responses": {
  3732. "201": {
  3733. "description": "Candidate proposed",
  3734. "content": {
  3735. "application/json": {
  3736. "schema": {
  3737. "type": "object",
  3738. "properties": {
  3739. "id": {
  3740. "type": "string"
  3741. },
  3742. "state": {
  3743. "type": "string",
  3744. "enum": [
  3745. "proposed"
  3746. ]
  3747. },
  3748. "namespace_id": {
  3749. "type": "string"
  3750. },
  3751. "type": {
  3752. "type": "string"
  3753. },
  3754. "evidence_count": {
  3755. "type": "integer"
  3756. }
  3757. }
  3758. }
  3759. }
  3760. }
  3761. },
  3762. "400": {
  3763. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  3764. "content": {
  3765. "application/json": {
  3766. "schema": {
  3767. "$ref": "#/components/schemas/Error"
  3768. }
  3769. }
  3770. }
  3771. },
  3772. "401": {
  3773. "description": "Missing, invalid, revoked or expired API key",
  3774. "content": {
  3775. "application/json": {
  3776. "schema": {
  3777. "$ref": "#/components/schemas/Error"
  3778. }
  3779. }
  3780. }
  3781. },
  3782. "404": {
  3783. "description": "Namespace not found or no write permission",
  3784. "content": {
  3785. "application/json": {
  3786. "schema": {
  3787. "$ref": "#/components/schemas/Error"
  3788. }
  3789. }
  3790. }
  3791. },
  3792. "409": {
  3793. "description": "idempotency_conflict",
  3794. "content": {
  3795. "application/json": {
  3796. "schema": {
  3797. "$ref": "#/components/schemas/Error"
  3798. }
  3799. }
  3800. }
  3801. },
  3802. "422": {
  3803. "description": "Validation failed (unknown type, bad target/base_revision, evidence that is unknown, in another tenant or not readable by the caller) or unsupported_character",
  3804. "content": {
  3805. "application/json": {
  3806. "schema": {
  3807. "$ref": "#/components/schemas/Error"
  3808. }
  3809. }
  3810. }
  3811. },
  3812. "500": {
  3813. "description": "Internal error",
  3814. "content": {
  3815. "application/json": {
  3816. "schema": {
  3817. "$ref": "#/components/schemas/Error"
  3818. }
  3819. }
  3820. }
  3821. }
  3822. }
  3823. }
  3824. },
  3825. "/candidates": {
  3826. "get": {
  3827. "summary": "List learning candidates in namespaces the caller can read, newest first",
  3828. "tags": [
  3829. "learning"
  3830. ],
  3831. "security": [
  3832. {
  3833. "bearerAuth": []
  3834. }
  3835. ],
  3836. "parameters": [
  3837. {
  3838. "name": "namespace_id",
  3839. "in": "query",
  3840. "schema": {
  3841. "type": "string",
  3842. "format": "uuid"
  3843. }
  3844. },
  3845. {
  3846. "name": "state",
  3847. "in": "query",
  3848. "schema": {
  3849. "type": "string",
  3850. "enum": [
  3851. "proposed",
  3852. "accepted",
  3853. "rejected"
  3854. ]
  3855. }
  3856. },
  3857. {
  3858. "name": "limit",
  3859. "in": "query",
  3860. "schema": {
  3861. "type": "integer",
  3862. "minimum": 1,
  3863. "maximum": 200,
  3864. "default": 50
  3865. }
  3866. }
  3867. ],
  3868. "responses": {
  3869. "200": {
  3870. "description": "Candidates (without content)",
  3871. "content": {
  3872. "application/json": {
  3873. "schema": {
  3874. "type": "object",
  3875. "properties": {
  3876. "data": {
  3877. "type": "array",
  3878. "items": {
  3879. "$ref": "#/components/schemas/Candidate"
  3880. }
  3881. }
  3882. }
  3883. }
  3884. }
  3885. }
  3886. },
  3887. "401": {
  3888. "description": "Missing, invalid, revoked or expired API key",
  3889. "content": {
  3890. "application/json": {
  3891. "schema": {
  3892. "$ref": "#/components/schemas/Error"
  3893. }
  3894. }
  3895. }
  3896. },
  3897. "422": {
  3898. "description": "Bad state or namespace_id",
  3899. "content": {
  3900. "application/json": {
  3901. "schema": {
  3902. "$ref": "#/components/schemas/Error"
  3903. }
  3904. }
  3905. }
  3906. },
  3907. "500": {
  3908. "description": "Internal error",
  3909. "content": {
  3910. "application/json": {
  3911. "schema": {
  3912. "$ref": "#/components/schemas/Error"
  3913. }
  3914. }
  3915. }
  3916. }
  3917. }
  3918. }
  3919. },
  3920. "/candidates/{id}": {
  3921. "get": {
  3922. "summary": "One candidate with content and evidence",
  3923. "tags": [
  3924. "learning"
  3925. ],
  3926. "security": [
  3927. {
  3928. "bearerAuth": []
  3929. }
  3930. ],
  3931. "parameters": [
  3932. {
  3933. "name": "id",
  3934. "in": "path",
  3935. "required": true,
  3936. "schema": {
  3937. "type": "string",
  3938. "format": "uuid"
  3939. }
  3940. }
  3941. ],
  3942. "responses": {
  3943. "200": {
  3944. "description": "Candidate",
  3945. "content": {
  3946. "application/json": {
  3947. "schema": {
  3948. "type": "object",
  3949. "properties": {
  3950. "data": {
  3951. "$ref": "#/components/schemas/Candidate"
  3952. }
  3953. }
  3954. }
  3955. }
  3956. }
  3957. },
  3958. "401": {
  3959. "description": "Missing, invalid, revoked or expired API key",
  3960. "content": {
  3961. "application/json": {
  3962. "schema": {
  3963. "$ref": "#/components/schemas/Error"
  3964. }
  3965. }
  3966. }
  3967. },
  3968. "404": {
  3969. "description": "Not found or not readable",
  3970. "content": {
  3971. "application/json": {
  3972. "schema": {
  3973. "$ref": "#/components/schemas/Error"
  3974. }
  3975. }
  3976. }
  3977. },
  3978. "500": {
  3979. "description": "Internal error",
  3980. "content": {
  3981. "application/json": {
  3982. "schema": {
  3983. "$ref": "#/components/schemas/Error"
  3984. }
  3985. }
  3986. }
  3987. }
  3988. }
  3989. }
  3990. },
  3991. "/candidates/{id}/review": {
  3992. "post": {
  3993. "summary": "Accept or reject a proposed candidate. Needs verify permission; the author cannot review its own candidate without admin. Accepting creates the memory (an identical active memory is reused) or a new revision of the target, copies the evidence and, with verify true, records a verification by the reviewer.",
  3994. "tags": [
  3995. "learning"
  3996. ],
  3997. "security": [
  3998. {
  3999. "bearerAuth": []
  4000. }
  4001. ],
  4002. "parameters": [
  4003. {
  4004. "name": "id",
  4005. "in": "path",
  4006. "required": true,
  4007. "schema": {
  4008. "type": "string",
  4009. "format": "uuid"
  4010. }
  4011. }
  4012. ],
  4013. "requestBody": {
  4014. "required": true,
  4015. "content": {
  4016. "application/json": {
  4017. "schema": {
  4018. "$ref": "#/components/schemas/ReviewRequest"
  4019. }
  4020. }
  4021. }
  4022. },
  4023. "responses": {
  4024. "200": {
  4025. "description": "Reviewed",
  4026. "content": {
  4027. "application/json": {
  4028. "schema": {
  4029. "type": "object",
  4030. "properties": {
  4031. "id": {
  4032. "type": "string"
  4033. },
  4034. "state": {
  4035. "type": "string",
  4036. "enum": [
  4037. "accepted",
  4038. "rejected"
  4039. ]
  4040. },
  4041. "resulting_memory_id": {
  4042. "type": "string"
  4043. },
  4044. "resulting_revision": {
  4045. "type": "integer"
  4046. },
  4047. "verification_status": {
  4048. "type": "string"
  4049. },
  4050. "duplicate": {
  4051. "type": "boolean"
  4052. }
  4053. }
  4054. }
  4055. }
  4056. }
  4057. },
  4058. "400": {
  4059. "description": "Empty body or invalid JSON",
  4060. "content": {
  4061. "application/json": {
  4062. "schema": {
  4063. "$ref": "#/components/schemas/Error"
  4064. }
  4065. }
  4066. }
  4067. },
  4068. "401": {
  4069. "description": "Missing, invalid, revoked or expired API key",
  4070. "content": {
  4071. "application/json": {
  4072. "schema": {
  4073. "$ref": "#/components/schemas/Error"
  4074. }
  4075. }
  4076. }
  4077. },
  4078. "403": {
  4079. "description": "self_review_not_allowed",
  4080. "content": {
  4081. "application/json": {
  4082. "schema": {
  4083. "$ref": "#/components/schemas/Error"
  4084. }
  4085. }
  4086. }
  4087. },
  4088. "404": {
  4089. "description": "Candidate not found or no verify permission",
  4090. "content": {
  4091. "application/json": {
  4092. "schema": {
  4093. "$ref": "#/components/schemas/Error"
  4094. }
  4095. }
  4096. }
  4097. },
  4098. "409": {
  4099. "description": "candidate_already_reviewed, stale_candidate (target memory changed since base_revision), target_memory_missing or target_memory_not_active",
  4100. "content": {
  4101. "application/json": {
  4102. "schema": {
  4103. "$ref": "#/components/schemas/Error"
  4104. }
  4105. }
  4106. }
  4107. },
  4108. "422": {
  4109. "description": "Validation failed",
  4110. "content": {
  4111. "application/json": {
  4112. "schema": {
  4113. "$ref": "#/components/schemas/Error"
  4114. }
  4115. }
  4116. }
  4117. },
  4118. "500": {
  4119. "description": "Internal error",
  4120. "content": {
  4121. "application/json": {
  4122. "schema": {
  4123. "$ref": "#/components/schemas/Error"
  4124. }
  4125. }
  4126. }
  4127. }
  4128. }
  4129. }
  4130. },
  4131. "/memories/{id}/sources": {
  4132. "get": {
  4133. "summary": "Evidence and verifications behind a memory revision. Evidence the caller cannot read is listed with available false and no id.",
  4134. "tags": [
  4135. "learning"
  4136. ],
  4137. "security": [
  4138. {
  4139. "bearerAuth": []
  4140. }
  4141. ],
  4142. "parameters": [
  4143. {
  4144. "name": "id",
  4145. "in": "path",
  4146. "required": true,
  4147. "schema": {
  4148. "type": "string",
  4149. "format": "uuid"
  4150. }
  4151. },
  4152. {
  4153. "name": "revision",
  4154. "in": "query",
  4155. "schema": {
  4156. "type": "integer",
  4157. "minimum": 1
  4158. },
  4159. "description": "Default: current revision"
  4160. }
  4161. ],
  4162. "responses": {
  4163. "200": {
  4164. "description": "Sources",
  4165. "content": {
  4166. "application/json": {
  4167. "schema": {
  4168. "$ref": "#/components/schemas/Sources"
  4169. }
  4170. }
  4171. }
  4172. },
  4173. "401": {
  4174. "description": "Missing, invalid, revoked or expired API key",
  4175. "content": {
  4176. "application/json": {
  4177. "schema": {
  4178. "$ref": "#/components/schemas/Error"
  4179. }
  4180. }
  4181. }
  4182. },
  4183. "404": {
  4184. "description": "Memory not found or not readable",
  4185. "content": {
  4186. "application/json": {
  4187. "schema": {
  4188. "$ref": "#/components/schemas/Error"
  4189. }
  4190. }
  4191. }
  4192. },
  4193. "422": {
  4194. "description": "revision out of range",
  4195. "content": {
  4196. "application/json": {
  4197. "schema": {
  4198. "$ref": "#/components/schemas/Error"
  4199. }
  4200. }
  4201. }
  4202. },
  4203. "500": {
  4204. "description": "Internal error",
  4205. "content": {
  4206. "application/json": {
  4207. "schema": {
  4208. "$ref": "#/components/schemas/Error"
  4209. }
  4210. }
  4211. }
  4212. }
  4213. }
  4214. }
  4215. },
  4216. "/feedback": {
  4217. "post": {
  4218. "summary": "Rate one result of a recall, search or context call (by its query_id). One rating per principal, query and result; a new rating replaces the earlier one (200). Pinned to the revision that was returned.",
  4219. "tags": [
  4220. "learning"
  4221. ],
  4222. "security": [
  4223. {
  4224. "bearerAuth": []
  4225. }
  4226. ],
  4227. "requestBody": {
  4228. "required": true,
  4229. "content": {
  4230. "application/json": {
  4231. "schema": {
  4232. "$ref": "#/components/schemas/FeedbackRequest"
  4233. }
  4234. }
  4235. }
  4236. },
  4237. "responses": {
  4238. "200": {
  4239. "description": "Updated",
  4240. "content": {
  4241. "application/json": {
  4242. "schema": {
  4243. "$ref": "#/components/schemas/Feedback"
  4244. }
  4245. }
  4246. }
  4247. },
  4248. "201": {
  4249. "description": "Recorded",
  4250. "content": {
  4251. "application/json": {
  4252. "schema": {
  4253. "$ref": "#/components/schemas/Feedback"
  4254. }
  4255. }
  4256. }
  4257. },
  4258. "400": {
  4259. "description": "Empty body or invalid JSON",
  4260. "content": {
  4261. "application/json": {
  4262. "schema": {
  4263. "$ref": "#/components/schemas/Error"
  4264. }
  4265. }
  4266. }
  4267. },
  4268. "401": {
  4269. "description": "Missing, invalid, revoked or expired API key",
  4270. "content": {
  4271. "application/json": {
  4272. "schema": {
  4273. "$ref": "#/components/schemas/Error"
  4274. }
  4275. }
  4276. }
  4277. },
  4278. "404": {
  4279. "description": "result_not_found: the result was not returned by that query, is gone, or is not readable",
  4280. "content": {
  4281. "application/json": {
  4282. "schema": {
  4283. "$ref": "#/components/schemas/Error"
  4284. }
  4285. }
  4286. }
  4287. },
  4288. "422": {
  4289. "description": "Validation failed",
  4290. "content": {
  4291. "application/json": {
  4292. "schema": {
  4293. "$ref": "#/components/schemas/Error"
  4294. }
  4295. }
  4296. }
  4297. },
  4298. "500": {
  4299. "description": "Internal error",
  4300. "content": {
  4301. "application/json": {
  4302. "schema": {
  4303. "$ref": "#/components/schemas/Error"
  4304. }
  4305. }
  4306. }
  4307. }
  4308. }
  4309. }
  4310. },
  4311. "/exports": {
  4312. "post": {
  4313. "summary": "Export every namespace the caller can read (or the namespace_ids given) as one canonical, integrity-protected JSON document. Evidence whose target the caller cannot read is left out and counted in counts.evidence_links_omitted. Sent as an attachment.",
  4314. "tags": [
  4315. "portability"
  4316. ],
  4317. "security": [
  4318. {
  4319. "bearerAuth": []
  4320. }
  4321. ],
  4322. "requestBody": {
  4323. "required": false,
  4324. "content": {
  4325. "application/json": {
  4326. "schema": {
  4327. "$ref": "#/components/schemas/ExportRequest"
  4328. }
  4329. }
  4330. }
  4331. },
  4332. "responses": {
  4333. "200": {
  4334. "description": "The export document",
  4335. "content": {
  4336. "application/json": {
  4337. "schema": {
  4338. "$ref": "#/components/schemas/Export"
  4339. }
  4340. }
  4341. }
  4342. },
  4343. "400": {
  4344. "description": "Invalid JSON",
  4345. "content": {
  4346. "application/json": {
  4347. "schema": {
  4348. "$ref": "#/components/schemas/Error"
  4349. }
  4350. }
  4351. }
  4352. },
  4353. "401": {
  4354. "description": "Missing, invalid, revoked or expired API key",
  4355. "content": {
  4356. "application/json": {
  4357. "schema": {
  4358. "$ref": "#/components/schemas/Error"
  4359. }
  4360. }
  4361. }
  4362. },
  4363. "422": {
  4364. "description": "Validation failed (namespace_ids is not an array of ids)",
  4365. "content": {
  4366. "application/json": {
  4367. "schema": {
  4368. "$ref": "#/components/schemas/Error"
  4369. }
  4370. }
  4371. }
  4372. },
  4373. "500": {
  4374. "description": "Internal error",
  4375. "content": {
  4376. "application/json": {
  4377. "schema": {
  4378. "$ref": "#/components/schemas/Error"
  4379. }
  4380. }
  4381. }
  4382. }
  4383. }
  4384. }
  4385. },
  4386. "/imports": {
  4387. "post": {
  4388. "summary": "Import a document produced by POST /exports, unchanged (max 8 MiB). Needs admin on every target namespace, matched by path in the caller's tenant (they must exist). Ids, revisions, timestamps and principal ids are kept; content hashes and the lexical index are rebuilt and embeddings are queued. All or nothing.",
  4389. "tags": [
  4390. "portability"
  4391. ],
  4392. "security": [
  4393. {
  4394. "bearerAuth": []
  4395. }
  4396. ],
  4397. "requestBody": {
  4398. "required": true,
  4399. "content": {
  4400. "application/json": {
  4401. "schema": {
  4402. "$ref": "#/components/schemas/Export"
  4403. }
  4404. }
  4405. }
  4406. },
  4407. "responses": {
  4408. "201": {
  4409. "description": "Imported",
  4410. "content": {
  4411. "application/json": {
  4412. "schema": {
  4413. "$ref": "#/components/schemas/ImportResult"
  4414. }
  4415. }
  4416. }
  4417. },
  4418. "400": {
  4419. "description": "Empty body or invalid JSON",
  4420. "content": {
  4421. "application/json": {
  4422. "schema": {
  4423. "$ref": "#/components/schemas/Error"
  4424. }
  4425. }
  4426. }
  4427. },
  4428. "401": {
  4429. "description": "Missing, invalid, revoked or expired API key",
  4430. "content": {
  4431. "application/json": {
  4432. "schema": {
  4433. "$ref": "#/components/schemas/Error"
  4434. }
  4435. }
  4436. }
  4437. },
  4438. "409": {
  4439. "description": "import_conflict: an id in the document already exists; nothing was imported",
  4440. "content": {
  4441. "application/json": {
  4442. "schema": {
  4443. "$ref": "#/components/schemas/Error"
  4444. }
  4445. }
  4446. }
  4447. },
  4448. "413": {
  4449. "description": "body_too_large: more than 8 MiB",
  4450. "content": {
  4451. "application/json": {
  4452. "schema": {
  4453. "$ref": "#/components/schemas/Error"
  4454. }
  4455. }
  4456. }
  4457. },
  4458. "422": {
  4459. "description": "Validation failed: wrong format, unsupported_schema_version, integrity_mismatch, a missing target namespace, no admin permission on it, or an invalid item; nothing was imported",
  4460. "content": {
  4461. "application/json": {
  4462. "schema": {
  4463. "$ref": "#/components/schemas/Error"
  4464. }
  4465. }
  4466. }
  4467. },
  4468. "500": {
  4469. "description": "Internal error; nothing was imported",
  4470. "content": {
  4471. "application/json": {
  4472. "schema": {
  4473. "$ref": "#/components/schemas/Error"
  4474. }
  4475. }
  4476. }
  4477. }
  4478. }
  4479. }
  4480. },
  4481. "/me": {
  4482. "get": {
  4483. "summary": "The caller: principal, tenant and its grants.",
  4484. "security": [
  4485. {
  4486. "bearerAuth": []
  4487. }
  4488. ],
  4489. "responses": {
  4490. "200": {
  4491. "description": "Caller",
  4492. "content": {
  4493. "application/json": {
  4494. "schema": {
  4495. "$ref": "#/components/schemas/Me"
  4496. }
  4497. }
  4498. }
  4499. },
  4500. "401": {
  4501. "description": "Missing, invalid, revoked or expired API key",
  4502. "content": {
  4503. "application/json": {
  4504. "schema": {
  4505. "$ref": "#/components/schemas/Error"
  4506. }
  4507. }
  4508. }
  4509. }
  4510. }
  4511. }
  4512. },
  4513. "/namespaces": {
  4514. "get": {
  4515. "summary": "Namespaces the caller can read, with the caller's effective permissions on each.",
  4516. "security": [
  4517. {
  4518. "bearerAuth": []
  4519. }
  4520. ],
  4521. "responses": {
  4522. "200": {
  4523. "description": "Namespaces",
  4524. "content": {
  4525. "application/json": {
  4526. "schema": {
  4527. "type": "object",
  4528. "properties": {
  4529. "data": {
  4530. "type": "array",
  4531. "items": {
  4532. "$ref": "#/components/schemas/Namespace"
  4533. }
  4534. }
  4535. }
  4536. }
  4537. }
  4538. }
  4539. },
  4540. "401": {
  4541. "description": "Missing, invalid, revoked or expired API key",
  4542. "content": {
  4543. "application/json": {
  4544. "schema": {
  4545. "$ref": "#/components/schemas/Error"
  4546. }
  4547. }
  4548. }
  4549. }
  4550. }
  4551. },
  4552. "post": {
  4553. "summary": "Create a namespace (and missing parents). Needs an inheriting admin grant covering the new path; top-level namespaces are created with the CLI.",
  4554. "security": [
  4555. {
  4556. "bearerAuth": []
  4557. }
  4558. ],
  4559. "requestBody": {
  4560. "required": true,
  4561. "content": {
  4562. "application/json": {
  4563. "schema": {
  4564. "$ref": "#/components/schemas/NamespaceRequest"
  4565. }
  4566. }
  4567. }
  4568. },
  4569. "responses": {
  4570. "201": {
  4571. "description": "Created",
  4572. "content": {
  4573. "application/json": {
  4574. "schema": {
  4575. "$ref": "#/components/schemas/NamespaceCreated"
  4576. }
  4577. }
  4578. }
  4579. },
  4580. "400": {
  4581. "description": "Body is not valid JSON",
  4582. "content": {
  4583. "application/json": {
  4584. "schema": {
  4585. "$ref": "#/components/schemas/Error"
  4586. }
  4587. }
  4588. }
  4589. },
  4590. "401": {
  4591. "description": "Missing, invalid, revoked or expired API key",
  4592. "content": {
  4593. "application/json": {
  4594. "schema": {
  4595. "$ref": "#/components/schemas/Error"
  4596. }
  4597. }
  4598. }
  4599. },
  4600. "404": {
  4601. "description": "No inheriting admin grant covers the path",
  4602. "content": {
  4603. "application/json": {
  4604. "schema": {
  4605. "$ref": "#/components/schemas/Error"
  4606. }
  4607. }
  4608. }
  4609. },
  4610. "409": {
  4611. "description": "namespace_exists",
  4612. "content": {
  4613. "application/json": {
  4614. "schema": {
  4615. "$ref": "#/components/schemas/Error"
  4616. }
  4617. }
  4618. }
  4619. },
  4620. "422": {
  4621. "description": "Validation failed",
  4622. "content": {
  4623. "application/json": {
  4624. "schema": {
  4625. "$ref": "#/components/schemas/Error"
  4626. }
  4627. }
  4628. }
  4629. },
  4630. "500": {
  4631. "description": "Internal error",
  4632. "content": {
  4633. "application/json": {
  4634. "schema": {
  4635. "$ref": "#/components/schemas/Error"
  4636. }
  4637. }
  4638. }
  4639. }
  4640. }
  4641. }
  4642. },
  4643. "/principals": {
  4644. "get": {
  4645. "summary": "Principals of the caller's tenant. Needs admin on at least one namespace.",
  4646. "security": [
  4647. {
  4648. "bearerAuth": []
  4649. }
  4650. ],
  4651. "responses": {
  4652. "200": {
  4653. "description": "Principals",
  4654. "content": {
  4655. "application/json": {
  4656. "schema": {
  4657. "type": "object",
  4658. "properties": {
  4659. "data": {
  4660. "type": "array",
  4661. "items": {
  4662. "$ref": "#/components/schemas/Principal"
  4663. }
  4664. }
  4665. }
  4666. }
  4667. }
  4668. }
  4669. },
  4670. "401": {
  4671. "description": "Missing, invalid, revoked or expired API key",
  4672. "content": {
  4673. "application/json": {
  4674. "schema": {
  4675. "$ref": "#/components/schemas/Error"
  4676. }
  4677. }
  4678. }
  4679. },
  4680. "404": {
  4681. "description": "Caller is not an admin anywhere",
  4682. "content": {
  4683. "application/json": {
  4684. "schema": {
  4685. "$ref": "#/components/schemas/Error"
  4686. }
  4687. }
  4688. }
  4689. }
  4690. }
  4691. },
  4692. "post": {
  4693. "summary": "Create a principal with one API key. The key is returned once (Cache-Control: no-store). Needs admin on at least one namespace; the new principal has no grants.",
  4694. "security": [
  4695. {
  4696. "bearerAuth": []
  4697. }
  4698. ],
  4699. "requestBody": {
  4700. "required": true,
  4701. "content": {
  4702. "application/json": {
  4703. "schema": {
  4704. "$ref": "#/components/schemas/PrincipalRequest"
  4705. }
  4706. }
  4707. }
  4708. },
  4709. "responses": {
  4710. "201": {
  4711. "description": "Created",
  4712. "content": {
  4713. "application/json": {
  4714. "schema": {
  4715. "$ref": "#/components/schemas/PrincipalCreated"
  4716. }
  4717. }
  4718. }
  4719. },
  4720. "400": {
  4721. "description": "Body is not valid JSON",
  4722. "content": {
  4723. "application/json": {
  4724. "schema": {
  4725. "$ref": "#/components/schemas/Error"
  4726. }
  4727. }
  4728. }
  4729. },
  4730. "401": {
  4731. "description": "Missing, invalid, revoked or expired API key",
  4732. "content": {
  4733. "application/json": {
  4734. "schema": {
  4735. "$ref": "#/components/schemas/Error"
  4736. }
  4737. }
  4738. }
  4739. },
  4740. "404": {
  4741. "description": "Caller is not an admin anywhere",
  4742. "content": {
  4743. "application/json": {
  4744. "schema": {
  4745. "$ref": "#/components/schemas/Error"
  4746. }
  4747. }
  4748. }
  4749. },
  4750. "422": {
  4751. "description": "Validation failed",
  4752. "content": {
  4753. "application/json": {
  4754. "schema": {
  4755. "$ref": "#/components/schemas/Error"
  4756. }
  4757. }
  4758. }
  4759. },
  4760. "500": {
  4761. "description": "Internal error",
  4762. "content": {
  4763. "application/json": {
  4764. "schema": {
  4765. "$ref": "#/components/schemas/Error"
  4766. }
  4767. }
  4768. }
  4769. }
  4770. }
  4771. }
  4772. },
  4773. "/principals/{id}": {
  4774. "get": {
  4775. "summary": "A principal. Keys (prefix and state, never the key) are listed when the caller may manage the principal; grants are those on namespaces the caller administers (all of them for the caller itself).",
  4776. "security": [
  4777. {
  4778. "bearerAuth": []
  4779. }
  4780. ],
  4781. "parameters": [
  4782. {
  4783. "name": "id",
  4784. "in": "path",
  4785. "required": true,
  4786. "schema": {
  4787. "type": "string",
  4788. "format": "uuid"
  4789. }
  4790. }
  4791. ],
  4792. "responses": {
  4793. "200": {
  4794. "description": "Principal",
  4795. "content": {
  4796. "application/json": {
  4797. "schema": {
  4798. "$ref": "#/components/schemas/PrincipalDetail"
  4799. }
  4800. }
  4801. }
  4802. },
  4803. "401": {
  4804. "description": "Missing, invalid, revoked or expired API key",
  4805. "content": {
  4806. "application/json": {
  4807. "schema": {
  4808. "$ref": "#/components/schemas/Error"
  4809. }
  4810. }
  4811. }
  4812. },
  4813. "404": {
  4814. "description": "Not found, or the caller is not an admin and not this principal",
  4815. "content": {
  4816. "application/json": {
  4817. "schema": {
  4818. "$ref": "#/components/schemas/Error"
  4819. }
  4820. }
  4821. }
  4822. }
  4823. }
  4824. },
  4825. "patch": {
  4826. "summary": "Disable or re-enable a principal. Needs admin on every namespace the principal has a grant on (inheriting where the grant inherits). A principal cannot change its own status.",
  4827. "security": [
  4828. {
  4829. "bearerAuth": []
  4830. }
  4831. ],
  4832. "parameters": [
  4833. {
  4834. "name": "id",
  4835. "in": "path",
  4836. "required": true,
  4837. "schema": {
  4838. "type": "string",
  4839. "format": "uuid"
  4840. }
  4841. }
  4842. ],
  4843. "requestBody": {
  4844. "required": true,
  4845. "content": {
  4846. "application/json": {
  4847. "schema": {
  4848. "$ref": "#/components/schemas/PrincipalUpdate"
  4849. }
  4850. }
  4851. }
  4852. },
  4853. "responses": {
  4854. "200": {
  4855. "description": "Updated",
  4856. "content": {
  4857. "application/json": {
  4858. "schema": {
  4859. "$ref": "#/components/schemas/Principal"
  4860. }
  4861. }
  4862. }
  4863. },
  4864. "400": {
  4865. "description": "Body is not valid JSON",
  4866. "content": {
  4867. "application/json": {
  4868. "schema": {
  4869. "$ref": "#/components/schemas/Error"
  4870. }
  4871. }
  4872. }
  4873. },
  4874. "401": {
  4875. "description": "Missing, invalid, revoked or expired API key",
  4876. "content": {
  4877. "application/json": {
  4878. "schema": {
  4879. "$ref": "#/components/schemas/Error"
  4880. }
  4881. }
  4882. }
  4883. },
  4884. "404": {
  4885. "description": "Not found or not manageable by the caller",
  4886. "content": {
  4887. "application/json": {
  4888. "schema": {
  4889. "$ref": "#/components/schemas/Error"
  4890. }
  4891. }
  4892. }
  4893. },
  4894. "422": {
  4895. "description": "Validation failed, or cannot_change_self",
  4896. "content": {
  4897. "application/json": {
  4898. "schema": {
  4899. "$ref": "#/components/schemas/Error"
  4900. }
  4901. }
  4902. }
  4903. },
  4904. "500": {
  4905. "description": "Internal error",
  4906. "content": {
  4907. "application/json": {
  4908. "schema": {
  4909. "$ref": "#/components/schemas/Error"
  4910. }
  4911. }
  4912. }
  4913. }
  4914. }
  4915. }
  4916. },
  4917. "/principals/{id}/keys": {
  4918. "post": {
  4919. "summary": "Issue another API key (returned once). Allowed for the caller's own principal, or for a principal the caller may manage (see PATCH /principals/{id}), so a key never gives more access than the caller has.",
  4920. "security": [
  4921. {
  4922. "bearerAuth": []
  4923. }
  4924. ],
  4925. "parameters": [
  4926. {
  4927. "name": "id",
  4928. "in": "path",
  4929. "required": true,
  4930. "schema": {
  4931. "type": "string",
  4932. "format": "uuid"
  4933. }
  4934. }
  4935. ],
  4936. "responses": {
  4937. "201": {
  4938. "description": "Created",
  4939. "content": {
  4940. "application/json": {
  4941. "schema": {
  4942. "$ref": "#/components/schemas/KeyCreated"
  4943. }
  4944. }
  4945. }
  4946. },
  4947. "401": {
  4948. "description": "Missing, invalid, revoked or expired API key",
  4949. "content": {
  4950. "application/json": {
  4951. "schema": {
  4952. "$ref": "#/components/schemas/Error"
  4953. }
  4954. }
  4955. }
  4956. },
  4957. "404": {
  4958. "description": "Not found or not manageable by the caller",
  4959. "content": {
  4960. "application/json": {
  4961. "schema": {
  4962. "$ref": "#/components/schemas/Error"
  4963. }
  4964. }
  4965. }
  4966. },
  4967. "409": {
  4968. "description": "principal_not_active",
  4969. "content": {
  4970. "application/json": {
  4971. "schema": {
  4972. "$ref": "#/components/schemas/Error"
  4973. }
  4974. }
  4975. }
  4976. },
  4977. "500": {
  4978. "description": "Internal error",
  4979. "content": {
  4980. "application/json": {
  4981. "schema": {
  4982. "$ref": "#/components/schemas/Error"
  4983. }
  4984. }
  4985. }
  4986. }
  4987. }
  4988. }
  4989. },
  4990. "/keys/{id}": {
  4991. "delete": {
  4992. "summary": "Revoke an API key (idempotent). Same rule as issuing keys.",
  4993. "security": [
  4994. {
  4995. "bearerAuth": []
  4996. }
  4997. ],
  4998. "parameters": [
  4999. {
  5000. "name": "id",
  5001. "in": "path",
  5002. "required": true,
  5003. "schema": {
  5004. "type": "string",
  5005. "format": "uuid"
  5006. }
  5007. }
  5008. ],
  5009. "responses": {
  5010. "200": {
  5011. "description": "Revoked",
  5012. "content": {
  5013. "application/json": {
  5014. "schema": {
  5015. "type": "object",
  5016. "properties": {
  5017. "id": {
  5018. "type": "string"
  5019. },
  5020. "principal_id": {
  5021. "type": "string"
  5022. },
  5023. "status": {
  5024. "type": "string",
  5025. "enum": [
  5026. "revoked"
  5027. ]
  5028. }
  5029. }
  5030. }
  5031. }
  5032. }
  5033. },
  5034. "401": {
  5035. "description": "Missing, invalid, revoked or expired API key",
  5036. "content": {
  5037. "application/json": {
  5038. "schema": {
  5039. "$ref": "#/components/schemas/Error"
  5040. }
  5041. }
  5042. }
  5043. },
  5044. "404": {
  5045. "description": "Not found or not manageable by the caller",
  5046. "content": {
  5047. "application/json": {
  5048. "schema": {
  5049. "$ref": "#/components/schemas/Error"
  5050. }
  5051. }
  5052. }
  5053. },
  5054. "500": {
  5055. "description": "Internal error",
  5056. "content": {
  5057. "application/json": {
  5058. "schema": {
  5059. "$ref": "#/components/schemas/Error"
  5060. }
  5061. }
  5062. }
  5063. }
  5064. }
  5065. }
  5066. },
  5067. "/grants": {
  5068. "get": {
  5069. "summary": "Grants on namespaces the caller administers.",
  5070. "security": [
  5071. {
  5072. "bearerAuth": []
  5073. }
  5074. ],
  5075. "parameters": [
  5076. {
  5077. "name": "namespace_id",
  5078. "in": "query",
  5079. "schema": {
  5080. "type": "string",
  5081. "format": "uuid"
  5082. }
  5083. },
  5084. {
  5085. "name": "principal_id",
  5086. "in": "query",
  5087. "schema": {
  5088. "type": "string",
  5089. "format": "uuid"
  5090. }
  5091. }
  5092. ],
  5093. "responses": {
  5094. "200": {
  5095. "description": "Grants",
  5096. "content": {
  5097. "application/json": {
  5098. "schema": {
  5099. "type": "object",
  5100. "properties": {
  5101. "data": {
  5102. "type": "array",
  5103. "items": {
  5104. "$ref": "#/components/schemas/Grant"
  5105. }
  5106. }
  5107. }
  5108. }
  5109. }
  5110. }
  5111. },
  5112. "401": {
  5113. "description": "Missing, invalid, revoked or expired API key",
  5114. "content": {
  5115. "application/json": {
  5116. "schema": {
  5117. "$ref": "#/components/schemas/Error"
  5118. }
  5119. }
  5120. }
  5121. },
  5122. "404": {
  5123. "description": "Caller is not an admin anywhere",
  5124. "content": {
  5125. "application/json": {
  5126. "schema": {
  5127. "$ref": "#/components/schemas/Error"
  5128. }
  5129. }
  5130. }
  5131. },
  5132. "422": {
  5133. "description": "Validation failed",
  5134. "content": {
  5135. "application/json": {
  5136. "schema": {
  5137. "$ref": "#/components/schemas/Error"
  5138. }
  5139. }
  5140. }
  5141. }
  5142. }
  5143. },
  5144. "post": {
  5145. "summary": "Grant permissions on a namespace to an active principal of the tenant. Needs admin on the namespace; inherit (default true) needs admin that also covers its descendants. One grant per principal and namespace.",
  5146. "security": [
  5147. {
  5148. "bearerAuth": []
  5149. }
  5150. ],
  5151. "requestBody": {
  5152. "required": true,
  5153. "content": {
  5154. "application/json": {
  5155. "schema": {
  5156. "$ref": "#/components/schemas/GrantRequest"
  5157. }
  5158. }
  5159. }
  5160. },
  5161. "responses": {
  5162. "201": {
  5163. "description": "Created",
  5164. "content": {
  5165. "application/json": {
  5166. "schema": {
  5167. "$ref": "#/components/schemas/Grant"
  5168. }
  5169. }
  5170. }
  5171. },
  5172. "400": {
  5173. "description": "Body is not valid JSON",
  5174. "content": {
  5175. "application/json": {
  5176. "schema": {
  5177. "$ref": "#/components/schemas/Error"
  5178. }
  5179. }
  5180. }
  5181. },
  5182. "401": {
  5183. "description": "Missing, invalid, revoked or expired API key",
  5184. "content": {
  5185. "application/json": {
  5186. "schema": {
  5187. "$ref": "#/components/schemas/Error"
  5188. }
  5189. }
  5190. }
  5191. },
  5192. "404": {
  5193. "description": "Namespace not found or caller lacks admin on it",
  5194. "content": {
  5195. "application/json": {
  5196. "schema": {
  5197. "$ref": "#/components/schemas/Error"
  5198. }
  5199. }
  5200. }
  5201. },
  5202. "409": {
  5203. "description": "grant_exists",
  5204. "content": {
  5205. "application/json": {
  5206. "schema": {
  5207. "$ref": "#/components/schemas/Error"
  5208. }
  5209. }
  5210. }
  5211. },
  5212. "422": {
  5213. "description": "Validation failed, principal_not_found or inherit_not_allowed",
  5214. "content": {
  5215. "application/json": {
  5216. "schema": {
  5217. "$ref": "#/components/schemas/Error"
  5218. }
  5219. }
  5220. }
  5221. },
  5222. "500": {
  5223. "description": "Internal error",
  5224. "content": {
  5225. "application/json": {
  5226. "schema": {
  5227. "$ref": "#/components/schemas/Error"
  5228. }
  5229. }
  5230. }
  5231. }
  5232. }
  5233. }
  5234. },
  5235. "/grants/{id}": {
  5236. "delete": {
  5237. "summary": "Remove a grant. Needs admin on its namespace; a principal cannot remove its own grants.",
  5238. "security": [
  5239. {
  5240. "bearerAuth": []
  5241. }
  5242. ],
  5243. "parameters": [
  5244. {
  5245. "name": "id",
  5246. "in": "path",
  5247. "required": true,
  5248. "schema": {
  5249. "type": "string",
  5250. "format": "uuid"
  5251. }
  5252. }
  5253. ],
  5254. "responses": {
  5255. "200": {
  5256. "description": "Deleted",
  5257. "content": {
  5258. "application/json": {
  5259. "schema": {
  5260. "type": "object",
  5261. "properties": {
  5262. "id": {
  5263. "type": "string"
  5264. },
  5265. "deleted": {
  5266. "type": "boolean"
  5267. }
  5268. }
  5269. }
  5270. }
  5271. }
  5272. },
  5273. "401": {
  5274. "description": "Missing, invalid, revoked or expired API key",
  5275. "content": {
  5276. "application/json": {
  5277. "schema": {
  5278. "$ref": "#/components/schemas/Error"
  5279. }
  5280. }
  5281. }
  5282. },
  5283. "404": {
  5284. "description": "Not found or caller lacks admin on its namespace",
  5285. "content": {
  5286. "application/json": {
  5287. "schema": {
  5288. "$ref": "#/components/schemas/Error"
  5289. }
  5290. }
  5291. }
  5292. },
  5293. "422": {
  5294. "description": "cannot_change_self",
  5295. "content": {
  5296. "application/json": {
  5297. "schema": {
  5298. "$ref": "#/components/schemas/Error"
  5299. }
  5300. }
  5301. }
  5302. },
  5303. "500": {
  5304. "description": "Internal error",
  5305. "content": {
  5306. "application/json": {
  5307. "schema": {
  5308. "$ref": "#/components/schemas/Error"
  5309. }
  5310. }
  5311. }
  5312. }
  5313. }
  5314. }
  5315. },
  5316. "/consolidations": {
  5317. "post": {
  5318. "summary": "Group similar experiences of a namespace (deterministic word overlap, no generative model) and return a draft candidate per group. With propose true (needs write), every group with at least min_size experiences not yet cited by any candidate is filed as a proposed candidate tagged 'consolidated' that cites them as evidence; review it like any other candidate. Read permission is enough for a dry run.",
  5319. "security": [
  5320. {
  5321. "bearerAuth": []
  5322. }
  5323. ],
  5324. "requestBody": {
  5325. "required": true,
  5326. "content": {
  5327. "application/json": {
  5328. "schema": {
  5329. "$ref": "#/components/schemas/ConsolidationRequest"
  5330. }
  5331. }
  5332. }
  5333. },
  5334. "responses": {
  5335. "200": {
  5336. "description": "Groups (largest first, at most 20)",
  5337. "content": {
  5338. "application/json": {
  5339. "schema": {
  5340. "$ref": "#/components/schemas/ConsolidationResult"
  5341. }
  5342. }
  5343. }
  5344. },
  5345. "400": {
  5346. "description": "Body is not valid JSON",
  5347. "content": {
  5348. "application/json": {
  5349. "schema": {
  5350. "$ref": "#/components/schemas/Error"
  5351. }
  5352. }
  5353. }
  5354. },
  5355. "401": {
  5356. "description": "Missing, invalid, revoked or expired API key",
  5357. "content": {
  5358. "application/json": {
  5359. "schema": {
  5360. "$ref": "#/components/schemas/Error"
  5361. }
  5362. }
  5363. }
  5364. },
  5365. "404": {
  5366. "description": "namespace_not_found (also without read, or without write when proposing)",
  5367. "content": {
  5368. "application/json": {
  5369. "schema": {
  5370. "$ref": "#/components/schemas/Error"
  5371. }
  5372. }
  5373. }
  5374. },
  5375. "422": {
  5376. "description": "Validation failed",
  5377. "content": {
  5378. "application/json": {
  5379. "schema": {
  5380. "$ref": "#/components/schemas/Error"
  5381. }
  5382. }
  5383. }
  5384. },
  5385. "500": {
  5386. "description": "Internal error",
  5387. "content": {
  5388. "application/json": {
  5389. "schema": {
  5390. "$ref": "#/components/schemas/Error"
  5391. }
  5392. }
  5393. }
  5394. }
  5395. }
  5396. }
  5397. }
  5398. }
  5399. }

Powered by TurnKey Linux.