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.

6761 lignes
180KB

  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "Agent Memory API",
  5. "version": "1.0.0-phase4",
  6. "description": "Universal AI Agent Memory platform, phases 1-4: 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). Phase 4: HTML ingestion (format html), entities and typed, evidence-backed relationships between entities, memories and documents (POST /relate, reviewed like candidates) and bounded traversal (POST /graph/traverse) that never reveals what the caller cannot read."
  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. 2
  1175. ],
  1176. "description": "Imports accept versions 1 and 2."
  1177. },
  1178. "exported_at": {
  1179. "type": "string"
  1180. },
  1181. "data": {
  1182. "type": "object",
  1183. "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[]}]}], entities [{id, namespace, type, canonical_key, name, aliases, description, properties, created_by, created_at, updated_at}] (version 2), relationships [{id, namespace, source_kind, source_id, target_kind, target_id, type, description, confidence, valid_from, valid_until, inferred, state, author, reviewer, review_notes, created_at, reviewed_at}] (version 2; only edges whose namespace and both endpoints are exported), evidence_links [{id, owner_kind (memory or relationship), owner_id, owner_revision, target_kind, target_id, target_revision, role, excerpt, created_by, created_at}]. Not exported: sessions, experiences, candidates, feedback, retrieval telemetry, audit events.",
  1184. "properties": {
  1185. "namespaces": {
  1186. "type": "array",
  1187. "items": {
  1188. "type": "object"
  1189. }
  1190. },
  1191. "memories": {
  1192. "type": "array",
  1193. "items": {
  1194. "type": "object"
  1195. }
  1196. },
  1197. "documents": {
  1198. "type": "array",
  1199. "items": {
  1200. "type": "object"
  1201. }
  1202. },
  1203. "evidence_links": {
  1204. "type": "array",
  1205. "items": {
  1206. "type": "object"
  1207. }
  1208. },
  1209. "entities": {
  1210. "type": "array",
  1211. "items": {
  1212. "type": "object"
  1213. }
  1214. },
  1215. "relationships": {
  1216. "type": "array",
  1217. "items": {
  1218. "type": "object"
  1219. }
  1220. }
  1221. }
  1222. },
  1223. "counts": {
  1224. "type": "object",
  1225. "additionalProperties": {
  1226. "type": "integer"
  1227. },
  1228. "description": "namespaces, memories, memory_revisions, verifications, documents, document_revisions, chunks, entities, relationships, relationships_omitted, evidence_links, evidence_links_omitted"
  1229. },
  1230. "integrity": {
  1231. "type": "object",
  1232. "properties": {
  1233. "algorithm": {
  1234. "type": "string",
  1235. "enum": [
  1236. "sha256"
  1237. ]
  1238. },
  1239. "digest": {
  1240. "type": "string",
  1241. "description": "Hex SHA-256 of the exact UTF-8 text of the data value as it appears in the document; any reformatting breaks it."
  1242. }
  1243. }
  1244. }
  1245. }
  1246. },
  1247. "ImportResult": {
  1248. "type": "object",
  1249. "properties": {
  1250. "imported": {
  1251. "type": "object",
  1252. "additionalProperties": {
  1253. "type": "integer"
  1254. },
  1255. "description": "namespaces, memories, memory_revisions, verifications, documents, document_revisions, chunks, entities, relationships, evidence_links, placeholder_principals (author ids unknown to this installation, created without keys or grants)"
  1256. },
  1257. "indexing": {
  1258. "type": "object",
  1259. "properties": {
  1260. "lexical": {
  1261. "type": "string"
  1262. },
  1263. "semantic": {
  1264. "type": "string"
  1265. }
  1266. }
  1267. }
  1268. }
  1269. },
  1270. "Grant": {
  1271. "type": "object",
  1272. "properties": {
  1273. "id": {
  1274. "type": "string",
  1275. "format": "uuid"
  1276. },
  1277. "principal_id": {
  1278. "type": "string",
  1279. "format": "uuid"
  1280. },
  1281. "namespace_id": {
  1282. "type": "string",
  1283. "format": "uuid"
  1284. },
  1285. "path": {
  1286. "type": "string"
  1287. },
  1288. "permissions": {
  1289. "type": "array",
  1290. "items": {
  1291. "type": "string",
  1292. "enum": [
  1293. "read",
  1294. "write",
  1295. "delete",
  1296. "verify",
  1297. "admin"
  1298. ]
  1299. }
  1300. },
  1301. "inherit": {
  1302. "type": "boolean"
  1303. },
  1304. "expires_at": {
  1305. "type": "string",
  1306. "nullable": true
  1307. },
  1308. "created_at": {
  1309. "type": "string",
  1310. "example": "2026-12-05 18:00:00"
  1311. }
  1312. }
  1313. },
  1314. "Me": {
  1315. "type": "object",
  1316. "properties": {
  1317. "principal_id": {
  1318. "type": "string",
  1319. "format": "uuid"
  1320. },
  1321. "tenant_id": {
  1322. "type": "string",
  1323. "format": "uuid"
  1324. },
  1325. "name": {
  1326. "type": "string"
  1327. },
  1328. "type": {
  1329. "type": "string"
  1330. },
  1331. "grants": {
  1332. "type": "array",
  1333. "items": {
  1334. "$ref": "#/components/schemas/Grant"
  1335. }
  1336. }
  1337. }
  1338. },
  1339. "Namespace": {
  1340. "type": "object",
  1341. "properties": {
  1342. "id": {
  1343. "type": "string",
  1344. "format": "uuid"
  1345. },
  1346. "path": {
  1347. "type": "string"
  1348. },
  1349. "parent_id": {
  1350. "type": "string",
  1351. "nullable": true
  1352. },
  1353. "permissions": {
  1354. "type": "array",
  1355. "items": {
  1356. "type": "string",
  1357. "enum": [
  1358. "read",
  1359. "write",
  1360. "delete",
  1361. "verify",
  1362. "admin"
  1363. ]
  1364. }
  1365. },
  1366. "created_at": {
  1367. "type": "string",
  1368. "example": "2026-12-05 18:00:00"
  1369. }
  1370. }
  1371. },
  1372. "NamespaceRequest": {
  1373. "type": "object",
  1374. "required": [
  1375. "path"
  1376. ],
  1377. "properties": {
  1378. "path": {
  1379. "type": "string",
  1380. "example": "/team/project-x",
  1381. "description": "Lower-case a-z, 0-9, '-', '_' and '.' segments separated by '/' (upper case is folded)."
  1382. }
  1383. }
  1384. },
  1385. "NamespaceCreated": {
  1386. "type": "object",
  1387. "properties": {
  1388. "id": {
  1389. "type": "string",
  1390. "format": "uuid"
  1391. },
  1392. "path": {
  1393. "type": "string"
  1394. },
  1395. "parent_id": {
  1396. "type": "string",
  1397. "nullable": true
  1398. },
  1399. "namespaces_created": {
  1400. "type": "integer",
  1401. "description": "1 plus the number of missing parents created"
  1402. }
  1403. }
  1404. },
  1405. "Principal": {
  1406. "type": "object",
  1407. "properties": {
  1408. "id": {
  1409. "type": "string",
  1410. "format": "uuid"
  1411. },
  1412. "name": {
  1413. "type": "string"
  1414. },
  1415. "type": {
  1416. "type": "string",
  1417. "enum": [
  1418. "human",
  1419. "agent",
  1420. "service"
  1421. ]
  1422. },
  1423. "status": {
  1424. "type": "string",
  1425. "enum": [
  1426. "active",
  1427. "disabled",
  1428. "imported"
  1429. ]
  1430. },
  1431. "created_at": {
  1432. "type": "string",
  1433. "example": "2026-12-05 18:00:00"
  1434. }
  1435. }
  1436. },
  1437. "PrincipalRequest": {
  1438. "type": "object",
  1439. "required": [
  1440. "name",
  1441. "type"
  1442. ],
  1443. "properties": {
  1444. "name": {
  1445. "type": "string",
  1446. "maxLength": 200
  1447. },
  1448. "type": {
  1449. "type": "string",
  1450. "enum": [
  1451. "human",
  1452. "agent",
  1453. "service"
  1454. ]
  1455. }
  1456. }
  1457. },
  1458. "PrincipalUpdate": {
  1459. "type": "object",
  1460. "required": [
  1461. "status"
  1462. ],
  1463. "properties": {
  1464. "status": {
  1465. "type": "string",
  1466. "enum": [
  1467. "active",
  1468. "disabled"
  1469. ]
  1470. }
  1471. }
  1472. },
  1473. "ApiKeyCreated": {
  1474. "type": "object",
  1475. "properties": {
  1476. "id": {
  1477. "type": "string",
  1478. "format": "uuid"
  1479. },
  1480. "key": {
  1481. "type": "string",
  1482. "description": "The secret, shown only in this response"
  1483. },
  1484. "prefix": {
  1485. "type": "string"
  1486. },
  1487. "created_at": {
  1488. "type": "string",
  1489. "example": "2026-12-05 18:00:00"
  1490. },
  1491. "note": {
  1492. "type": "string"
  1493. }
  1494. }
  1495. },
  1496. "PrincipalCreated": {
  1497. "type": "object",
  1498. "properties": {
  1499. "principal": {
  1500. "$ref": "#/components/schemas/Principal"
  1501. },
  1502. "api_key": {
  1503. "$ref": "#/components/schemas/ApiKeyCreated"
  1504. }
  1505. }
  1506. },
  1507. "KeyCreated": {
  1508. "type": "object",
  1509. "properties": {
  1510. "principal_id": {
  1511. "type": "string",
  1512. "format": "uuid"
  1513. },
  1514. "api_key": {
  1515. "$ref": "#/components/schemas/ApiKeyCreated"
  1516. }
  1517. }
  1518. },
  1519. "PrincipalDetail": {
  1520. "allOf": [
  1521. {
  1522. "$ref": "#/components/schemas/Principal"
  1523. },
  1524. {
  1525. "type": "object",
  1526. "properties": {
  1527. "keys": {
  1528. "type": "array",
  1529. "nullable": true,
  1530. "description": "null when the caller may not manage this principal",
  1531. "items": {
  1532. "type": "object",
  1533. "properties": {
  1534. "id": {
  1535. "type": "string",
  1536. "format": "uuid"
  1537. },
  1538. "prefix": {
  1539. "type": "string"
  1540. },
  1541. "status": {
  1542. "type": "string"
  1543. },
  1544. "created_at": {
  1545. "type": "string",
  1546. "example": "2026-12-05 18:00:00"
  1547. },
  1548. "expires_at": {
  1549. "type": "string",
  1550. "nullable": true
  1551. },
  1552. "last_used_at": {
  1553. "type": "string",
  1554. "nullable": true
  1555. }
  1556. }
  1557. }
  1558. },
  1559. "grants": {
  1560. "type": "array",
  1561. "items": {
  1562. "$ref": "#/components/schemas/Grant"
  1563. }
  1564. }
  1565. }
  1566. }
  1567. ]
  1568. },
  1569. "GrantRequest": {
  1570. "type": "object",
  1571. "required": [
  1572. "principal_id",
  1573. "namespace_id",
  1574. "permissions"
  1575. ],
  1576. "properties": {
  1577. "principal_id": {
  1578. "type": "string",
  1579. "format": "uuid"
  1580. },
  1581. "namespace_id": {
  1582. "type": "string",
  1583. "format": "uuid"
  1584. },
  1585. "permissions": {
  1586. "type": "array",
  1587. "items": {
  1588. "type": "string",
  1589. "enum": [
  1590. "read",
  1591. "write",
  1592. "delete",
  1593. "verify",
  1594. "admin"
  1595. ]
  1596. }
  1597. },
  1598. "inherit": {
  1599. "type": "boolean",
  1600. "default": true
  1601. },
  1602. "expires_at": {
  1603. "type": "string",
  1604. "description": "UTC, YYYY-MM-DD HH:MM:SS, in the future"
  1605. }
  1606. }
  1607. },
  1608. "ConsolidationRequest": {
  1609. "type": "object",
  1610. "required": [
  1611. "namespace_id"
  1612. ],
  1613. "properties": {
  1614. "namespace_id": {
  1615. "type": "string",
  1616. "format": "uuid",
  1617. "description": "Experiences of this namespace only (not its descendants)"
  1618. },
  1619. "since": {
  1620. "type": "string",
  1621. "example": "2026-12-01",
  1622. "description": "Only experiences recorded at or after this UTC date/time"
  1623. },
  1624. "min_size": {
  1625. "type": "integer",
  1626. "minimum": 2,
  1627. "maximum": 50,
  1628. "default": 2
  1629. },
  1630. "similarity": {
  1631. "type": "number",
  1632. "minimum": 0.1,
  1633. "maximum": 0.95,
  1634. "default": 0.35,
  1635. "description": "Jaccard threshold over significant words; pairs must also share at least 2 words"
  1636. },
  1637. "max_experiences": {
  1638. "type": "integer",
  1639. "minimum": 10,
  1640. "maximum": 500,
  1641. "default": 300,
  1642. "description": "Most recent experiences considered"
  1643. },
  1644. "propose": {
  1645. "type": "boolean",
  1646. "default": false
  1647. }
  1648. }
  1649. },
  1650. "ConsolidationResult": {
  1651. "type": "object",
  1652. "properties": {
  1653. "namespace_id": {
  1654. "type": "string"
  1655. },
  1656. "experiences_considered": {
  1657. "type": "integer"
  1658. },
  1659. "similarity": {
  1660. "type": "number"
  1661. },
  1662. "min_size": {
  1663. "type": "integer"
  1664. },
  1665. "candidates_created": {
  1666. "type": "integer"
  1667. },
  1668. "groups": {
  1669. "type": "array",
  1670. "items": {
  1671. "type": "object",
  1672. "properties": {
  1673. "size": {
  1674. "type": "integer"
  1675. },
  1676. "sessions": {
  1677. "type": "integer"
  1678. },
  1679. "outcomes": {
  1680. "type": "object",
  1681. "properties": {
  1682. "success": {
  1683. "type": "integer"
  1684. },
  1685. "failure": {
  1686. "type": "integer"
  1687. },
  1688. "partial": {
  1689. "type": "integer"
  1690. },
  1691. "unknown": {
  1692. "type": "integer"
  1693. }
  1694. }
  1695. },
  1696. "first_seen": {
  1697. "type": "string"
  1698. },
  1699. "last_seen": {
  1700. "type": "string"
  1701. },
  1702. "terms": {
  1703. "type": "array",
  1704. "items": {
  1705. "type": "string"
  1706. }
  1707. },
  1708. "experience_ids": {
  1709. "type": "array",
  1710. "items": {
  1711. "type": "string"
  1712. },
  1713. "description": "Newest first"
  1714. },
  1715. "already_cited": {
  1716. "type": "integer",
  1717. "description": "Members already cited as evidence by a candidate"
  1718. },
  1719. "draft": {
  1720. "type": "object",
  1721. "properties": {
  1722. "type": {
  1723. "type": "string",
  1724. "enum": [
  1725. "lesson",
  1726. "solution"
  1727. ]
  1728. },
  1729. "title": {
  1730. "type": "string"
  1731. },
  1732. "content": {
  1733. "type": "string"
  1734. }
  1735. }
  1736. },
  1737. "candidate_id": {
  1738. "type": "string",
  1739. "nullable": true
  1740. }
  1741. }
  1742. }
  1743. }
  1744. }
  1745. },
  1746. "NodeRef": {
  1747. "type": "object",
  1748. "required": [
  1749. "kind",
  1750. "id"
  1751. ],
  1752. "properties": {
  1753. "kind": {
  1754. "type": "string",
  1755. "enum": [
  1756. "entity",
  1757. "memory",
  1758. "document"
  1759. ]
  1760. },
  1761. "id": {
  1762. "type": "string",
  1763. "format": "uuid"
  1764. }
  1765. }
  1766. },
  1767. "EntityRequest": {
  1768. "type": "object",
  1769. "required": [
  1770. "namespace_id",
  1771. "type",
  1772. "name"
  1773. ],
  1774. "properties": {
  1775. "namespace_id": {
  1776. "type": "string",
  1777. "format": "uuid"
  1778. },
  1779. "type": {
  1780. "type": "string",
  1781. "pattern": "^[a-z][a-z0-9_-]{0,39}$",
  1782. "description": "Kind of entity, for example component, concept, person, tool."
  1783. },
  1784. "name": {
  1785. "type": "string",
  1786. "maxLength": 200
  1787. },
  1788. "canonical_key": {
  1789. "type": "string",
  1790. "maxLength": 200,
  1791. "description": "Unique per namespace and type; lower-cased with whitespace collapsed. Defaults to the name normalized the same way."
  1792. },
  1793. "aliases": {
  1794. "type": "array",
  1795. "maxItems": 32,
  1796. "items": {
  1797. "type": "string",
  1798. "maxLength": 200
  1799. }
  1800. },
  1801. "description": {
  1802. "type": "string",
  1803. "maxLength": 2000
  1804. },
  1805. "properties": {
  1806. "type": "object",
  1807. "description": "Free JSON object, at most 16 KB."
  1808. }
  1809. }
  1810. },
  1811. "EntityUpdate": {
  1812. "type": "object",
  1813. "description": "Type, canonical key and namespace cannot change.",
  1814. "properties": {
  1815. "name": {
  1816. "type": "string",
  1817. "maxLength": 200
  1818. },
  1819. "aliases": {
  1820. "type": "array",
  1821. "maxItems": 32,
  1822. "items": {
  1823. "type": "string",
  1824. "maxLength": 200
  1825. }
  1826. },
  1827. "description": {
  1828. "type": "string",
  1829. "maxLength": 2000
  1830. },
  1831. "properties": {
  1832. "type": "object",
  1833. "description": "Free JSON object, at most 16 KB."
  1834. }
  1835. }
  1836. },
  1837. "Entity": {
  1838. "type": "object",
  1839. "properties": {
  1840. "id": {
  1841. "type": "string",
  1842. "format": "uuid"
  1843. },
  1844. "namespace_id": {
  1845. "type": "string",
  1846. "format": "uuid"
  1847. },
  1848. "type": {
  1849. "type": "string"
  1850. },
  1851. "canonical_key": {
  1852. "type": "string"
  1853. },
  1854. "name": {
  1855. "type": "string"
  1856. },
  1857. "aliases": {
  1858. "type": "array",
  1859. "items": {
  1860. "type": "string"
  1861. }
  1862. },
  1863. "description": {
  1864. "type": "string",
  1865. "nullable": true
  1866. },
  1867. "properties": {
  1868. "type": "object"
  1869. },
  1870. "created_by": {
  1871. "type": "string"
  1872. },
  1873. "created_at": {
  1874. "type": "string"
  1875. },
  1876. "updated_at": {
  1877. "type": "string"
  1878. }
  1879. }
  1880. },
  1881. "RelateRequest": {
  1882. "type": "object",
  1883. "required": [
  1884. "namespace_id",
  1885. "source",
  1886. "target",
  1887. "type",
  1888. "evidence"
  1889. ],
  1890. "properties": {
  1891. "namespace_id": {
  1892. "type": "string",
  1893. "format": "uuid",
  1894. "description": "Namespace the edge belongs to (write permission needed)."
  1895. },
  1896. "source": {
  1897. "$ref": "#/components/schemas/NodeRef"
  1898. },
  1899. "target": {
  1900. "$ref": "#/components/schemas/NodeRef"
  1901. },
  1902. "type": {
  1903. "type": "string",
  1904. "pattern": "^[A-Za-z][A-Za-z0-9_]{1,39}$",
  1905. "description": "Upper-cased on input. Examples: IS_A, PART_OF, DEPENDS_ON, IMPLEMENTS, CALLS, SOLVES, CONTRADICTS, SUPERSEDES, VERIFIED_BY, RELATES_TO."
  1906. },
  1907. "description": {
  1908. "type": "string",
  1909. "maxLength": 2000
  1910. },
  1911. "confidence": {
  1912. "type": "number",
  1913. "minimum": 0,
  1914. "maximum": 1
  1915. },
  1916. "valid_from": {
  1917. "type": "string",
  1918. "example": "2027-01-31 18:00:00",
  1919. "description": "UTC; the edge is followed only from this time."
  1920. },
  1921. "valid_until": {
  1922. "type": "string",
  1923. "example": "2028-01-31 18:00:00",
  1924. "description": "UTC; the edge is no longer followed from this time."
  1925. },
  1926. "inferred": {
  1927. "type": "boolean",
  1928. "default": false,
  1929. "description": "True for links derived by inference rather than stated by a source."
  1930. },
  1931. "evidence": {
  1932. "type": "array",
  1933. "minItems": 1,
  1934. "maxItems": 20,
  1935. "items": {
  1936. "$ref": "#/components/schemas/EvidenceInput"
  1937. },
  1938. "description": "Required: graph assertions need evidence."
  1939. }
  1940. }
  1941. },
  1942. "Relationship": {
  1943. "type": "object",
  1944. "properties": {
  1945. "id": {
  1946. "type": "string",
  1947. "format": "uuid"
  1948. },
  1949. "namespace_id": {
  1950. "type": "string",
  1951. "format": "uuid"
  1952. },
  1953. "source": {
  1954. "$ref": "#/components/schemas/NodeRef"
  1955. },
  1956. "target": {
  1957. "$ref": "#/components/schemas/NodeRef"
  1958. },
  1959. "type": {
  1960. "type": "string"
  1961. },
  1962. "description": {
  1963. "type": "string",
  1964. "nullable": true
  1965. },
  1966. "confidence": {
  1967. "type": "number",
  1968. "nullable": true
  1969. },
  1970. "valid_from": {
  1971. "type": "string",
  1972. "nullable": true
  1973. },
  1974. "valid_until": {
  1975. "type": "string",
  1976. "nullable": true
  1977. },
  1978. "inferred": {
  1979. "type": "boolean"
  1980. },
  1981. "state": {
  1982. "type": "string",
  1983. "enum": [
  1984. "proposed",
  1985. "accepted",
  1986. "rejected"
  1987. ]
  1988. },
  1989. "author": {
  1990. "type": "string"
  1991. },
  1992. "reviewer": {
  1993. "type": "string",
  1994. "nullable": true
  1995. },
  1996. "review_notes": {
  1997. "type": "string",
  1998. "nullable": true
  1999. },
  2000. "created_at": {
  2001. "type": "string"
  2002. },
  2003. "reviewed_at": {
  2004. "type": "string",
  2005. "nullable": true
  2006. },
  2007. "evidence": {
  2008. "type": "array",
  2009. "items": {
  2010. "$ref": "#/components/schemas/EvidenceItem"
  2011. },
  2012. "description": "Only in GET /relationships/{id}."
  2013. }
  2014. }
  2015. },
  2016. "RelationshipReviewRequest": {
  2017. "type": "object",
  2018. "required": [
  2019. "decision"
  2020. ],
  2021. "properties": {
  2022. "decision": {
  2023. "type": "string",
  2024. "enum": [
  2025. "accept",
  2026. "reject"
  2027. ]
  2028. },
  2029. "notes": {
  2030. "type": "string",
  2031. "maxLength": 2000
  2032. }
  2033. }
  2034. },
  2035. "TraverseRequest": {
  2036. "type": "object",
  2037. "required": [
  2038. "start"
  2039. ],
  2040. "properties": {
  2041. "start": {
  2042. "$ref": "#/components/schemas/NodeRef"
  2043. },
  2044. "direction": {
  2045. "type": "string",
  2046. "enum": [
  2047. "out",
  2048. "in",
  2049. "both"
  2050. ],
  2051. "default": "both"
  2052. },
  2053. "max_depth": {
  2054. "type": "integer",
  2055. "minimum": 1,
  2056. "maximum": 3,
  2057. "default": 2
  2058. },
  2059. "max_nodes": {
  2060. "type": "integer",
  2061. "minimum": 1,
  2062. "maximum": 100,
  2063. "default": 50
  2064. },
  2065. "types": {
  2066. "type": "array",
  2067. "maxItems": 20,
  2068. "items": {
  2069. "type": "string"
  2070. },
  2071. "description": "Only follow edges of these types."
  2072. },
  2073. "include_proposed": {
  2074. "type": "boolean",
  2075. "default": false,
  2076. "description": "Also follow proposed (not yet reviewed) edges."
  2077. }
  2078. }
  2079. },
  2080. "GraphNode": {
  2081. "type": "object",
  2082. "properties": {
  2083. "kind": {
  2084. "type": "string",
  2085. "enum": [
  2086. "entity",
  2087. "memory",
  2088. "document"
  2089. ]
  2090. },
  2091. "id": {
  2092. "type": "string",
  2093. "format": "uuid"
  2094. },
  2095. "depth": {
  2096. "type": "integer"
  2097. },
  2098. "namespace_id": {
  2099. "type": "string"
  2100. },
  2101. "label": {
  2102. "type": "string",
  2103. "description": "Entity name, memory title or document title."
  2104. },
  2105. "type": {
  2106. "type": "string",
  2107. "description": "Entity type or memory type."
  2108. },
  2109. "status": {
  2110. "type": "string",
  2111. "description": "Memories: lifecycle status."
  2112. },
  2113. "revision": {
  2114. "type": "integer"
  2115. },
  2116. "verification_status": {
  2117. "type": "string"
  2118. },
  2119. "content_trust": {
  2120. "type": "string",
  2121. "description": "Documents: untrusted_reference."
  2122. }
  2123. }
  2124. },
  2125. "TraverseResult": {
  2126. "type": "object",
  2127. "properties": {
  2128. "start": {
  2129. "$ref": "#/components/schemas/NodeRef"
  2130. },
  2131. "direction": {
  2132. "type": "string"
  2133. },
  2134. "max_depth": {
  2135. "type": "integer"
  2136. },
  2137. "nodes": {
  2138. "type": "array",
  2139. "items": {
  2140. "$ref": "#/components/schemas/GraphNode"
  2141. }
  2142. },
  2143. "edges": {
  2144. "type": "array",
  2145. "items": {
  2146. "$ref": "#/components/schemas/Relationship"
  2147. }
  2148. },
  2149. "truncated": {
  2150. "type": "boolean",
  2151. "description": "True when the node or edge limit cut the result short."
  2152. }
  2153. }
  2154. }
  2155. }
  2156. },
  2157. "paths": {
  2158. "/remember": {
  2159. "post": {
  2160. "summary": "Create a memory",
  2161. "security": [
  2162. {
  2163. "bearerAuth": []
  2164. }
  2165. ],
  2166. "parameters": [
  2167. {
  2168. "name": "Idempotency-Key",
  2169. "in": "header",
  2170. "required": false,
  2171. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  2172. "schema": {
  2173. "type": "string",
  2174. "maxLength": 200
  2175. }
  2176. }
  2177. ],
  2178. "requestBody": {
  2179. "required": true,
  2180. "content": {
  2181. "application/json": {
  2182. "schema": {
  2183. "$ref": "#/components/schemas/RememberRequest"
  2184. }
  2185. }
  2186. }
  2187. },
  2188. "responses": {
  2189. "201": {
  2190. "description": "Created",
  2191. "content": {
  2192. "application/json": {
  2193. "schema": {
  2194. "$ref": "#/components/schemas/RememberResponse"
  2195. }
  2196. }
  2197. }
  2198. },
  2199. "200": {
  2200. "description": "Exact duplicate (or idempotent replay of a 200)",
  2201. "content": {
  2202. "application/json": {
  2203. "schema": {
  2204. "$ref": "#/components/schemas/RememberResponse"
  2205. }
  2206. }
  2207. }
  2208. },
  2209. "400": {
  2210. "description": "Invalid JSON / body",
  2211. "content": {
  2212. "application/json": {
  2213. "schema": {
  2214. "$ref": "#/components/schemas/Error"
  2215. }
  2216. }
  2217. }
  2218. },
  2219. "409": {
  2220. "description": "Idempotency-Key reused with a different body",
  2221. "content": {
  2222. "application/json": {
  2223. "schema": {
  2224. "$ref": "#/components/schemas/Error"
  2225. }
  2226. }
  2227. }
  2228. },
  2229. "422": {
  2230. "description": "Validation failed",
  2231. "content": {
  2232. "application/json": {
  2233. "schema": {
  2234. "$ref": "#/components/schemas/Error"
  2235. }
  2236. }
  2237. }
  2238. },
  2239. "401": {
  2240. "description": "Missing, invalid, revoked or expired API key",
  2241. "content": {
  2242. "application/json": {
  2243. "schema": {
  2244. "$ref": "#/components/schemas/Error"
  2245. }
  2246. }
  2247. }
  2248. },
  2249. "404": {
  2250. "description": "Not found or not visible to the caller",
  2251. "content": {
  2252. "application/json": {
  2253. "schema": {
  2254. "$ref": "#/components/schemas/Error"
  2255. }
  2256. }
  2257. }
  2258. },
  2259. "500": {
  2260. "description": "Internal error",
  2261. "content": {
  2262. "application/json": {
  2263. "schema": {
  2264. "$ref": "#/components/schemas/Error"
  2265. }
  2266. }
  2267. }
  2268. }
  2269. }
  2270. }
  2271. },
  2272. "/memories": {
  2273. "get": {
  2274. "summary": "List memories (newest first)",
  2275. "security": [
  2276. {
  2277. "bearerAuth": []
  2278. }
  2279. ],
  2280. "parameters": [
  2281. {
  2282. "name": "namespace_id",
  2283. "in": "query",
  2284. "schema": {
  2285. "type": "string",
  2286. "format": "uuid"
  2287. }
  2288. },
  2289. {
  2290. "name": "type",
  2291. "in": "query",
  2292. "schema": {
  2293. "type": "string"
  2294. }
  2295. },
  2296. {
  2297. "name": "status",
  2298. "in": "query",
  2299. "schema": {
  2300. "type": "string",
  2301. "enum": [
  2302. "active",
  2303. "retired",
  2304. "superseded",
  2305. "all"
  2306. ],
  2307. "default": "active"
  2308. }
  2309. },
  2310. {
  2311. "name": "verification_status",
  2312. "in": "query",
  2313. "schema": {
  2314. "type": "string",
  2315. "enum": [
  2316. "unverified",
  2317. "verified",
  2318. "disputed",
  2319. "rejected"
  2320. ]
  2321. }
  2322. },
  2323. {
  2324. "name": "limit",
  2325. "in": "query",
  2326. "schema": {
  2327. "type": "integer",
  2328. "minimum": 1,
  2329. "maximum": 100,
  2330. "default": 20
  2331. }
  2332. },
  2333. {
  2334. "name": "cursor",
  2335. "in": "query",
  2336. "description": "next_cursor from the previous page",
  2337. "schema": {
  2338. "type": "string"
  2339. }
  2340. }
  2341. ],
  2342. "responses": {
  2343. "200": {
  2344. "description": "Page of memories",
  2345. "content": {
  2346. "application/json": {
  2347. "schema": {
  2348. "type": "object",
  2349. "properties": {
  2350. "data": {
  2351. "type": "array",
  2352. "items": {
  2353. "$ref": "#/components/schemas/Memory"
  2354. }
  2355. },
  2356. "next_cursor": {
  2357. "type": "string",
  2358. "nullable": true
  2359. }
  2360. }
  2361. }
  2362. }
  2363. }
  2364. },
  2365. "400": {
  2366. "description": "Invalid cursor",
  2367. "content": {
  2368. "application/json": {
  2369. "schema": {
  2370. "$ref": "#/components/schemas/Error"
  2371. }
  2372. }
  2373. }
  2374. },
  2375. "422": {
  2376. "description": "Invalid filter",
  2377. "content": {
  2378. "application/json": {
  2379. "schema": {
  2380. "$ref": "#/components/schemas/Error"
  2381. }
  2382. }
  2383. }
  2384. },
  2385. "401": {
  2386. "description": "Missing, invalid, revoked or expired API key",
  2387. "content": {
  2388. "application/json": {
  2389. "schema": {
  2390. "$ref": "#/components/schemas/Error"
  2391. }
  2392. }
  2393. }
  2394. },
  2395. "404": {
  2396. "description": "Not found or not visible to the caller",
  2397. "content": {
  2398. "application/json": {
  2399. "schema": {
  2400. "$ref": "#/components/schemas/Error"
  2401. }
  2402. }
  2403. }
  2404. },
  2405. "500": {
  2406. "description": "Internal error",
  2407. "content": {
  2408. "application/json": {
  2409. "schema": {
  2410. "$ref": "#/components/schemas/Error"
  2411. }
  2412. }
  2413. }
  2414. }
  2415. }
  2416. }
  2417. },
  2418. "/memories/{id}": {
  2419. "get": {
  2420. "summary": "Get a memory (optionally an older revision)",
  2421. "security": [
  2422. {
  2423. "bearerAuth": []
  2424. }
  2425. ],
  2426. "parameters": [
  2427. {
  2428. "name": "id",
  2429. "in": "path",
  2430. "required": true,
  2431. "schema": {
  2432. "type": "string",
  2433. "format": "uuid"
  2434. }
  2435. },
  2436. {
  2437. "name": "revision",
  2438. "in": "query",
  2439. "schema": {
  2440. "type": "integer"
  2441. }
  2442. }
  2443. ],
  2444. "responses": {
  2445. "200": {
  2446. "description": "The memory",
  2447. "content": {
  2448. "application/json": {
  2449. "schema": {
  2450. "type": "object",
  2451. "properties": {
  2452. "data": {
  2453. "$ref": "#/components/schemas/Memory"
  2454. }
  2455. }
  2456. }
  2457. }
  2458. }
  2459. },
  2460. "401": {
  2461. "description": "Missing, invalid, revoked or expired API key",
  2462. "content": {
  2463. "application/json": {
  2464. "schema": {
  2465. "$ref": "#/components/schemas/Error"
  2466. }
  2467. }
  2468. }
  2469. },
  2470. "404": {
  2471. "description": "Not found or not visible to the caller",
  2472. "content": {
  2473. "application/json": {
  2474. "schema": {
  2475. "$ref": "#/components/schemas/Error"
  2476. }
  2477. }
  2478. }
  2479. },
  2480. "500": {
  2481. "description": "Internal error",
  2482. "content": {
  2483. "application/json": {
  2484. "schema": {
  2485. "$ref": "#/components/schemas/Error"
  2486. }
  2487. }
  2488. }
  2489. }
  2490. }
  2491. },
  2492. "patch": {
  2493. "summary": "Correct a memory: creates the next revision, unverified",
  2494. "security": [
  2495. {
  2496. "bearerAuth": []
  2497. }
  2498. ],
  2499. "parameters": [
  2500. {
  2501. "name": "id",
  2502. "in": "path",
  2503. "required": true,
  2504. "schema": {
  2505. "type": "string",
  2506. "format": "uuid"
  2507. }
  2508. },
  2509. {
  2510. "name": "If-Match",
  2511. "in": "header",
  2512. "required": false,
  2513. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  2514. "schema": {
  2515. "type": "string"
  2516. }
  2517. }
  2518. ],
  2519. "requestBody": {
  2520. "required": true,
  2521. "content": {
  2522. "application/json": {
  2523. "schema": {
  2524. "type": "object",
  2525. "properties": {
  2526. "title": {
  2527. "type": "string"
  2528. },
  2529. "summary": {
  2530. "type": "string"
  2531. },
  2532. "content": {
  2533. "type": "string"
  2534. },
  2535. "tags": {
  2536. "type": "array",
  2537. "items": {
  2538. "type": "string"
  2539. }
  2540. },
  2541. "attributes": {
  2542. "type": "object"
  2543. },
  2544. "confidence": {
  2545. "type": "number"
  2546. },
  2547. "importance": {
  2548. "type": "number"
  2549. },
  2550. "change_reason": {
  2551. "type": "string"
  2552. },
  2553. "expected_revision": {
  2554. "type": "integer"
  2555. }
  2556. }
  2557. }
  2558. }
  2559. }
  2560. },
  2561. "responses": {
  2562. "200": {
  2563. "description": "New revision",
  2564. "content": {
  2565. "application/json": {
  2566. "schema": {
  2567. "$ref": "#/components/schemas/RememberResponse"
  2568. }
  2569. }
  2570. }
  2571. },
  2572. "400": {
  2573. "description": "Bad body / revision",
  2574. "content": {
  2575. "application/json": {
  2576. "schema": {
  2577. "$ref": "#/components/schemas/Error"
  2578. }
  2579. }
  2580. }
  2581. },
  2582. "409": {
  2583. "description": "Memory is not active",
  2584. "content": {
  2585. "application/json": {
  2586. "schema": {
  2587. "$ref": "#/components/schemas/Error"
  2588. }
  2589. }
  2590. }
  2591. },
  2592. "412": {
  2593. "description": "Stale revision (ETag header carries the current one)",
  2594. "content": {
  2595. "application/json": {
  2596. "schema": {
  2597. "$ref": "#/components/schemas/Error"
  2598. }
  2599. }
  2600. }
  2601. },
  2602. "422": {
  2603. "description": "Validation failed",
  2604. "content": {
  2605. "application/json": {
  2606. "schema": {
  2607. "$ref": "#/components/schemas/Error"
  2608. }
  2609. }
  2610. }
  2611. },
  2612. "428": {
  2613. "description": "If-Match missing",
  2614. "content": {
  2615. "application/json": {
  2616. "schema": {
  2617. "$ref": "#/components/schemas/Error"
  2618. }
  2619. }
  2620. }
  2621. },
  2622. "401": {
  2623. "description": "Missing, invalid, revoked or expired API key",
  2624. "content": {
  2625. "application/json": {
  2626. "schema": {
  2627. "$ref": "#/components/schemas/Error"
  2628. }
  2629. }
  2630. }
  2631. },
  2632. "404": {
  2633. "description": "Not found or not visible to the caller",
  2634. "content": {
  2635. "application/json": {
  2636. "schema": {
  2637. "$ref": "#/components/schemas/Error"
  2638. }
  2639. }
  2640. }
  2641. },
  2642. "500": {
  2643. "description": "Internal error",
  2644. "content": {
  2645. "application/json": {
  2646. "schema": {
  2647. "$ref": "#/components/schemas/Error"
  2648. }
  2649. }
  2650. }
  2651. }
  2652. }
  2653. },
  2654. "delete": {
  2655. "summary": "Forget: permanently delete the memory and its revisions (needs delete permission)",
  2656. "security": [
  2657. {
  2658. "bearerAuth": []
  2659. }
  2660. ],
  2661. "parameters": [
  2662. {
  2663. "name": "id",
  2664. "in": "path",
  2665. "required": true,
  2666. "schema": {
  2667. "type": "string",
  2668. "format": "uuid"
  2669. }
  2670. }
  2671. ],
  2672. "responses": {
  2673. "200": {
  2674. "description": "Deleted"
  2675. },
  2676. "401": {
  2677. "description": "Missing, invalid, revoked or expired API key",
  2678. "content": {
  2679. "application/json": {
  2680. "schema": {
  2681. "$ref": "#/components/schemas/Error"
  2682. }
  2683. }
  2684. }
  2685. },
  2686. "404": {
  2687. "description": "Not found or not visible to the caller",
  2688. "content": {
  2689. "application/json": {
  2690. "schema": {
  2691. "$ref": "#/components/schemas/Error"
  2692. }
  2693. }
  2694. }
  2695. },
  2696. "500": {
  2697. "description": "Internal error",
  2698. "content": {
  2699. "application/json": {
  2700. "schema": {
  2701. "$ref": "#/components/schemas/Error"
  2702. }
  2703. }
  2704. }
  2705. }
  2706. }
  2707. }
  2708. },
  2709. "/memories/{id}/retire": {
  2710. "post": {
  2711. "summary": "Retire: exclude from ordinary listing",
  2712. "security": [
  2713. {
  2714. "bearerAuth": []
  2715. }
  2716. ],
  2717. "parameters": [
  2718. {
  2719. "name": "id",
  2720. "in": "path",
  2721. "required": true,
  2722. "schema": {
  2723. "type": "string",
  2724. "format": "uuid"
  2725. }
  2726. }
  2727. ],
  2728. "responses": {
  2729. "200": {
  2730. "description": "Retired"
  2731. },
  2732. "401": {
  2733. "description": "Missing, invalid, revoked or expired API key",
  2734. "content": {
  2735. "application/json": {
  2736. "schema": {
  2737. "$ref": "#/components/schemas/Error"
  2738. }
  2739. }
  2740. }
  2741. },
  2742. "404": {
  2743. "description": "Not found or not visible to the caller",
  2744. "content": {
  2745. "application/json": {
  2746. "schema": {
  2747. "$ref": "#/components/schemas/Error"
  2748. }
  2749. }
  2750. }
  2751. },
  2752. "500": {
  2753. "description": "Internal error",
  2754. "content": {
  2755. "application/json": {
  2756. "schema": {
  2757. "$ref": "#/components/schemas/Error"
  2758. }
  2759. }
  2760. }
  2761. }
  2762. }
  2763. }
  2764. },
  2765. "/memories/{id}/versions": {
  2766. "get": {
  2767. "summary": "Revision history, newest first",
  2768. "security": [
  2769. {
  2770. "bearerAuth": []
  2771. }
  2772. ],
  2773. "parameters": [
  2774. {
  2775. "name": "id",
  2776. "in": "path",
  2777. "required": true,
  2778. "schema": {
  2779. "type": "string",
  2780. "format": "uuid"
  2781. }
  2782. }
  2783. ],
  2784. "responses": {
  2785. "200": {
  2786. "description": "Revisions"
  2787. },
  2788. "401": {
  2789. "description": "Missing, invalid, revoked or expired API key",
  2790. "content": {
  2791. "application/json": {
  2792. "schema": {
  2793. "$ref": "#/components/schemas/Error"
  2794. }
  2795. }
  2796. }
  2797. },
  2798. "404": {
  2799. "description": "Not found or not visible to the caller",
  2800. "content": {
  2801. "application/json": {
  2802. "schema": {
  2803. "$ref": "#/components/schemas/Error"
  2804. }
  2805. }
  2806. }
  2807. },
  2808. "500": {
  2809. "description": "Internal error",
  2810. "content": {
  2811. "application/json": {
  2812. "schema": {
  2813. "$ref": "#/components/schemas/Error"
  2814. }
  2815. }
  2816. }
  2817. }
  2818. }
  2819. }
  2820. },
  2821. "/sessions": {
  2822. "post": {
  2823. "summary": "Start a session",
  2824. "security": [
  2825. {
  2826. "bearerAuth": []
  2827. }
  2828. ],
  2829. "parameters": [
  2830. {
  2831. "name": "Idempotency-Key",
  2832. "in": "header",
  2833. "required": false,
  2834. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  2835. "schema": {
  2836. "type": "string",
  2837. "maxLength": 200
  2838. }
  2839. }
  2840. ],
  2841. "requestBody": {
  2842. "required": true,
  2843. "content": {
  2844. "application/json": {
  2845. "schema": {
  2846. "type": "object",
  2847. "required": [
  2848. "namespace_id",
  2849. "objective"
  2850. ],
  2851. "properties": {
  2852. "namespace_id": {
  2853. "type": "string",
  2854. "format": "uuid"
  2855. },
  2856. "objective": {
  2857. "type": "string",
  2858. "maxLength": 2000
  2859. }
  2860. }
  2861. }
  2862. }
  2863. }
  2864. },
  2865. "responses": {
  2866. "201": {
  2867. "description": "Started"
  2868. },
  2869. "422": {
  2870. "description": "Validation failed",
  2871. "content": {
  2872. "application/json": {
  2873. "schema": {
  2874. "$ref": "#/components/schemas/Error"
  2875. }
  2876. }
  2877. }
  2878. },
  2879. "409": {
  2880. "description": "Idempotency conflict",
  2881. "content": {
  2882. "application/json": {
  2883. "schema": {
  2884. "$ref": "#/components/schemas/Error"
  2885. }
  2886. }
  2887. }
  2888. },
  2889. "401": {
  2890. "description": "Missing, invalid, revoked or expired API key",
  2891. "content": {
  2892. "application/json": {
  2893. "schema": {
  2894. "$ref": "#/components/schemas/Error"
  2895. }
  2896. }
  2897. }
  2898. },
  2899. "404": {
  2900. "description": "Not found or not visible to the caller",
  2901. "content": {
  2902. "application/json": {
  2903. "schema": {
  2904. "$ref": "#/components/schemas/Error"
  2905. }
  2906. }
  2907. }
  2908. },
  2909. "500": {
  2910. "description": "Internal error",
  2911. "content": {
  2912. "application/json": {
  2913. "schema": {
  2914. "$ref": "#/components/schemas/Error"
  2915. }
  2916. }
  2917. }
  2918. }
  2919. }
  2920. }
  2921. },
  2922. "/sessions/{id}/state": {
  2923. "get": {
  2924. "summary": "Restore the latest checkpoint (revision 0 / state null when none)",
  2925. "security": [
  2926. {
  2927. "bearerAuth": []
  2928. }
  2929. ],
  2930. "parameters": [
  2931. {
  2932. "name": "id",
  2933. "in": "path",
  2934. "required": true,
  2935. "schema": {
  2936. "type": "string",
  2937. "format": "uuid"
  2938. }
  2939. }
  2940. ],
  2941. "responses": {
  2942. "200": {
  2943. "description": "Checkpoint; ETag = revision"
  2944. },
  2945. "401": {
  2946. "description": "Missing, invalid, revoked or expired API key",
  2947. "content": {
  2948. "application/json": {
  2949. "schema": {
  2950. "$ref": "#/components/schemas/Error"
  2951. }
  2952. }
  2953. }
  2954. },
  2955. "404": {
  2956. "description": "Not found or not visible to the caller",
  2957. "content": {
  2958. "application/json": {
  2959. "schema": {
  2960. "$ref": "#/components/schemas/Error"
  2961. }
  2962. }
  2963. }
  2964. },
  2965. "500": {
  2966. "description": "Internal error",
  2967. "content": {
  2968. "application/json": {
  2969. "schema": {
  2970. "$ref": "#/components/schemas/Error"
  2971. }
  2972. }
  2973. }
  2974. }
  2975. }
  2976. },
  2977. "put": {
  2978. "summary": "Save a checkpoint (If-Match = current checkpoint revision, 0 for the first)",
  2979. "security": [
  2980. {
  2981. "bearerAuth": []
  2982. }
  2983. ],
  2984. "parameters": [
  2985. {
  2986. "name": "id",
  2987. "in": "path",
  2988. "required": true,
  2989. "schema": {
  2990. "type": "string",
  2991. "format": "uuid"
  2992. }
  2993. },
  2994. {
  2995. "name": "If-Match",
  2996. "in": "header",
  2997. "required": false,
  2998. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  2999. "schema": {
  3000. "type": "string"
  3001. }
  3002. }
  3003. ],
  3004. "requestBody": {
  3005. "required": true,
  3006. "content": {
  3007. "application/json": {
  3008. "schema": {
  3009. "$ref": "#/components/schemas/SaveStateRequest"
  3010. }
  3011. }
  3012. }
  3013. },
  3014. "responses": {
  3015. "200": {
  3016. "description": "Saved; ETag = new revision"
  3017. },
  3018. "409": {
  3019. "description": "Session closed",
  3020. "content": {
  3021. "application/json": {
  3022. "schema": {
  3023. "$ref": "#/components/schemas/Error"
  3024. }
  3025. }
  3026. }
  3027. },
  3028. "412": {
  3029. "description": "Stale revision",
  3030. "content": {
  3031. "application/json": {
  3032. "schema": {
  3033. "$ref": "#/components/schemas/Error"
  3034. }
  3035. }
  3036. }
  3037. },
  3038. "422": {
  3039. "description": "Validation failed",
  3040. "content": {
  3041. "application/json": {
  3042. "schema": {
  3043. "$ref": "#/components/schemas/Error"
  3044. }
  3045. }
  3046. }
  3047. },
  3048. "428": {
  3049. "description": "If-Match missing",
  3050. "content": {
  3051. "application/json": {
  3052. "schema": {
  3053. "$ref": "#/components/schemas/Error"
  3054. }
  3055. }
  3056. }
  3057. },
  3058. "401": {
  3059. "description": "Missing, invalid, revoked or expired API key",
  3060. "content": {
  3061. "application/json": {
  3062. "schema": {
  3063. "$ref": "#/components/schemas/Error"
  3064. }
  3065. }
  3066. }
  3067. },
  3068. "404": {
  3069. "description": "Not found or not visible to the caller",
  3070. "content": {
  3071. "application/json": {
  3072. "schema": {
  3073. "$ref": "#/components/schemas/Error"
  3074. }
  3075. }
  3076. }
  3077. },
  3078. "500": {
  3079. "description": "Internal error",
  3080. "content": {
  3081. "application/json": {
  3082. "schema": {
  3083. "$ref": "#/components/schemas/Error"
  3084. }
  3085. }
  3086. }
  3087. }
  3088. }
  3089. }
  3090. },
  3091. "/sessions/{id}/complete": {
  3092. "post": {
  3093. "summary": "Complete a session",
  3094. "security": [
  3095. {
  3096. "bearerAuth": []
  3097. }
  3098. ],
  3099. "parameters": [
  3100. {
  3101. "name": "id",
  3102. "in": "path",
  3103. "required": true,
  3104. "schema": {
  3105. "type": "string",
  3106. "format": "uuid"
  3107. }
  3108. }
  3109. ],
  3110. "requestBody": {
  3111. "required": false,
  3112. "content": {
  3113. "application/json": {
  3114. "schema": {
  3115. "type": "object",
  3116. "properties": {
  3117. "outcome": {
  3118. "type": "string",
  3119. "maxLength": 4000
  3120. }
  3121. }
  3122. }
  3123. }
  3124. }
  3125. },
  3126. "responses": {
  3127. "200": {
  3128. "description": "Completed"
  3129. },
  3130. "409": {
  3131. "description": "Already closed",
  3132. "content": {
  3133. "application/json": {
  3134. "schema": {
  3135. "$ref": "#/components/schemas/Error"
  3136. }
  3137. }
  3138. }
  3139. },
  3140. "401": {
  3141. "description": "Missing, invalid, revoked or expired API key",
  3142. "content": {
  3143. "application/json": {
  3144. "schema": {
  3145. "$ref": "#/components/schemas/Error"
  3146. }
  3147. }
  3148. }
  3149. },
  3150. "404": {
  3151. "description": "Not found or not visible to the caller",
  3152. "content": {
  3153. "application/json": {
  3154. "schema": {
  3155. "$ref": "#/components/schemas/Error"
  3156. }
  3157. }
  3158. }
  3159. },
  3160. "500": {
  3161. "description": "Internal error",
  3162. "content": {
  3163. "application/json": {
  3164. "schema": {
  3165. "$ref": "#/components/schemas/Error"
  3166. }
  3167. }
  3168. }
  3169. }
  3170. }
  3171. }
  3172. },
  3173. "/memories/{id}/verifications": {
  3174. "post": {
  3175. "summary": "Record a verification of the current revision (needs the verify permission)",
  3176. "security": [
  3177. {
  3178. "bearerAuth": []
  3179. }
  3180. ],
  3181. "parameters": [
  3182. {
  3183. "name": "id",
  3184. "in": "path",
  3185. "required": true,
  3186. "schema": {
  3187. "type": "string",
  3188. "format": "uuid"
  3189. }
  3190. }
  3191. ],
  3192. "requestBody": {
  3193. "required": true,
  3194. "content": {
  3195. "application/json": {
  3196. "schema": {
  3197. "$ref": "#/components/schemas/VerifyRequest"
  3198. }
  3199. }
  3200. }
  3201. },
  3202. "responses": {
  3203. "200": {
  3204. "description": "Recorded; returns the new verification_status"
  3205. },
  3206. "409": {
  3207. "description": "Not the current revision",
  3208. "content": {
  3209. "application/json": {
  3210. "schema": {
  3211. "$ref": "#/components/schemas/Error"
  3212. }
  3213. }
  3214. }
  3215. },
  3216. "422": {
  3217. "description": "Validation failed",
  3218. "content": {
  3219. "application/json": {
  3220. "schema": {
  3221. "$ref": "#/components/schemas/Error"
  3222. }
  3223. }
  3224. }
  3225. },
  3226. "401": {
  3227. "description": "Missing, invalid, revoked or expired API key",
  3228. "content": {
  3229. "application/json": {
  3230. "schema": {
  3231. "$ref": "#/components/schemas/Error"
  3232. }
  3233. }
  3234. }
  3235. },
  3236. "404": {
  3237. "description": "Not found or not visible to the caller",
  3238. "content": {
  3239. "application/json": {
  3240. "schema": {
  3241. "$ref": "#/components/schemas/Error"
  3242. }
  3243. }
  3244. }
  3245. },
  3246. "500": {
  3247. "description": "Internal error",
  3248. "content": {
  3249. "application/json": {
  3250. "schema": {
  3251. "$ref": "#/components/schemas/Error"
  3252. }
  3253. }
  3254. }
  3255. }
  3256. }
  3257. }
  3258. },
  3259. "/recall": {
  3260. "post": {
  3261. "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",
  3262. "security": [
  3263. {
  3264. "bearerAuth": []
  3265. }
  3266. ],
  3267. "requestBody": {
  3268. "required": true,
  3269. "content": {
  3270. "application/json": {
  3271. "schema": {
  3272. "$ref": "#/components/schemas/RecallRequest"
  3273. }
  3274. }
  3275. }
  3276. },
  3277. "responses": {
  3278. "200": {
  3279. "description": "Ranked results with warnings"
  3280. },
  3281. "422": {
  3282. "description": "Validation failed",
  3283. "content": {
  3284. "application/json": {
  3285. "schema": {
  3286. "$ref": "#/components/schemas/Error"
  3287. }
  3288. }
  3289. }
  3290. },
  3291. "401": {
  3292. "description": "Missing, invalid, revoked or expired API key",
  3293. "content": {
  3294. "application/json": {
  3295. "schema": {
  3296. "$ref": "#/components/schemas/Error"
  3297. }
  3298. }
  3299. }
  3300. },
  3301. "404": {
  3302. "description": "Not found or not visible to the caller",
  3303. "content": {
  3304. "application/json": {
  3305. "schema": {
  3306. "$ref": "#/components/schemas/Error"
  3307. }
  3308. }
  3309. }
  3310. },
  3311. "500": {
  3312. "description": "Internal error",
  3313. "content": {
  3314. "application/json": {
  3315. "schema": {
  3316. "$ref": "#/components/schemas/Error"
  3317. }
  3318. }
  3319. }
  3320. }
  3321. },
  3322. "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."
  3323. }
  3324. },
  3325. "/ingestion/jobs": {
  3326. "post": {
  3327. "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.",
  3328. "security": [
  3329. {
  3330. "bearerAuth": []
  3331. }
  3332. ],
  3333. "parameters": [
  3334. {
  3335. "name": "Idempotency-Key",
  3336. "in": "header",
  3337. "required": false,
  3338. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  3339. "schema": {
  3340. "type": "string",
  3341. "maxLength": 200
  3342. }
  3343. }
  3344. ],
  3345. "requestBody": {
  3346. "required": true,
  3347. "content": {
  3348. "application/json": {
  3349. "schema": {
  3350. "$ref": "#/components/schemas/IngestRequest"
  3351. }
  3352. }
  3353. }
  3354. },
  3355. "responses": {
  3356. "201": {
  3357. "description": "Ingested (new document or new revision)",
  3358. "content": {
  3359. "application/json": {
  3360. "schema": {
  3361. "$ref": "#/components/schemas/IngestResponse"
  3362. }
  3363. }
  3364. }
  3365. },
  3366. "200": {
  3367. "description": "Unchanged or idempotent replay",
  3368. "content": {
  3369. "application/json": {
  3370. "schema": {
  3371. "$ref": "#/components/schemas/IngestResponse"
  3372. }
  3373. }
  3374. }
  3375. },
  3376. "400": {
  3377. "description": "Invalid JSON",
  3378. "content": {
  3379. "application/json": {
  3380. "schema": {
  3381. "$ref": "#/components/schemas/Error"
  3382. }
  3383. }
  3384. }
  3385. },
  3386. "409": {
  3387. "description": "Idempotency-Key reused with a different body",
  3388. "content": {
  3389. "application/json": {
  3390. "schema": {
  3391. "$ref": "#/components/schemas/Error"
  3392. }
  3393. }
  3394. }
  3395. },
  3396. "422": {
  3397. "description": "Validation failed",
  3398. "content": {
  3399. "application/json": {
  3400. "schema": {
  3401. "$ref": "#/components/schemas/Error"
  3402. }
  3403. }
  3404. }
  3405. },
  3406. "401": {
  3407. "description": "Missing, invalid, revoked or expired API key",
  3408. "content": {
  3409. "application/json": {
  3410. "schema": {
  3411. "$ref": "#/components/schemas/Error"
  3412. }
  3413. }
  3414. }
  3415. },
  3416. "404": {
  3417. "description": "Not found or not visible to the caller",
  3418. "content": {
  3419. "application/json": {
  3420. "schema": {
  3421. "$ref": "#/components/schemas/Error"
  3422. }
  3423. }
  3424. }
  3425. },
  3426. "500": {
  3427. "description": "Internal error. When the job was already stored, its input is kept and the worker retries it (Location: the job)",
  3428. "content": {
  3429. "application/json": {
  3430. "schema": {
  3431. "$ref": "#/components/schemas/Error"
  3432. }
  3433. }
  3434. }
  3435. },
  3436. "202": {
  3437. "description": "Queued (async): job reference; the worker publishes the revision",
  3438. "content": {
  3439. "application/json": {
  3440. "schema": {
  3441. "$ref": "#/components/schemas/JobQueued"
  3442. }
  3443. }
  3444. }
  3445. }
  3446. }
  3447. }
  3448. },
  3449. "/jobs/{id}": {
  3450. "get": {
  3451. "summary": "Ingestion job state",
  3452. "security": [
  3453. {
  3454. "bearerAuth": []
  3455. }
  3456. ],
  3457. "parameters": [
  3458. {
  3459. "name": "id",
  3460. "in": "path",
  3461. "required": true,
  3462. "schema": {
  3463. "type": "string",
  3464. "format": "uuid"
  3465. }
  3466. }
  3467. ],
  3468. "responses": {
  3469. "200": {
  3470. "description": "Job",
  3471. "content": {
  3472. "application/json": {
  3473. "schema": {
  3474. "$ref": "#/components/schemas/Job"
  3475. }
  3476. }
  3477. }
  3478. },
  3479. "401": {
  3480. "description": "Missing, invalid, revoked or expired API key",
  3481. "content": {
  3482. "application/json": {
  3483. "schema": {
  3484. "$ref": "#/components/schemas/Error"
  3485. }
  3486. }
  3487. }
  3488. },
  3489. "404": {
  3490. "description": "Not found or not visible to the caller",
  3491. "content": {
  3492. "application/json": {
  3493. "schema": {
  3494. "$ref": "#/components/schemas/Error"
  3495. }
  3496. }
  3497. }
  3498. },
  3499. "500": {
  3500. "description": "Internal error",
  3501. "content": {
  3502. "application/json": {
  3503. "schema": {
  3504. "$ref": "#/components/schemas/Error"
  3505. }
  3506. }
  3507. }
  3508. }
  3509. }
  3510. }
  3511. },
  3512. "/jobs/{id}/retry": {
  3513. "post": {
  3514. "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.",
  3515. "security": [
  3516. {
  3517. "bearerAuth": []
  3518. }
  3519. ],
  3520. "parameters": [
  3521. {
  3522. "name": "id",
  3523. "in": "path",
  3524. "required": true,
  3525. "schema": {
  3526. "type": "string",
  3527. "format": "uuid"
  3528. }
  3529. }
  3530. ],
  3531. "responses": {
  3532. "202": {
  3533. "description": "Queued",
  3534. "content": {
  3535. "application/json": {
  3536. "schema": {
  3537. "$ref": "#/components/schemas/JobQueued"
  3538. }
  3539. }
  3540. }
  3541. },
  3542. "401": {
  3543. "description": "Missing, invalid, revoked or expired API key",
  3544. "content": {
  3545. "application/json": {
  3546. "schema": {
  3547. "$ref": "#/components/schemas/Error"
  3548. }
  3549. }
  3550. }
  3551. },
  3552. "404": {
  3553. "description": "Not found, or no write permission on the job's namespace",
  3554. "content": {
  3555. "application/json": {
  3556. "schema": {
  3557. "$ref": "#/components/schemas/Error"
  3558. }
  3559. }
  3560. }
  3561. },
  3562. "409": {
  3563. "description": "job_not_retryable: the job is not failed, or its input is no longer stored",
  3564. "content": {
  3565. "application/json": {
  3566. "schema": {
  3567. "$ref": "#/components/schemas/Error"
  3568. }
  3569. }
  3570. }
  3571. },
  3572. "500": {
  3573. "description": "Internal error",
  3574. "content": {
  3575. "application/json": {
  3576. "schema": {
  3577. "$ref": "#/components/schemas/Error"
  3578. }
  3579. }
  3580. }
  3581. }
  3582. }
  3583. }
  3584. },
  3585. "/documents/{id}": {
  3586. "get": {
  3587. "summary": "Document metadata (?include_content=true adds the normalized text)",
  3588. "security": [
  3589. {
  3590. "bearerAuth": []
  3591. }
  3592. ],
  3593. "parameters": [
  3594. {
  3595. "name": "id",
  3596. "in": "path",
  3597. "required": true,
  3598. "schema": {
  3599. "type": "string",
  3600. "format": "uuid"
  3601. }
  3602. },
  3603. {
  3604. "name": "include_content",
  3605. "in": "query",
  3606. "schema": {
  3607. "type": "boolean"
  3608. }
  3609. }
  3610. ],
  3611. "responses": {
  3612. "200": {
  3613. "description": "Document"
  3614. },
  3615. "401": {
  3616. "description": "Missing, invalid, revoked or expired API key",
  3617. "content": {
  3618. "application/json": {
  3619. "schema": {
  3620. "$ref": "#/components/schemas/Error"
  3621. }
  3622. }
  3623. }
  3624. },
  3625. "404": {
  3626. "description": "Not found or not visible to the caller",
  3627. "content": {
  3628. "application/json": {
  3629. "schema": {
  3630. "$ref": "#/components/schemas/Error"
  3631. }
  3632. }
  3633. }
  3634. },
  3635. "500": {
  3636. "description": "Internal error",
  3637. "content": {
  3638. "application/json": {
  3639. "schema": {
  3640. "$ref": "#/components/schemas/Error"
  3641. }
  3642. }
  3643. }
  3644. }
  3645. }
  3646. }
  3647. },
  3648. "/chunks/{id}": {
  3649. "get": {
  3650. "summary": "One chunk with heading path and source locator (character offsets into the normalized document text)",
  3651. "security": [
  3652. {
  3653. "bearerAuth": []
  3654. }
  3655. ],
  3656. "parameters": [
  3657. {
  3658. "name": "id",
  3659. "in": "path",
  3660. "required": true,
  3661. "schema": {
  3662. "type": "string",
  3663. "format": "uuid"
  3664. }
  3665. }
  3666. ],
  3667. "responses": {
  3668. "200": {
  3669. "description": "Chunk"
  3670. },
  3671. "401": {
  3672. "description": "Missing, invalid, revoked or expired API key",
  3673. "content": {
  3674. "application/json": {
  3675. "schema": {
  3676. "$ref": "#/components/schemas/Error"
  3677. }
  3678. }
  3679. }
  3680. },
  3681. "404": {
  3682. "description": "Not found or not visible to the caller",
  3683. "content": {
  3684. "application/json": {
  3685. "schema": {
  3686. "$ref": "#/components/schemas/Error"
  3687. }
  3688. }
  3689. }
  3690. },
  3691. "500": {
  3692. "description": "Internal error",
  3693. "content": {
  3694. "application/json": {
  3695. "schema": {
  3696. "$ref": "#/components/schemas/Error"
  3697. }
  3698. }
  3699. }
  3700. }
  3701. }
  3702. }
  3703. },
  3704. "/search": {
  3705. "post": {
  3706. "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",
  3707. "security": [
  3708. {
  3709. "bearerAuth": []
  3710. }
  3711. ],
  3712. "requestBody": {
  3713. "required": true,
  3714. "content": {
  3715. "application/json": {
  3716. "schema": {
  3717. "$ref": "#/components/schemas/SearchRequest"
  3718. }
  3719. }
  3720. }
  3721. },
  3722. "responses": {
  3723. "200": {
  3724. "description": "Ranked chunks with locators and content_trust"
  3725. },
  3726. "422": {
  3727. "description": "Validation failed",
  3728. "content": {
  3729. "application/json": {
  3730. "schema": {
  3731. "$ref": "#/components/schemas/Error"
  3732. }
  3733. }
  3734. }
  3735. },
  3736. "401": {
  3737. "description": "Missing, invalid, revoked or expired API key",
  3738. "content": {
  3739. "application/json": {
  3740. "schema": {
  3741. "$ref": "#/components/schemas/Error"
  3742. }
  3743. }
  3744. }
  3745. },
  3746. "404": {
  3747. "description": "Not found or not visible to the caller",
  3748. "content": {
  3749. "application/json": {
  3750. "schema": {
  3751. "$ref": "#/components/schemas/Error"
  3752. }
  3753. }
  3754. }
  3755. },
  3756. "500": {
  3757. "description": "Internal error",
  3758. "content": {
  3759. "application/json": {
  3760. "schema": {
  3761. "$ref": "#/components/schemas/Error"
  3762. }
  3763. }
  3764. }
  3765. }
  3766. },
  3767. "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."
  3768. }
  3769. },
  3770. "/health/live": {
  3771. "get": {
  3772. "summary": "Liveness",
  3773. "responses": {
  3774. "200": {
  3775. "description": "Live"
  3776. }
  3777. }
  3778. }
  3779. },
  3780. "/health/ready": {
  3781. "get": {
  3782. "summary": "Readiness (database reachable)",
  3783. "responses": {
  3784. "200": {
  3785. "description": "Ready"
  3786. },
  3787. "503": {
  3788. "description": "Unavailable"
  3789. }
  3790. }
  3791. }
  3792. },
  3793. "/metrics": {
  3794. "get": {
  3795. "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.",
  3796. "tags": [
  3797. "health"
  3798. ],
  3799. "responses": {
  3800. "200": {
  3801. "description": "Metrics",
  3802. "content": {
  3803. "text/plain": {
  3804. "schema": {
  3805. "type": "string"
  3806. }
  3807. }
  3808. }
  3809. },
  3810. "401": {
  3811. "description": "Missing or wrong metrics token",
  3812. "content": {
  3813. "application/json": {
  3814. "schema": {
  3815. "$ref": "#/components/schemas/Error"
  3816. }
  3817. }
  3818. }
  3819. },
  3820. "404": {
  3821. "description": "Metrics are disabled (no AMK_METRICS_TOKEN)",
  3822. "content": {
  3823. "application/json": {
  3824. "schema": {
  3825. "$ref": "#/components/schemas/Error"
  3826. }
  3827. }
  3828. }
  3829. }
  3830. }
  3831. }
  3832. },
  3833. "/context": {
  3834. "post": {
  3835. "summary": "Assemble a token-budgeted task briefing: constraints by scope, working state, preferences, conflicts, hybrid matches and reference passages",
  3836. "security": [
  3837. {
  3838. "bearerAuth": []
  3839. }
  3840. ],
  3841. "requestBody": {
  3842. "required": true,
  3843. "content": {
  3844. "application/json": {
  3845. "schema": {
  3846. "$ref": "#/components/schemas/ContextRequest"
  3847. }
  3848. }
  3849. }
  3850. },
  3851. "responses": {
  3852. "200": {
  3853. "description": "Briefing",
  3854. "content": {
  3855. "application/json": {
  3856. "schema": {
  3857. "$ref": "#/components/schemas/ContextResponse"
  3858. }
  3859. }
  3860. }
  3861. },
  3862. "400": {
  3863. "description": "Empty body or invalid JSON",
  3864. "content": {
  3865. "application/json": {
  3866. "schema": {
  3867. "$ref": "#/components/schemas/Error"
  3868. }
  3869. }
  3870. }
  3871. },
  3872. "401": {
  3873. "description": "Missing, invalid, revoked or expired API key",
  3874. "content": {
  3875. "application/json": {
  3876. "schema": {
  3877. "$ref": "#/components/schemas/Error"
  3878. }
  3879. }
  3880. }
  3881. },
  3882. "404": {
  3883. "description": "session_id not found or not visible to the caller",
  3884. "content": {
  3885. "application/json": {
  3886. "schema": {
  3887. "$ref": "#/components/schemas/Error"
  3888. }
  3889. }
  3890. }
  3891. },
  3892. "422": {
  3893. "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)",
  3894. "content": {
  3895. "application/json": {
  3896. "schema": {
  3897. "$ref": "#/components/schemas/Error"
  3898. }
  3899. }
  3900. }
  3901. },
  3902. "500": {
  3903. "description": "Internal error",
  3904. "content": {
  3905. "application/json": {
  3906. "schema": {
  3907. "$ref": "#/components/schemas/Error"
  3908. }
  3909. }
  3910. }
  3911. }
  3912. }
  3913. }
  3914. },
  3915. "/sessions/{id}/events": {
  3916. "post": {
  3917. "summary": "Record an experience (task, problem, action, result, outcome) in an active session",
  3918. "tags": [
  3919. "learning"
  3920. ],
  3921. "security": [
  3922. {
  3923. "bearerAuth": []
  3924. }
  3925. ],
  3926. "parameters": [
  3927. {
  3928. "name": "id",
  3929. "in": "path",
  3930. "required": true,
  3931. "schema": {
  3932. "type": "string",
  3933. "format": "uuid"
  3934. }
  3935. },
  3936. {
  3937. "name": "Idempotency-Key",
  3938. "in": "header",
  3939. "required": false,
  3940. "schema": {
  3941. "type": "string",
  3942. "maxLength": 200
  3943. },
  3944. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  3945. }
  3946. ],
  3947. "requestBody": {
  3948. "required": true,
  3949. "content": {
  3950. "application/json": {
  3951. "schema": {
  3952. "$ref": "#/components/schemas/ExperienceRequest"
  3953. }
  3954. }
  3955. }
  3956. },
  3957. "responses": {
  3958. "201": {
  3959. "description": "Recorded",
  3960. "content": {
  3961. "application/json": {
  3962. "schema": {
  3963. "type": "object",
  3964. "properties": {
  3965. "id": {
  3966. "type": "string"
  3967. },
  3968. "session_id": {
  3969. "type": "string"
  3970. },
  3971. "outcome": {
  3972. "type": "string"
  3973. },
  3974. "created_at": {
  3975. "type": "string"
  3976. }
  3977. }
  3978. }
  3979. }
  3980. }
  3981. },
  3982. "400": {
  3983. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  3984. "content": {
  3985. "application/json": {
  3986. "schema": {
  3987. "$ref": "#/components/schemas/Error"
  3988. }
  3989. }
  3990. }
  3991. },
  3992. "401": {
  3993. "description": "Missing, invalid, revoked or expired API key",
  3994. "content": {
  3995. "application/json": {
  3996. "schema": {
  3997. "$ref": "#/components/schemas/Error"
  3998. }
  3999. }
  4000. }
  4001. },
  4002. "404": {
  4003. "description": "Session not found, or no write permission on its namespace",
  4004. "content": {
  4005. "application/json": {
  4006. "schema": {
  4007. "$ref": "#/components/schemas/Error"
  4008. }
  4009. }
  4010. }
  4011. },
  4012. "409": {
  4013. "description": "session_not_active (completed session) or idempotency_conflict",
  4014. "content": {
  4015. "application/json": {
  4016. "schema": {
  4017. "$ref": "#/components/schemas/Error"
  4018. }
  4019. }
  4020. }
  4021. },
  4022. "422": {
  4023. "description": "Validation failed or unsupported_character",
  4024. "content": {
  4025. "application/json": {
  4026. "schema": {
  4027. "$ref": "#/components/schemas/Error"
  4028. }
  4029. }
  4030. }
  4031. },
  4032. "500": {
  4033. "description": "Internal error",
  4034. "content": {
  4035. "application/json": {
  4036. "schema": {
  4037. "$ref": "#/components/schemas/Error"
  4038. }
  4039. }
  4040. }
  4041. }
  4042. }
  4043. },
  4044. "get": {
  4045. "summary": "List the experiences of a session, oldest first (max 200)",
  4046. "tags": [
  4047. "learning"
  4048. ],
  4049. "security": [
  4050. {
  4051. "bearerAuth": []
  4052. }
  4053. ],
  4054. "parameters": [
  4055. {
  4056. "name": "id",
  4057. "in": "path",
  4058. "required": true,
  4059. "schema": {
  4060. "type": "string",
  4061. "format": "uuid"
  4062. }
  4063. }
  4064. ],
  4065. "responses": {
  4066. "200": {
  4067. "description": "Experiences",
  4068. "content": {
  4069. "application/json": {
  4070. "schema": {
  4071. "type": "object",
  4072. "properties": {
  4073. "session_id": {
  4074. "type": "string"
  4075. },
  4076. "data": {
  4077. "type": "array",
  4078. "items": {
  4079. "$ref": "#/components/schemas/Experience"
  4080. }
  4081. }
  4082. }
  4083. }
  4084. }
  4085. }
  4086. },
  4087. "401": {
  4088. "description": "Missing, invalid, revoked or expired API key",
  4089. "content": {
  4090. "application/json": {
  4091. "schema": {
  4092. "$ref": "#/components/schemas/Error"
  4093. }
  4094. }
  4095. }
  4096. },
  4097. "404": {
  4098. "description": "Session not found or not readable",
  4099. "content": {
  4100. "application/json": {
  4101. "schema": {
  4102. "$ref": "#/components/schemas/Error"
  4103. }
  4104. }
  4105. }
  4106. },
  4107. "500": {
  4108. "description": "Internal error",
  4109. "content": {
  4110. "application/json": {
  4111. "schema": {
  4112. "$ref": "#/components/schemas/Error"
  4113. }
  4114. }
  4115. }
  4116. }
  4117. }
  4118. }
  4119. },
  4120. "/learn": {
  4121. "post": {
  4122. "summary": "Propose knowledge as a learning candidate (a new memory, or a new revision of target_memory_id at base_revision), with evidence",
  4123. "tags": [
  4124. "learning"
  4125. ],
  4126. "security": [
  4127. {
  4128. "bearerAuth": []
  4129. }
  4130. ],
  4131. "parameters": [
  4132. {
  4133. "name": "Idempotency-Key",
  4134. "in": "header",
  4135. "required": false,
  4136. "schema": {
  4137. "type": "string",
  4138. "maxLength": 200
  4139. },
  4140. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  4141. }
  4142. ],
  4143. "requestBody": {
  4144. "required": true,
  4145. "content": {
  4146. "application/json": {
  4147. "schema": {
  4148. "$ref": "#/components/schemas/LearnRequest"
  4149. }
  4150. }
  4151. }
  4152. },
  4153. "responses": {
  4154. "201": {
  4155. "description": "Candidate proposed",
  4156. "content": {
  4157. "application/json": {
  4158. "schema": {
  4159. "type": "object",
  4160. "properties": {
  4161. "id": {
  4162. "type": "string"
  4163. },
  4164. "state": {
  4165. "type": "string",
  4166. "enum": [
  4167. "proposed"
  4168. ]
  4169. },
  4170. "namespace_id": {
  4171. "type": "string"
  4172. },
  4173. "type": {
  4174. "type": "string"
  4175. },
  4176. "evidence_count": {
  4177. "type": "integer"
  4178. }
  4179. }
  4180. }
  4181. }
  4182. }
  4183. },
  4184. "400": {
  4185. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  4186. "content": {
  4187. "application/json": {
  4188. "schema": {
  4189. "$ref": "#/components/schemas/Error"
  4190. }
  4191. }
  4192. }
  4193. },
  4194. "401": {
  4195. "description": "Missing, invalid, revoked or expired API key",
  4196. "content": {
  4197. "application/json": {
  4198. "schema": {
  4199. "$ref": "#/components/schemas/Error"
  4200. }
  4201. }
  4202. }
  4203. },
  4204. "404": {
  4205. "description": "Namespace not found or no write permission",
  4206. "content": {
  4207. "application/json": {
  4208. "schema": {
  4209. "$ref": "#/components/schemas/Error"
  4210. }
  4211. }
  4212. }
  4213. },
  4214. "409": {
  4215. "description": "idempotency_conflict",
  4216. "content": {
  4217. "application/json": {
  4218. "schema": {
  4219. "$ref": "#/components/schemas/Error"
  4220. }
  4221. }
  4222. }
  4223. },
  4224. "422": {
  4225. "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",
  4226. "content": {
  4227. "application/json": {
  4228. "schema": {
  4229. "$ref": "#/components/schemas/Error"
  4230. }
  4231. }
  4232. }
  4233. },
  4234. "500": {
  4235. "description": "Internal error",
  4236. "content": {
  4237. "application/json": {
  4238. "schema": {
  4239. "$ref": "#/components/schemas/Error"
  4240. }
  4241. }
  4242. }
  4243. }
  4244. }
  4245. }
  4246. },
  4247. "/candidates": {
  4248. "get": {
  4249. "summary": "List learning candidates in namespaces the caller can read, newest first",
  4250. "tags": [
  4251. "learning"
  4252. ],
  4253. "security": [
  4254. {
  4255. "bearerAuth": []
  4256. }
  4257. ],
  4258. "parameters": [
  4259. {
  4260. "name": "namespace_id",
  4261. "in": "query",
  4262. "schema": {
  4263. "type": "string",
  4264. "format": "uuid"
  4265. }
  4266. },
  4267. {
  4268. "name": "state",
  4269. "in": "query",
  4270. "schema": {
  4271. "type": "string",
  4272. "enum": [
  4273. "proposed",
  4274. "accepted",
  4275. "rejected"
  4276. ]
  4277. }
  4278. },
  4279. {
  4280. "name": "limit",
  4281. "in": "query",
  4282. "schema": {
  4283. "type": "integer",
  4284. "minimum": 1,
  4285. "maximum": 200,
  4286. "default": 50
  4287. }
  4288. }
  4289. ],
  4290. "responses": {
  4291. "200": {
  4292. "description": "Candidates (without content)",
  4293. "content": {
  4294. "application/json": {
  4295. "schema": {
  4296. "type": "object",
  4297. "properties": {
  4298. "data": {
  4299. "type": "array",
  4300. "items": {
  4301. "$ref": "#/components/schemas/Candidate"
  4302. }
  4303. }
  4304. }
  4305. }
  4306. }
  4307. }
  4308. },
  4309. "401": {
  4310. "description": "Missing, invalid, revoked or expired API key",
  4311. "content": {
  4312. "application/json": {
  4313. "schema": {
  4314. "$ref": "#/components/schemas/Error"
  4315. }
  4316. }
  4317. }
  4318. },
  4319. "422": {
  4320. "description": "Bad state or namespace_id",
  4321. "content": {
  4322. "application/json": {
  4323. "schema": {
  4324. "$ref": "#/components/schemas/Error"
  4325. }
  4326. }
  4327. }
  4328. },
  4329. "500": {
  4330. "description": "Internal error",
  4331. "content": {
  4332. "application/json": {
  4333. "schema": {
  4334. "$ref": "#/components/schemas/Error"
  4335. }
  4336. }
  4337. }
  4338. }
  4339. }
  4340. }
  4341. },
  4342. "/candidates/{id}": {
  4343. "get": {
  4344. "summary": "One candidate with content and evidence",
  4345. "tags": [
  4346. "learning"
  4347. ],
  4348. "security": [
  4349. {
  4350. "bearerAuth": []
  4351. }
  4352. ],
  4353. "parameters": [
  4354. {
  4355. "name": "id",
  4356. "in": "path",
  4357. "required": true,
  4358. "schema": {
  4359. "type": "string",
  4360. "format": "uuid"
  4361. }
  4362. }
  4363. ],
  4364. "responses": {
  4365. "200": {
  4366. "description": "Candidate",
  4367. "content": {
  4368. "application/json": {
  4369. "schema": {
  4370. "type": "object",
  4371. "properties": {
  4372. "data": {
  4373. "$ref": "#/components/schemas/Candidate"
  4374. }
  4375. }
  4376. }
  4377. }
  4378. }
  4379. },
  4380. "401": {
  4381. "description": "Missing, invalid, revoked or expired API key",
  4382. "content": {
  4383. "application/json": {
  4384. "schema": {
  4385. "$ref": "#/components/schemas/Error"
  4386. }
  4387. }
  4388. }
  4389. },
  4390. "404": {
  4391. "description": "Not found or not readable",
  4392. "content": {
  4393. "application/json": {
  4394. "schema": {
  4395. "$ref": "#/components/schemas/Error"
  4396. }
  4397. }
  4398. }
  4399. },
  4400. "500": {
  4401. "description": "Internal error",
  4402. "content": {
  4403. "application/json": {
  4404. "schema": {
  4405. "$ref": "#/components/schemas/Error"
  4406. }
  4407. }
  4408. }
  4409. }
  4410. }
  4411. }
  4412. },
  4413. "/candidates/{id}/review": {
  4414. "post": {
  4415. "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.",
  4416. "tags": [
  4417. "learning"
  4418. ],
  4419. "security": [
  4420. {
  4421. "bearerAuth": []
  4422. }
  4423. ],
  4424. "parameters": [
  4425. {
  4426. "name": "id",
  4427. "in": "path",
  4428. "required": true,
  4429. "schema": {
  4430. "type": "string",
  4431. "format": "uuid"
  4432. }
  4433. }
  4434. ],
  4435. "requestBody": {
  4436. "required": true,
  4437. "content": {
  4438. "application/json": {
  4439. "schema": {
  4440. "$ref": "#/components/schemas/ReviewRequest"
  4441. }
  4442. }
  4443. }
  4444. },
  4445. "responses": {
  4446. "200": {
  4447. "description": "Reviewed",
  4448. "content": {
  4449. "application/json": {
  4450. "schema": {
  4451. "type": "object",
  4452. "properties": {
  4453. "id": {
  4454. "type": "string"
  4455. },
  4456. "state": {
  4457. "type": "string",
  4458. "enum": [
  4459. "accepted",
  4460. "rejected"
  4461. ]
  4462. },
  4463. "resulting_memory_id": {
  4464. "type": "string"
  4465. },
  4466. "resulting_revision": {
  4467. "type": "integer"
  4468. },
  4469. "verification_status": {
  4470. "type": "string"
  4471. },
  4472. "duplicate": {
  4473. "type": "boolean"
  4474. }
  4475. }
  4476. }
  4477. }
  4478. }
  4479. },
  4480. "400": {
  4481. "description": "Empty body or invalid JSON",
  4482. "content": {
  4483. "application/json": {
  4484. "schema": {
  4485. "$ref": "#/components/schemas/Error"
  4486. }
  4487. }
  4488. }
  4489. },
  4490. "401": {
  4491. "description": "Missing, invalid, revoked or expired API key",
  4492. "content": {
  4493. "application/json": {
  4494. "schema": {
  4495. "$ref": "#/components/schemas/Error"
  4496. }
  4497. }
  4498. }
  4499. },
  4500. "403": {
  4501. "description": "self_review_not_allowed",
  4502. "content": {
  4503. "application/json": {
  4504. "schema": {
  4505. "$ref": "#/components/schemas/Error"
  4506. }
  4507. }
  4508. }
  4509. },
  4510. "404": {
  4511. "description": "Candidate not found or no verify permission",
  4512. "content": {
  4513. "application/json": {
  4514. "schema": {
  4515. "$ref": "#/components/schemas/Error"
  4516. }
  4517. }
  4518. }
  4519. },
  4520. "409": {
  4521. "description": "candidate_already_reviewed, stale_candidate (target memory changed since base_revision), target_memory_missing or target_memory_not_active",
  4522. "content": {
  4523. "application/json": {
  4524. "schema": {
  4525. "$ref": "#/components/schemas/Error"
  4526. }
  4527. }
  4528. }
  4529. },
  4530. "422": {
  4531. "description": "Validation failed",
  4532. "content": {
  4533. "application/json": {
  4534. "schema": {
  4535. "$ref": "#/components/schemas/Error"
  4536. }
  4537. }
  4538. }
  4539. },
  4540. "500": {
  4541. "description": "Internal error",
  4542. "content": {
  4543. "application/json": {
  4544. "schema": {
  4545. "$ref": "#/components/schemas/Error"
  4546. }
  4547. }
  4548. }
  4549. }
  4550. }
  4551. }
  4552. },
  4553. "/memories/{id}/sources": {
  4554. "get": {
  4555. "summary": "Evidence and verifications behind a memory revision. Evidence the caller cannot read is listed with available false and no id.",
  4556. "tags": [
  4557. "learning"
  4558. ],
  4559. "security": [
  4560. {
  4561. "bearerAuth": []
  4562. }
  4563. ],
  4564. "parameters": [
  4565. {
  4566. "name": "id",
  4567. "in": "path",
  4568. "required": true,
  4569. "schema": {
  4570. "type": "string",
  4571. "format": "uuid"
  4572. }
  4573. },
  4574. {
  4575. "name": "revision",
  4576. "in": "query",
  4577. "schema": {
  4578. "type": "integer",
  4579. "minimum": 1
  4580. },
  4581. "description": "Default: current revision"
  4582. }
  4583. ],
  4584. "responses": {
  4585. "200": {
  4586. "description": "Sources",
  4587. "content": {
  4588. "application/json": {
  4589. "schema": {
  4590. "$ref": "#/components/schemas/Sources"
  4591. }
  4592. }
  4593. }
  4594. },
  4595. "401": {
  4596. "description": "Missing, invalid, revoked or expired API key",
  4597. "content": {
  4598. "application/json": {
  4599. "schema": {
  4600. "$ref": "#/components/schemas/Error"
  4601. }
  4602. }
  4603. }
  4604. },
  4605. "404": {
  4606. "description": "Memory not found or not readable",
  4607. "content": {
  4608. "application/json": {
  4609. "schema": {
  4610. "$ref": "#/components/schemas/Error"
  4611. }
  4612. }
  4613. }
  4614. },
  4615. "422": {
  4616. "description": "revision out of range",
  4617. "content": {
  4618. "application/json": {
  4619. "schema": {
  4620. "$ref": "#/components/schemas/Error"
  4621. }
  4622. }
  4623. }
  4624. },
  4625. "500": {
  4626. "description": "Internal error",
  4627. "content": {
  4628. "application/json": {
  4629. "schema": {
  4630. "$ref": "#/components/schemas/Error"
  4631. }
  4632. }
  4633. }
  4634. }
  4635. }
  4636. }
  4637. },
  4638. "/feedback": {
  4639. "post": {
  4640. "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.",
  4641. "tags": [
  4642. "learning"
  4643. ],
  4644. "security": [
  4645. {
  4646. "bearerAuth": []
  4647. }
  4648. ],
  4649. "requestBody": {
  4650. "required": true,
  4651. "content": {
  4652. "application/json": {
  4653. "schema": {
  4654. "$ref": "#/components/schemas/FeedbackRequest"
  4655. }
  4656. }
  4657. }
  4658. },
  4659. "responses": {
  4660. "200": {
  4661. "description": "Updated",
  4662. "content": {
  4663. "application/json": {
  4664. "schema": {
  4665. "$ref": "#/components/schemas/Feedback"
  4666. }
  4667. }
  4668. }
  4669. },
  4670. "201": {
  4671. "description": "Recorded",
  4672. "content": {
  4673. "application/json": {
  4674. "schema": {
  4675. "$ref": "#/components/schemas/Feedback"
  4676. }
  4677. }
  4678. }
  4679. },
  4680. "400": {
  4681. "description": "Empty body or invalid JSON",
  4682. "content": {
  4683. "application/json": {
  4684. "schema": {
  4685. "$ref": "#/components/schemas/Error"
  4686. }
  4687. }
  4688. }
  4689. },
  4690. "401": {
  4691. "description": "Missing, invalid, revoked or expired API key",
  4692. "content": {
  4693. "application/json": {
  4694. "schema": {
  4695. "$ref": "#/components/schemas/Error"
  4696. }
  4697. }
  4698. }
  4699. },
  4700. "404": {
  4701. "description": "result_not_found: the result was not returned by that query, is gone, or is not readable",
  4702. "content": {
  4703. "application/json": {
  4704. "schema": {
  4705. "$ref": "#/components/schemas/Error"
  4706. }
  4707. }
  4708. }
  4709. },
  4710. "422": {
  4711. "description": "Validation failed",
  4712. "content": {
  4713. "application/json": {
  4714. "schema": {
  4715. "$ref": "#/components/schemas/Error"
  4716. }
  4717. }
  4718. }
  4719. },
  4720. "500": {
  4721. "description": "Internal error",
  4722. "content": {
  4723. "application/json": {
  4724. "schema": {
  4725. "$ref": "#/components/schemas/Error"
  4726. }
  4727. }
  4728. }
  4729. }
  4730. }
  4731. }
  4732. },
  4733. "/exports": {
  4734. "post": {
  4735. "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.",
  4736. "tags": [
  4737. "portability"
  4738. ],
  4739. "security": [
  4740. {
  4741. "bearerAuth": []
  4742. }
  4743. ],
  4744. "requestBody": {
  4745. "required": false,
  4746. "content": {
  4747. "application/json": {
  4748. "schema": {
  4749. "$ref": "#/components/schemas/ExportRequest"
  4750. }
  4751. }
  4752. }
  4753. },
  4754. "responses": {
  4755. "200": {
  4756. "description": "The export document",
  4757. "content": {
  4758. "application/json": {
  4759. "schema": {
  4760. "$ref": "#/components/schemas/Export"
  4761. }
  4762. }
  4763. }
  4764. },
  4765. "400": {
  4766. "description": "Invalid JSON",
  4767. "content": {
  4768. "application/json": {
  4769. "schema": {
  4770. "$ref": "#/components/schemas/Error"
  4771. }
  4772. }
  4773. }
  4774. },
  4775. "401": {
  4776. "description": "Missing, invalid, revoked or expired API key",
  4777. "content": {
  4778. "application/json": {
  4779. "schema": {
  4780. "$ref": "#/components/schemas/Error"
  4781. }
  4782. }
  4783. }
  4784. },
  4785. "422": {
  4786. "description": "Validation failed (namespace_ids is not an array of ids)",
  4787. "content": {
  4788. "application/json": {
  4789. "schema": {
  4790. "$ref": "#/components/schemas/Error"
  4791. }
  4792. }
  4793. }
  4794. },
  4795. "500": {
  4796. "description": "Internal error",
  4797. "content": {
  4798. "application/json": {
  4799. "schema": {
  4800. "$ref": "#/components/schemas/Error"
  4801. }
  4802. }
  4803. }
  4804. }
  4805. }
  4806. }
  4807. },
  4808. "/imports": {
  4809. "post": {
  4810. "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.",
  4811. "tags": [
  4812. "portability"
  4813. ],
  4814. "security": [
  4815. {
  4816. "bearerAuth": []
  4817. }
  4818. ],
  4819. "requestBody": {
  4820. "required": true,
  4821. "content": {
  4822. "application/json": {
  4823. "schema": {
  4824. "$ref": "#/components/schemas/Export"
  4825. }
  4826. }
  4827. }
  4828. },
  4829. "responses": {
  4830. "201": {
  4831. "description": "Imported",
  4832. "content": {
  4833. "application/json": {
  4834. "schema": {
  4835. "$ref": "#/components/schemas/ImportResult"
  4836. }
  4837. }
  4838. }
  4839. },
  4840. "400": {
  4841. "description": "Empty body or invalid JSON",
  4842. "content": {
  4843. "application/json": {
  4844. "schema": {
  4845. "$ref": "#/components/schemas/Error"
  4846. }
  4847. }
  4848. }
  4849. },
  4850. "401": {
  4851. "description": "Missing, invalid, revoked or expired API key",
  4852. "content": {
  4853. "application/json": {
  4854. "schema": {
  4855. "$ref": "#/components/schemas/Error"
  4856. }
  4857. }
  4858. }
  4859. },
  4860. "409": {
  4861. "description": "import_conflict: an id in the document already exists; nothing was imported",
  4862. "content": {
  4863. "application/json": {
  4864. "schema": {
  4865. "$ref": "#/components/schemas/Error"
  4866. }
  4867. }
  4868. }
  4869. },
  4870. "413": {
  4871. "description": "body_too_large: more than 8 MiB",
  4872. "content": {
  4873. "application/json": {
  4874. "schema": {
  4875. "$ref": "#/components/schemas/Error"
  4876. }
  4877. }
  4878. }
  4879. },
  4880. "422": {
  4881. "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",
  4882. "content": {
  4883. "application/json": {
  4884. "schema": {
  4885. "$ref": "#/components/schemas/Error"
  4886. }
  4887. }
  4888. }
  4889. },
  4890. "500": {
  4891. "description": "Internal error; nothing was imported",
  4892. "content": {
  4893. "application/json": {
  4894. "schema": {
  4895. "$ref": "#/components/schemas/Error"
  4896. }
  4897. }
  4898. }
  4899. }
  4900. }
  4901. }
  4902. },
  4903. "/me": {
  4904. "get": {
  4905. "summary": "The caller: principal, tenant and its grants.",
  4906. "security": [
  4907. {
  4908. "bearerAuth": []
  4909. }
  4910. ],
  4911. "responses": {
  4912. "200": {
  4913. "description": "Caller",
  4914. "content": {
  4915. "application/json": {
  4916. "schema": {
  4917. "$ref": "#/components/schemas/Me"
  4918. }
  4919. }
  4920. }
  4921. },
  4922. "401": {
  4923. "description": "Missing, invalid, revoked or expired API key",
  4924. "content": {
  4925. "application/json": {
  4926. "schema": {
  4927. "$ref": "#/components/schemas/Error"
  4928. }
  4929. }
  4930. }
  4931. }
  4932. }
  4933. }
  4934. },
  4935. "/namespaces": {
  4936. "get": {
  4937. "summary": "Namespaces the caller can read, with the caller's effective permissions on each.",
  4938. "security": [
  4939. {
  4940. "bearerAuth": []
  4941. }
  4942. ],
  4943. "responses": {
  4944. "200": {
  4945. "description": "Namespaces",
  4946. "content": {
  4947. "application/json": {
  4948. "schema": {
  4949. "type": "object",
  4950. "properties": {
  4951. "data": {
  4952. "type": "array",
  4953. "items": {
  4954. "$ref": "#/components/schemas/Namespace"
  4955. }
  4956. }
  4957. }
  4958. }
  4959. }
  4960. }
  4961. },
  4962. "401": {
  4963. "description": "Missing, invalid, revoked or expired API key",
  4964. "content": {
  4965. "application/json": {
  4966. "schema": {
  4967. "$ref": "#/components/schemas/Error"
  4968. }
  4969. }
  4970. }
  4971. }
  4972. }
  4973. },
  4974. "post": {
  4975. "summary": "Create a namespace (and missing parents). Needs an inheriting admin grant covering the new path; top-level namespaces are created with the CLI.",
  4976. "security": [
  4977. {
  4978. "bearerAuth": []
  4979. }
  4980. ],
  4981. "requestBody": {
  4982. "required": true,
  4983. "content": {
  4984. "application/json": {
  4985. "schema": {
  4986. "$ref": "#/components/schemas/NamespaceRequest"
  4987. }
  4988. }
  4989. }
  4990. },
  4991. "responses": {
  4992. "201": {
  4993. "description": "Created",
  4994. "content": {
  4995. "application/json": {
  4996. "schema": {
  4997. "$ref": "#/components/schemas/NamespaceCreated"
  4998. }
  4999. }
  5000. }
  5001. },
  5002. "400": {
  5003. "description": "Body is not valid JSON",
  5004. "content": {
  5005. "application/json": {
  5006. "schema": {
  5007. "$ref": "#/components/schemas/Error"
  5008. }
  5009. }
  5010. }
  5011. },
  5012. "401": {
  5013. "description": "Missing, invalid, revoked or expired API key",
  5014. "content": {
  5015. "application/json": {
  5016. "schema": {
  5017. "$ref": "#/components/schemas/Error"
  5018. }
  5019. }
  5020. }
  5021. },
  5022. "404": {
  5023. "description": "No inheriting admin grant covers the path",
  5024. "content": {
  5025. "application/json": {
  5026. "schema": {
  5027. "$ref": "#/components/schemas/Error"
  5028. }
  5029. }
  5030. }
  5031. },
  5032. "409": {
  5033. "description": "namespace_exists",
  5034. "content": {
  5035. "application/json": {
  5036. "schema": {
  5037. "$ref": "#/components/schemas/Error"
  5038. }
  5039. }
  5040. }
  5041. },
  5042. "422": {
  5043. "description": "Validation failed",
  5044. "content": {
  5045. "application/json": {
  5046. "schema": {
  5047. "$ref": "#/components/schemas/Error"
  5048. }
  5049. }
  5050. }
  5051. },
  5052. "500": {
  5053. "description": "Internal error",
  5054. "content": {
  5055. "application/json": {
  5056. "schema": {
  5057. "$ref": "#/components/schemas/Error"
  5058. }
  5059. }
  5060. }
  5061. }
  5062. }
  5063. }
  5064. },
  5065. "/principals": {
  5066. "get": {
  5067. "summary": "Principals of the caller's tenant. Needs admin on at least one namespace.",
  5068. "security": [
  5069. {
  5070. "bearerAuth": []
  5071. }
  5072. ],
  5073. "responses": {
  5074. "200": {
  5075. "description": "Principals",
  5076. "content": {
  5077. "application/json": {
  5078. "schema": {
  5079. "type": "object",
  5080. "properties": {
  5081. "data": {
  5082. "type": "array",
  5083. "items": {
  5084. "$ref": "#/components/schemas/Principal"
  5085. }
  5086. }
  5087. }
  5088. }
  5089. }
  5090. }
  5091. },
  5092. "401": {
  5093. "description": "Missing, invalid, revoked or expired API key",
  5094. "content": {
  5095. "application/json": {
  5096. "schema": {
  5097. "$ref": "#/components/schemas/Error"
  5098. }
  5099. }
  5100. }
  5101. },
  5102. "404": {
  5103. "description": "Caller is not an admin anywhere",
  5104. "content": {
  5105. "application/json": {
  5106. "schema": {
  5107. "$ref": "#/components/schemas/Error"
  5108. }
  5109. }
  5110. }
  5111. }
  5112. }
  5113. },
  5114. "post": {
  5115. "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.",
  5116. "security": [
  5117. {
  5118. "bearerAuth": []
  5119. }
  5120. ],
  5121. "requestBody": {
  5122. "required": true,
  5123. "content": {
  5124. "application/json": {
  5125. "schema": {
  5126. "$ref": "#/components/schemas/PrincipalRequest"
  5127. }
  5128. }
  5129. }
  5130. },
  5131. "responses": {
  5132. "201": {
  5133. "description": "Created",
  5134. "content": {
  5135. "application/json": {
  5136. "schema": {
  5137. "$ref": "#/components/schemas/PrincipalCreated"
  5138. }
  5139. }
  5140. }
  5141. },
  5142. "400": {
  5143. "description": "Body is not valid JSON",
  5144. "content": {
  5145. "application/json": {
  5146. "schema": {
  5147. "$ref": "#/components/schemas/Error"
  5148. }
  5149. }
  5150. }
  5151. },
  5152. "401": {
  5153. "description": "Missing, invalid, revoked or expired API key",
  5154. "content": {
  5155. "application/json": {
  5156. "schema": {
  5157. "$ref": "#/components/schemas/Error"
  5158. }
  5159. }
  5160. }
  5161. },
  5162. "404": {
  5163. "description": "Caller is not an admin anywhere",
  5164. "content": {
  5165. "application/json": {
  5166. "schema": {
  5167. "$ref": "#/components/schemas/Error"
  5168. }
  5169. }
  5170. }
  5171. },
  5172. "422": {
  5173. "description": "Validation failed",
  5174. "content": {
  5175. "application/json": {
  5176. "schema": {
  5177. "$ref": "#/components/schemas/Error"
  5178. }
  5179. }
  5180. }
  5181. },
  5182. "500": {
  5183. "description": "Internal error",
  5184. "content": {
  5185. "application/json": {
  5186. "schema": {
  5187. "$ref": "#/components/schemas/Error"
  5188. }
  5189. }
  5190. }
  5191. }
  5192. }
  5193. }
  5194. },
  5195. "/principals/{id}": {
  5196. "get": {
  5197. "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).",
  5198. "security": [
  5199. {
  5200. "bearerAuth": []
  5201. }
  5202. ],
  5203. "parameters": [
  5204. {
  5205. "name": "id",
  5206. "in": "path",
  5207. "required": true,
  5208. "schema": {
  5209. "type": "string",
  5210. "format": "uuid"
  5211. }
  5212. }
  5213. ],
  5214. "responses": {
  5215. "200": {
  5216. "description": "Principal",
  5217. "content": {
  5218. "application/json": {
  5219. "schema": {
  5220. "$ref": "#/components/schemas/PrincipalDetail"
  5221. }
  5222. }
  5223. }
  5224. },
  5225. "401": {
  5226. "description": "Missing, invalid, revoked or expired API key",
  5227. "content": {
  5228. "application/json": {
  5229. "schema": {
  5230. "$ref": "#/components/schemas/Error"
  5231. }
  5232. }
  5233. }
  5234. },
  5235. "404": {
  5236. "description": "Not found, or the caller is not an admin and not this principal",
  5237. "content": {
  5238. "application/json": {
  5239. "schema": {
  5240. "$ref": "#/components/schemas/Error"
  5241. }
  5242. }
  5243. }
  5244. }
  5245. }
  5246. },
  5247. "patch": {
  5248. "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.",
  5249. "security": [
  5250. {
  5251. "bearerAuth": []
  5252. }
  5253. ],
  5254. "parameters": [
  5255. {
  5256. "name": "id",
  5257. "in": "path",
  5258. "required": true,
  5259. "schema": {
  5260. "type": "string",
  5261. "format": "uuid"
  5262. }
  5263. }
  5264. ],
  5265. "requestBody": {
  5266. "required": true,
  5267. "content": {
  5268. "application/json": {
  5269. "schema": {
  5270. "$ref": "#/components/schemas/PrincipalUpdate"
  5271. }
  5272. }
  5273. }
  5274. },
  5275. "responses": {
  5276. "200": {
  5277. "description": "Updated",
  5278. "content": {
  5279. "application/json": {
  5280. "schema": {
  5281. "$ref": "#/components/schemas/Principal"
  5282. }
  5283. }
  5284. }
  5285. },
  5286. "400": {
  5287. "description": "Body is not valid JSON",
  5288. "content": {
  5289. "application/json": {
  5290. "schema": {
  5291. "$ref": "#/components/schemas/Error"
  5292. }
  5293. }
  5294. }
  5295. },
  5296. "401": {
  5297. "description": "Missing, invalid, revoked or expired API key",
  5298. "content": {
  5299. "application/json": {
  5300. "schema": {
  5301. "$ref": "#/components/schemas/Error"
  5302. }
  5303. }
  5304. }
  5305. },
  5306. "404": {
  5307. "description": "Not found or not manageable by the caller",
  5308. "content": {
  5309. "application/json": {
  5310. "schema": {
  5311. "$ref": "#/components/schemas/Error"
  5312. }
  5313. }
  5314. }
  5315. },
  5316. "422": {
  5317. "description": "Validation failed, or cannot_change_self",
  5318. "content": {
  5319. "application/json": {
  5320. "schema": {
  5321. "$ref": "#/components/schemas/Error"
  5322. }
  5323. }
  5324. }
  5325. },
  5326. "500": {
  5327. "description": "Internal error",
  5328. "content": {
  5329. "application/json": {
  5330. "schema": {
  5331. "$ref": "#/components/schemas/Error"
  5332. }
  5333. }
  5334. }
  5335. }
  5336. }
  5337. }
  5338. },
  5339. "/principals/{id}/keys": {
  5340. "post": {
  5341. "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.",
  5342. "security": [
  5343. {
  5344. "bearerAuth": []
  5345. }
  5346. ],
  5347. "parameters": [
  5348. {
  5349. "name": "id",
  5350. "in": "path",
  5351. "required": true,
  5352. "schema": {
  5353. "type": "string",
  5354. "format": "uuid"
  5355. }
  5356. }
  5357. ],
  5358. "responses": {
  5359. "201": {
  5360. "description": "Created",
  5361. "content": {
  5362. "application/json": {
  5363. "schema": {
  5364. "$ref": "#/components/schemas/KeyCreated"
  5365. }
  5366. }
  5367. }
  5368. },
  5369. "401": {
  5370. "description": "Missing, invalid, revoked or expired API key",
  5371. "content": {
  5372. "application/json": {
  5373. "schema": {
  5374. "$ref": "#/components/schemas/Error"
  5375. }
  5376. }
  5377. }
  5378. },
  5379. "404": {
  5380. "description": "Not found or not manageable by the caller",
  5381. "content": {
  5382. "application/json": {
  5383. "schema": {
  5384. "$ref": "#/components/schemas/Error"
  5385. }
  5386. }
  5387. }
  5388. },
  5389. "409": {
  5390. "description": "principal_not_active",
  5391. "content": {
  5392. "application/json": {
  5393. "schema": {
  5394. "$ref": "#/components/schemas/Error"
  5395. }
  5396. }
  5397. }
  5398. },
  5399. "500": {
  5400. "description": "Internal error",
  5401. "content": {
  5402. "application/json": {
  5403. "schema": {
  5404. "$ref": "#/components/schemas/Error"
  5405. }
  5406. }
  5407. }
  5408. }
  5409. }
  5410. }
  5411. },
  5412. "/keys/{id}": {
  5413. "delete": {
  5414. "summary": "Revoke an API key (idempotent). Same rule as issuing keys.",
  5415. "security": [
  5416. {
  5417. "bearerAuth": []
  5418. }
  5419. ],
  5420. "parameters": [
  5421. {
  5422. "name": "id",
  5423. "in": "path",
  5424. "required": true,
  5425. "schema": {
  5426. "type": "string",
  5427. "format": "uuid"
  5428. }
  5429. }
  5430. ],
  5431. "responses": {
  5432. "200": {
  5433. "description": "Revoked",
  5434. "content": {
  5435. "application/json": {
  5436. "schema": {
  5437. "type": "object",
  5438. "properties": {
  5439. "id": {
  5440. "type": "string"
  5441. },
  5442. "principal_id": {
  5443. "type": "string"
  5444. },
  5445. "status": {
  5446. "type": "string",
  5447. "enum": [
  5448. "revoked"
  5449. ]
  5450. }
  5451. }
  5452. }
  5453. }
  5454. }
  5455. },
  5456. "401": {
  5457. "description": "Missing, invalid, revoked or expired API key",
  5458. "content": {
  5459. "application/json": {
  5460. "schema": {
  5461. "$ref": "#/components/schemas/Error"
  5462. }
  5463. }
  5464. }
  5465. },
  5466. "404": {
  5467. "description": "Not found or not manageable by the caller",
  5468. "content": {
  5469. "application/json": {
  5470. "schema": {
  5471. "$ref": "#/components/schemas/Error"
  5472. }
  5473. }
  5474. }
  5475. },
  5476. "500": {
  5477. "description": "Internal error",
  5478. "content": {
  5479. "application/json": {
  5480. "schema": {
  5481. "$ref": "#/components/schemas/Error"
  5482. }
  5483. }
  5484. }
  5485. }
  5486. }
  5487. }
  5488. },
  5489. "/grants": {
  5490. "get": {
  5491. "summary": "Grants on namespaces the caller administers.",
  5492. "security": [
  5493. {
  5494. "bearerAuth": []
  5495. }
  5496. ],
  5497. "parameters": [
  5498. {
  5499. "name": "namespace_id",
  5500. "in": "query",
  5501. "schema": {
  5502. "type": "string",
  5503. "format": "uuid"
  5504. }
  5505. },
  5506. {
  5507. "name": "principal_id",
  5508. "in": "query",
  5509. "schema": {
  5510. "type": "string",
  5511. "format": "uuid"
  5512. }
  5513. }
  5514. ],
  5515. "responses": {
  5516. "200": {
  5517. "description": "Grants",
  5518. "content": {
  5519. "application/json": {
  5520. "schema": {
  5521. "type": "object",
  5522. "properties": {
  5523. "data": {
  5524. "type": "array",
  5525. "items": {
  5526. "$ref": "#/components/schemas/Grant"
  5527. }
  5528. }
  5529. }
  5530. }
  5531. }
  5532. }
  5533. },
  5534. "401": {
  5535. "description": "Missing, invalid, revoked or expired API key",
  5536. "content": {
  5537. "application/json": {
  5538. "schema": {
  5539. "$ref": "#/components/schemas/Error"
  5540. }
  5541. }
  5542. }
  5543. },
  5544. "404": {
  5545. "description": "Caller is not an admin anywhere",
  5546. "content": {
  5547. "application/json": {
  5548. "schema": {
  5549. "$ref": "#/components/schemas/Error"
  5550. }
  5551. }
  5552. }
  5553. },
  5554. "422": {
  5555. "description": "Validation failed",
  5556. "content": {
  5557. "application/json": {
  5558. "schema": {
  5559. "$ref": "#/components/schemas/Error"
  5560. }
  5561. }
  5562. }
  5563. }
  5564. }
  5565. },
  5566. "post": {
  5567. "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.",
  5568. "security": [
  5569. {
  5570. "bearerAuth": []
  5571. }
  5572. ],
  5573. "requestBody": {
  5574. "required": true,
  5575. "content": {
  5576. "application/json": {
  5577. "schema": {
  5578. "$ref": "#/components/schemas/GrantRequest"
  5579. }
  5580. }
  5581. }
  5582. },
  5583. "responses": {
  5584. "201": {
  5585. "description": "Created",
  5586. "content": {
  5587. "application/json": {
  5588. "schema": {
  5589. "$ref": "#/components/schemas/Grant"
  5590. }
  5591. }
  5592. }
  5593. },
  5594. "400": {
  5595. "description": "Body is not valid JSON",
  5596. "content": {
  5597. "application/json": {
  5598. "schema": {
  5599. "$ref": "#/components/schemas/Error"
  5600. }
  5601. }
  5602. }
  5603. },
  5604. "401": {
  5605. "description": "Missing, invalid, revoked or expired API key",
  5606. "content": {
  5607. "application/json": {
  5608. "schema": {
  5609. "$ref": "#/components/schemas/Error"
  5610. }
  5611. }
  5612. }
  5613. },
  5614. "404": {
  5615. "description": "Namespace not found or caller lacks admin on it",
  5616. "content": {
  5617. "application/json": {
  5618. "schema": {
  5619. "$ref": "#/components/schemas/Error"
  5620. }
  5621. }
  5622. }
  5623. },
  5624. "409": {
  5625. "description": "grant_exists",
  5626. "content": {
  5627. "application/json": {
  5628. "schema": {
  5629. "$ref": "#/components/schemas/Error"
  5630. }
  5631. }
  5632. }
  5633. },
  5634. "422": {
  5635. "description": "Validation failed, principal_not_found or inherit_not_allowed",
  5636. "content": {
  5637. "application/json": {
  5638. "schema": {
  5639. "$ref": "#/components/schemas/Error"
  5640. }
  5641. }
  5642. }
  5643. },
  5644. "500": {
  5645. "description": "Internal error",
  5646. "content": {
  5647. "application/json": {
  5648. "schema": {
  5649. "$ref": "#/components/schemas/Error"
  5650. }
  5651. }
  5652. }
  5653. }
  5654. }
  5655. }
  5656. },
  5657. "/grants/{id}": {
  5658. "delete": {
  5659. "summary": "Remove a grant. Needs admin on its namespace; a principal cannot remove its own grants.",
  5660. "security": [
  5661. {
  5662. "bearerAuth": []
  5663. }
  5664. ],
  5665. "parameters": [
  5666. {
  5667. "name": "id",
  5668. "in": "path",
  5669. "required": true,
  5670. "schema": {
  5671. "type": "string",
  5672. "format": "uuid"
  5673. }
  5674. }
  5675. ],
  5676. "responses": {
  5677. "200": {
  5678. "description": "Deleted",
  5679. "content": {
  5680. "application/json": {
  5681. "schema": {
  5682. "type": "object",
  5683. "properties": {
  5684. "id": {
  5685. "type": "string"
  5686. },
  5687. "deleted": {
  5688. "type": "boolean"
  5689. }
  5690. }
  5691. }
  5692. }
  5693. }
  5694. },
  5695. "401": {
  5696. "description": "Missing, invalid, revoked or expired API key",
  5697. "content": {
  5698. "application/json": {
  5699. "schema": {
  5700. "$ref": "#/components/schemas/Error"
  5701. }
  5702. }
  5703. }
  5704. },
  5705. "404": {
  5706. "description": "Not found or caller lacks admin on its namespace",
  5707. "content": {
  5708. "application/json": {
  5709. "schema": {
  5710. "$ref": "#/components/schemas/Error"
  5711. }
  5712. }
  5713. }
  5714. },
  5715. "422": {
  5716. "description": "cannot_change_self",
  5717. "content": {
  5718. "application/json": {
  5719. "schema": {
  5720. "$ref": "#/components/schemas/Error"
  5721. }
  5722. }
  5723. }
  5724. },
  5725. "500": {
  5726. "description": "Internal error",
  5727. "content": {
  5728. "application/json": {
  5729. "schema": {
  5730. "$ref": "#/components/schemas/Error"
  5731. }
  5732. }
  5733. }
  5734. }
  5735. }
  5736. }
  5737. },
  5738. "/consolidations": {
  5739. "post": {
  5740. "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.",
  5741. "security": [
  5742. {
  5743. "bearerAuth": []
  5744. }
  5745. ],
  5746. "requestBody": {
  5747. "required": true,
  5748. "content": {
  5749. "application/json": {
  5750. "schema": {
  5751. "$ref": "#/components/schemas/ConsolidationRequest"
  5752. }
  5753. }
  5754. }
  5755. },
  5756. "responses": {
  5757. "200": {
  5758. "description": "Groups (largest first, at most 20)",
  5759. "content": {
  5760. "application/json": {
  5761. "schema": {
  5762. "$ref": "#/components/schemas/ConsolidationResult"
  5763. }
  5764. }
  5765. }
  5766. },
  5767. "400": {
  5768. "description": "Body is not valid JSON",
  5769. "content": {
  5770. "application/json": {
  5771. "schema": {
  5772. "$ref": "#/components/schemas/Error"
  5773. }
  5774. }
  5775. }
  5776. },
  5777. "401": {
  5778. "description": "Missing, invalid, revoked or expired API key",
  5779. "content": {
  5780. "application/json": {
  5781. "schema": {
  5782. "$ref": "#/components/schemas/Error"
  5783. }
  5784. }
  5785. }
  5786. },
  5787. "404": {
  5788. "description": "namespace_not_found (also without read, or without write when proposing)",
  5789. "content": {
  5790. "application/json": {
  5791. "schema": {
  5792. "$ref": "#/components/schemas/Error"
  5793. }
  5794. }
  5795. }
  5796. },
  5797. "422": {
  5798. "description": "Validation failed",
  5799. "content": {
  5800. "application/json": {
  5801. "schema": {
  5802. "$ref": "#/components/schemas/Error"
  5803. }
  5804. }
  5805. }
  5806. },
  5807. "500": {
  5808. "description": "Internal error",
  5809. "content": {
  5810. "application/json": {
  5811. "schema": {
  5812. "$ref": "#/components/schemas/Error"
  5813. }
  5814. }
  5815. }
  5816. }
  5817. }
  5818. }
  5819. },
  5820. "/entities": {
  5821. "post": {
  5822. "summary": "Create an entity (a named concept that relationships can connect). Needs write permission on the namespace.",
  5823. "tags": [
  5824. "graph"
  5825. ],
  5826. "security": [
  5827. {
  5828. "bearerAuth": []
  5829. }
  5830. ],
  5831. "requestBody": {
  5832. "required": true,
  5833. "content": {
  5834. "application/json": {
  5835. "schema": {
  5836. "$ref": "#/components/schemas/EntityRequest"
  5837. }
  5838. }
  5839. }
  5840. },
  5841. "responses": {
  5842. "201": {
  5843. "description": "Created",
  5844. "content": {
  5845. "application/json": {
  5846. "schema": {
  5847. "type": "object",
  5848. "properties": {
  5849. "data": {
  5850. "$ref": "#/components/schemas/Entity"
  5851. }
  5852. }
  5853. }
  5854. }
  5855. }
  5856. },
  5857. "400": {
  5858. "description": "Empty body or invalid JSON",
  5859. "content": {
  5860. "application/json": {
  5861. "schema": {
  5862. "$ref": "#/components/schemas/Error"
  5863. }
  5864. }
  5865. }
  5866. },
  5867. "401": {
  5868. "description": "Missing, invalid, revoked or expired API key",
  5869. "content": {
  5870. "application/json": {
  5871. "schema": {
  5872. "$ref": "#/components/schemas/Error"
  5873. }
  5874. }
  5875. }
  5876. },
  5877. "404": {
  5878. "description": "Namespace not found or not writable",
  5879. "content": {
  5880. "application/json": {
  5881. "schema": {
  5882. "$ref": "#/components/schemas/Error"
  5883. }
  5884. }
  5885. }
  5886. },
  5887. "409": {
  5888. "description": "An entity with this type and canonical key exists in the namespace (error.existing_id names it)",
  5889. "content": {
  5890. "application/json": {
  5891. "schema": {
  5892. "$ref": "#/components/schemas/Error"
  5893. }
  5894. }
  5895. }
  5896. },
  5897. "422": {
  5898. "description": "Validation failed",
  5899. "content": {
  5900. "application/json": {
  5901. "schema": {
  5902. "$ref": "#/components/schemas/Error"
  5903. }
  5904. }
  5905. }
  5906. }
  5907. }
  5908. },
  5909. "get": {
  5910. "summary": "List entities in readable namespaces.",
  5911. "tags": [
  5912. "graph"
  5913. ],
  5914. "security": [
  5915. {
  5916. "bearerAuth": []
  5917. }
  5918. ],
  5919. "parameters": [
  5920. {
  5921. "name": "namespace_id",
  5922. "in": "query",
  5923. "schema": {
  5924. "type": "string",
  5925. "format": "uuid"
  5926. }
  5927. },
  5928. {
  5929. "name": "type",
  5930. "in": "query",
  5931. "schema": {
  5932. "type": "string"
  5933. }
  5934. },
  5935. {
  5936. "name": "q",
  5937. "in": "query",
  5938. "schema": {
  5939. "type": "string",
  5940. "maxLength": 200
  5941. },
  5942. "description": "Substring of the name, canonical key or an alias."
  5943. },
  5944. {
  5945. "name": "limit",
  5946. "in": "query",
  5947. "schema": {
  5948. "type": "integer",
  5949. "minimum": 1,
  5950. "maximum": 200,
  5951. "default": 50
  5952. }
  5953. }
  5954. ],
  5955. "responses": {
  5956. "200": {
  5957. "description": "Entities",
  5958. "content": {
  5959. "application/json": {
  5960. "schema": {
  5961. "type": "object",
  5962. "properties": {
  5963. "data": {
  5964. "type": "array",
  5965. "items": {
  5966. "$ref": "#/components/schemas/Entity"
  5967. }
  5968. }
  5969. }
  5970. }
  5971. }
  5972. }
  5973. },
  5974. "401": {
  5975. "description": "Missing, invalid, revoked or expired API key",
  5976. "content": {
  5977. "application/json": {
  5978. "schema": {
  5979. "$ref": "#/components/schemas/Error"
  5980. }
  5981. }
  5982. }
  5983. },
  5984. "422": {
  5985. "description": "Validation failed",
  5986. "content": {
  5987. "application/json": {
  5988. "schema": {
  5989. "$ref": "#/components/schemas/Error"
  5990. }
  5991. }
  5992. }
  5993. }
  5994. }
  5995. }
  5996. },
  5997. "/entities/{id}": {
  5998. "get": {
  5999. "summary": "Fetch an entity.",
  6000. "tags": [
  6001. "graph"
  6002. ],
  6003. "security": [
  6004. {
  6005. "bearerAuth": []
  6006. }
  6007. ],
  6008. "parameters": [
  6009. {
  6010. "name": "id",
  6011. "in": "path",
  6012. "required": true,
  6013. "schema": {
  6014. "type": "string",
  6015. "format": "uuid"
  6016. }
  6017. }
  6018. ],
  6019. "responses": {
  6020. "200": {
  6021. "description": "Entity",
  6022. "content": {
  6023. "application/json": {
  6024. "schema": {
  6025. "type": "object",
  6026. "properties": {
  6027. "data": {
  6028. "$ref": "#/components/schemas/Entity"
  6029. }
  6030. }
  6031. }
  6032. }
  6033. }
  6034. },
  6035. "401": {
  6036. "description": "Missing, invalid, revoked or expired API key",
  6037. "content": {
  6038. "application/json": {
  6039. "schema": {
  6040. "$ref": "#/components/schemas/Error"
  6041. }
  6042. }
  6043. }
  6044. },
  6045. "404": {
  6046. "description": "Not found, or not visible to the caller",
  6047. "content": {
  6048. "application/json": {
  6049. "schema": {
  6050. "$ref": "#/components/schemas/Error"
  6051. }
  6052. }
  6053. }
  6054. }
  6055. }
  6056. },
  6057. "patch": {
  6058. "summary": "Change the name, aliases, description or properties of an entity. Needs write permission.",
  6059. "tags": [
  6060. "graph"
  6061. ],
  6062. "security": [
  6063. {
  6064. "bearerAuth": []
  6065. }
  6066. ],
  6067. "parameters": [
  6068. {
  6069. "name": "id",
  6070. "in": "path",
  6071. "required": true,
  6072. "schema": {
  6073. "type": "string",
  6074. "format": "uuid"
  6075. }
  6076. }
  6077. ],
  6078. "requestBody": {
  6079. "required": true,
  6080. "content": {
  6081. "application/json": {
  6082. "schema": {
  6083. "$ref": "#/components/schemas/EntityUpdate"
  6084. }
  6085. }
  6086. }
  6087. },
  6088. "responses": {
  6089. "200": {
  6090. "description": "Updated",
  6091. "content": {
  6092. "application/json": {
  6093. "schema": {
  6094. "type": "object",
  6095. "properties": {
  6096. "data": {
  6097. "$ref": "#/components/schemas/Entity"
  6098. }
  6099. }
  6100. }
  6101. }
  6102. }
  6103. },
  6104. "400": {
  6105. "description": "Empty body or invalid JSON",
  6106. "content": {
  6107. "application/json": {
  6108. "schema": {
  6109. "$ref": "#/components/schemas/Error"
  6110. }
  6111. }
  6112. }
  6113. },
  6114. "401": {
  6115. "description": "Missing, invalid, revoked or expired API key",
  6116. "content": {
  6117. "application/json": {
  6118. "schema": {
  6119. "$ref": "#/components/schemas/Error"
  6120. }
  6121. }
  6122. }
  6123. },
  6124. "404": {
  6125. "description": "Not found, or not visible to the caller",
  6126. "content": {
  6127. "application/json": {
  6128. "schema": {
  6129. "$ref": "#/components/schemas/Error"
  6130. }
  6131. }
  6132. }
  6133. },
  6134. "422": {
  6135. "description": "Validation failed",
  6136. "content": {
  6137. "application/json": {
  6138. "schema": {
  6139. "$ref": "#/components/schemas/Error"
  6140. }
  6141. }
  6142. }
  6143. }
  6144. }
  6145. },
  6146. "delete": {
  6147. "summary": "Delete an entity and every relationship touching it. Needs delete permission.",
  6148. "tags": [
  6149. "graph"
  6150. ],
  6151. "security": [
  6152. {
  6153. "bearerAuth": []
  6154. }
  6155. ],
  6156. "parameters": [
  6157. {
  6158. "name": "id",
  6159. "in": "path",
  6160. "required": true,
  6161. "schema": {
  6162. "type": "string",
  6163. "format": "uuid"
  6164. }
  6165. }
  6166. ],
  6167. "responses": {
  6168. "200": {
  6169. "description": "Deleted",
  6170. "content": {
  6171. "application/json": {
  6172. "schema": {
  6173. "type": "object",
  6174. "properties": {
  6175. "deleted": {
  6176. "type": "boolean"
  6177. },
  6178. "id": {
  6179. "type": "string"
  6180. }
  6181. }
  6182. }
  6183. }
  6184. }
  6185. },
  6186. "401": {
  6187. "description": "Missing, invalid, revoked or expired API key",
  6188. "content": {
  6189. "application/json": {
  6190. "schema": {
  6191. "$ref": "#/components/schemas/Error"
  6192. }
  6193. }
  6194. }
  6195. },
  6196. "404": {
  6197. "description": "Not found, or not visible to the caller",
  6198. "content": {
  6199. "application/json": {
  6200. "schema": {
  6201. "$ref": "#/components/schemas/Error"
  6202. }
  6203. }
  6204. }
  6205. }
  6206. }
  6207. }
  6208. },
  6209. "/relate": {
  6210. "post": {
  6211. "summary": "Propose a typed, directed relationship between two entities, memories or documents. Needs write permission on the namespace and read permission on both endpoints; evidence is required. The edge stays proposed until reviewed. Supports Idempotency-Key.",
  6212. "tags": [
  6213. "graph"
  6214. ],
  6215. "security": [
  6216. {
  6217. "bearerAuth": []
  6218. }
  6219. ],
  6220. "parameters": [
  6221. {
  6222. "name": "Idempotency-Key",
  6223. "in": "header",
  6224. "schema": {
  6225. "type": "string",
  6226. "maxLength": 200
  6227. }
  6228. }
  6229. ],
  6230. "requestBody": {
  6231. "required": true,
  6232. "content": {
  6233. "application/json": {
  6234. "schema": {
  6235. "$ref": "#/components/schemas/RelateRequest"
  6236. }
  6237. }
  6238. }
  6239. },
  6240. "responses": {
  6241. "201": {
  6242. "description": "Proposed",
  6243. "content": {
  6244. "application/json": {
  6245. "schema": {
  6246. "type": "object",
  6247. "properties": {
  6248. "id": {
  6249. "type": "string"
  6250. },
  6251. "state": {
  6252. "type": "string",
  6253. "enum": [
  6254. "proposed"
  6255. ]
  6256. },
  6257. "namespace_id": {
  6258. "type": "string"
  6259. },
  6260. "type": {
  6261. "type": "string"
  6262. },
  6263. "source": {
  6264. "$ref": "#/components/schemas/NodeRef"
  6265. },
  6266. "target": {
  6267. "$ref": "#/components/schemas/NodeRef"
  6268. },
  6269. "evidence_count": {
  6270. "type": "integer"
  6271. }
  6272. }
  6273. }
  6274. }
  6275. }
  6276. },
  6277. "400": {
  6278. "description": "Empty body or invalid JSON",
  6279. "content": {
  6280. "application/json": {
  6281. "schema": {
  6282. "$ref": "#/components/schemas/Error"
  6283. }
  6284. }
  6285. }
  6286. },
  6287. "401": {
  6288. "description": "Missing, invalid, revoked or expired API key",
  6289. "content": {
  6290. "application/json": {
  6291. "schema": {
  6292. "$ref": "#/components/schemas/Error"
  6293. }
  6294. }
  6295. }
  6296. },
  6297. "404": {
  6298. "description": "Namespace not found or not writable",
  6299. "content": {
  6300. "application/json": {
  6301. "schema": {
  6302. "$ref": "#/components/schemas/Error"
  6303. }
  6304. }
  6305. }
  6306. },
  6307. "409": {
  6308. "description": "The same relationship is already proposed or accepted in the namespace (error.existing_id names it)",
  6309. "content": {
  6310. "application/json": {
  6311. "schema": {
  6312. "$ref": "#/components/schemas/Error"
  6313. }
  6314. }
  6315. }
  6316. },
  6317. "422": {
  6318. "description": "Validation failed, including an endpoint or evidence target that does not exist or cannot be read",
  6319. "content": {
  6320. "application/json": {
  6321. "schema": {
  6322. "$ref": "#/components/schemas/Error"
  6323. }
  6324. }
  6325. }
  6326. }
  6327. }
  6328. }
  6329. },
  6330. "/relationships": {
  6331. "get": {
  6332. "summary": "List relationships visible to the caller: readable namespace and both endpoints readable.",
  6333. "tags": [
  6334. "graph"
  6335. ],
  6336. "security": [
  6337. {
  6338. "bearerAuth": []
  6339. }
  6340. ],
  6341. "parameters": [
  6342. {
  6343. "name": "namespace_id",
  6344. "in": "query",
  6345. "schema": {
  6346. "type": "string",
  6347. "format": "uuid"
  6348. }
  6349. },
  6350. {
  6351. "name": "state",
  6352. "in": "query",
  6353. "schema": {
  6354. "type": "string",
  6355. "enum": [
  6356. "proposed",
  6357. "accepted",
  6358. "rejected"
  6359. ]
  6360. }
  6361. },
  6362. {
  6363. "name": "type",
  6364. "in": "query",
  6365. "schema": {
  6366. "type": "string"
  6367. }
  6368. },
  6369. {
  6370. "name": "node_kind",
  6371. "in": "query",
  6372. "schema": {
  6373. "type": "string",
  6374. "enum": [
  6375. "entity",
  6376. "memory",
  6377. "document"
  6378. ]
  6379. }
  6380. },
  6381. {
  6382. "name": "node_id",
  6383. "in": "query",
  6384. "schema": {
  6385. "type": "string",
  6386. "format": "uuid"
  6387. },
  6388. "description": "With node_kind: only edges touching this node."
  6389. },
  6390. {
  6391. "name": "limit",
  6392. "in": "query",
  6393. "schema": {
  6394. "type": "integer",
  6395. "minimum": 1,
  6396. "maximum": 200,
  6397. "default": 50
  6398. }
  6399. }
  6400. ],
  6401. "responses": {
  6402. "200": {
  6403. "description": "Relationships, newest first",
  6404. "content": {
  6405. "application/json": {
  6406. "schema": {
  6407. "type": "object",
  6408. "properties": {
  6409. "data": {
  6410. "type": "array",
  6411. "items": {
  6412. "$ref": "#/components/schemas/Relationship"
  6413. }
  6414. }
  6415. }
  6416. }
  6417. }
  6418. }
  6419. },
  6420. "401": {
  6421. "description": "Missing, invalid, revoked or expired API key",
  6422. "content": {
  6423. "application/json": {
  6424. "schema": {
  6425. "$ref": "#/components/schemas/Error"
  6426. }
  6427. }
  6428. }
  6429. },
  6430. "422": {
  6431. "description": "Validation failed",
  6432. "content": {
  6433. "application/json": {
  6434. "schema": {
  6435. "$ref": "#/components/schemas/Error"
  6436. }
  6437. }
  6438. }
  6439. }
  6440. }
  6441. }
  6442. },
  6443. "/relationships/{id}": {
  6444. "get": {
  6445. "summary": "Fetch a relationship with its evidence (evidence the caller cannot read is shown without its id).",
  6446. "tags": [
  6447. "graph"
  6448. ],
  6449. "security": [
  6450. {
  6451. "bearerAuth": []
  6452. }
  6453. ],
  6454. "parameters": [
  6455. {
  6456. "name": "id",
  6457. "in": "path",
  6458. "required": true,
  6459. "schema": {
  6460. "type": "string",
  6461. "format": "uuid"
  6462. }
  6463. }
  6464. ],
  6465. "responses": {
  6466. "200": {
  6467. "description": "Relationship",
  6468. "content": {
  6469. "application/json": {
  6470. "schema": {
  6471. "type": "object",
  6472. "properties": {
  6473. "data": {
  6474. "$ref": "#/components/schemas/Relationship"
  6475. }
  6476. }
  6477. }
  6478. }
  6479. }
  6480. },
  6481. "401": {
  6482. "description": "Missing, invalid, revoked or expired API key",
  6483. "content": {
  6484. "application/json": {
  6485. "schema": {
  6486. "$ref": "#/components/schemas/Error"
  6487. }
  6488. }
  6489. }
  6490. },
  6491. "404": {
  6492. "description": "Not found, or not visible to the caller",
  6493. "content": {
  6494. "application/json": {
  6495. "schema": {
  6496. "$ref": "#/components/schemas/Error"
  6497. }
  6498. }
  6499. }
  6500. }
  6501. }
  6502. },
  6503. "delete": {
  6504. "summary": "Delete a relationship and its evidence. Needs delete permission on its namespace.",
  6505. "tags": [
  6506. "graph"
  6507. ],
  6508. "security": [
  6509. {
  6510. "bearerAuth": []
  6511. }
  6512. ],
  6513. "parameters": [
  6514. {
  6515. "name": "id",
  6516. "in": "path",
  6517. "required": true,
  6518. "schema": {
  6519. "type": "string",
  6520. "format": "uuid"
  6521. }
  6522. }
  6523. ],
  6524. "responses": {
  6525. "200": {
  6526. "description": "Deleted",
  6527. "content": {
  6528. "application/json": {
  6529. "schema": {
  6530. "type": "object",
  6531. "properties": {
  6532. "deleted": {
  6533. "type": "boolean"
  6534. },
  6535. "id": {
  6536. "type": "string"
  6537. }
  6538. }
  6539. }
  6540. }
  6541. }
  6542. },
  6543. "401": {
  6544. "description": "Missing, invalid, revoked or expired API key",
  6545. "content": {
  6546. "application/json": {
  6547. "schema": {
  6548. "$ref": "#/components/schemas/Error"
  6549. }
  6550. }
  6551. }
  6552. },
  6553. "404": {
  6554. "description": "Not found, or not visible to the caller",
  6555. "content": {
  6556. "application/json": {
  6557. "schema": {
  6558. "$ref": "#/components/schemas/Error"
  6559. }
  6560. }
  6561. }
  6562. }
  6563. }
  6564. }
  6565. },
  6566. "/relationships/{id}/review": {
  6567. "post": {
  6568. "summary": "Accept or reject a proposed relationship. Needs verify permission; the author cannot review its own relationship without admin.",
  6569. "tags": [
  6570. "graph"
  6571. ],
  6572. "security": [
  6573. {
  6574. "bearerAuth": []
  6575. }
  6576. ],
  6577. "parameters": [
  6578. {
  6579. "name": "id",
  6580. "in": "path",
  6581. "required": true,
  6582. "schema": {
  6583. "type": "string",
  6584. "format": "uuid"
  6585. }
  6586. }
  6587. ],
  6588. "requestBody": {
  6589. "required": true,
  6590. "content": {
  6591. "application/json": {
  6592. "schema": {
  6593. "$ref": "#/components/schemas/RelationshipReviewRequest"
  6594. }
  6595. }
  6596. }
  6597. },
  6598. "responses": {
  6599. "200": {
  6600. "description": "Reviewed",
  6601. "content": {
  6602. "application/json": {
  6603. "schema": {
  6604. "type": "object",
  6605. "properties": {
  6606. "id": {
  6607. "type": "string"
  6608. },
  6609. "state": {
  6610. "type": "string",
  6611. "enum": [
  6612. "accepted",
  6613. "rejected"
  6614. ]
  6615. }
  6616. }
  6617. }
  6618. }
  6619. }
  6620. },
  6621. "400": {
  6622. "description": "Empty body or invalid JSON",
  6623. "content": {
  6624. "application/json": {
  6625. "schema": {
  6626. "$ref": "#/components/schemas/Error"
  6627. }
  6628. }
  6629. }
  6630. },
  6631. "401": {
  6632. "description": "Missing, invalid, revoked or expired API key",
  6633. "content": {
  6634. "application/json": {
  6635. "schema": {
  6636. "$ref": "#/components/schemas/Error"
  6637. }
  6638. }
  6639. }
  6640. },
  6641. "403": {
  6642. "description": "self_review_not_allowed",
  6643. "content": {
  6644. "application/json": {
  6645. "schema": {
  6646. "$ref": "#/components/schemas/Error"
  6647. }
  6648. }
  6649. }
  6650. },
  6651. "404": {
  6652. "description": "Not found, or not visible to the caller",
  6653. "content": {
  6654. "application/json": {
  6655. "schema": {
  6656. "$ref": "#/components/schemas/Error"
  6657. }
  6658. }
  6659. }
  6660. },
  6661. "409": {
  6662. "description": "Already reviewed",
  6663. "content": {
  6664. "application/json": {
  6665. "schema": {
  6666. "$ref": "#/components/schemas/Error"
  6667. }
  6668. }
  6669. }
  6670. },
  6671. "422": {
  6672. "description": "Validation failed",
  6673. "content": {
  6674. "application/json": {
  6675. "schema": {
  6676. "$ref": "#/components/schemas/Error"
  6677. }
  6678. }
  6679. }
  6680. }
  6681. }
  6682. }
  6683. },
  6684. "/graph/traverse": {
  6685. "post": {
  6686. "summary": "Bounded breadth-first exploration from one node. Follows accepted edges that are valid now (proposed ones on request), skips retired memories, and never returns a node or edge the caller cannot read. Limits: depth 3, 100 nodes, 300 edges.",
  6687. "tags": [
  6688. "graph"
  6689. ],
  6690. "security": [
  6691. {
  6692. "bearerAuth": []
  6693. }
  6694. ],
  6695. "requestBody": {
  6696. "required": true,
  6697. "content": {
  6698. "application/json": {
  6699. "schema": {
  6700. "$ref": "#/components/schemas/TraverseRequest"
  6701. }
  6702. }
  6703. }
  6704. },
  6705. "responses": {
  6706. "200": {
  6707. "description": "Nodes and edges",
  6708. "content": {
  6709. "application/json": {
  6710. "schema": {
  6711. "$ref": "#/components/schemas/TraverseResult"
  6712. }
  6713. }
  6714. }
  6715. },
  6716. "400": {
  6717. "description": "Empty body or invalid JSON",
  6718. "content": {
  6719. "application/json": {
  6720. "schema": {
  6721. "$ref": "#/components/schemas/Error"
  6722. }
  6723. }
  6724. }
  6725. },
  6726. "401": {
  6727. "description": "Missing, invalid, revoked or expired API key",
  6728. "content": {
  6729. "application/json": {
  6730. "schema": {
  6731. "$ref": "#/components/schemas/Error"
  6732. }
  6733. }
  6734. }
  6735. },
  6736. "404": {
  6737. "description": "Start node not found or not readable",
  6738. "content": {
  6739. "application/json": {
  6740. "schema": {
  6741. "$ref": "#/components/schemas/Error"
  6742. }
  6743. }
  6744. }
  6745. },
  6746. "422": {
  6747. "description": "Validation failed",
  6748. "content": {
  6749. "application/json": {
  6750. "schema": {
  6751. "$ref": "#/components/schemas/Error"
  6752. }
  6753. }
  6754. }
  6755. }
  6756. }
  6757. }
  6758. }
  6759. }
  6760. }

Powered by TurnKey Linux.