Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

5391 linhas
144KB

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

Powered by TurnKey Linux.