選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

5171 行
137KB

  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. }
  1587. },
  1588. "paths": {
  1589. "/remember": {
  1590. "post": {
  1591. "summary": "Create a memory",
  1592. "security": [
  1593. {
  1594. "bearerAuth": []
  1595. }
  1596. ],
  1597. "parameters": [
  1598. {
  1599. "name": "Idempotency-Key",
  1600. "in": "header",
  1601. "required": false,
  1602. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  1603. "schema": {
  1604. "type": "string",
  1605. "maxLength": 200
  1606. }
  1607. }
  1608. ],
  1609. "requestBody": {
  1610. "required": true,
  1611. "content": {
  1612. "application/json": {
  1613. "schema": {
  1614. "$ref": "#/components/schemas/RememberRequest"
  1615. }
  1616. }
  1617. }
  1618. },
  1619. "responses": {
  1620. "201": {
  1621. "description": "Created",
  1622. "content": {
  1623. "application/json": {
  1624. "schema": {
  1625. "$ref": "#/components/schemas/RememberResponse"
  1626. }
  1627. }
  1628. }
  1629. },
  1630. "200": {
  1631. "description": "Exact duplicate (or idempotent replay of a 200)",
  1632. "content": {
  1633. "application/json": {
  1634. "schema": {
  1635. "$ref": "#/components/schemas/RememberResponse"
  1636. }
  1637. }
  1638. }
  1639. },
  1640. "400": {
  1641. "description": "Invalid JSON / body",
  1642. "content": {
  1643. "application/json": {
  1644. "schema": {
  1645. "$ref": "#/components/schemas/Error"
  1646. }
  1647. }
  1648. }
  1649. },
  1650. "409": {
  1651. "description": "Idempotency-Key reused with a different body",
  1652. "content": {
  1653. "application/json": {
  1654. "schema": {
  1655. "$ref": "#/components/schemas/Error"
  1656. }
  1657. }
  1658. }
  1659. },
  1660. "422": {
  1661. "description": "Validation failed",
  1662. "content": {
  1663. "application/json": {
  1664. "schema": {
  1665. "$ref": "#/components/schemas/Error"
  1666. }
  1667. }
  1668. }
  1669. },
  1670. "401": {
  1671. "description": "Missing, invalid, revoked or expired API key",
  1672. "content": {
  1673. "application/json": {
  1674. "schema": {
  1675. "$ref": "#/components/schemas/Error"
  1676. }
  1677. }
  1678. }
  1679. },
  1680. "404": {
  1681. "description": "Not found or not visible to the caller",
  1682. "content": {
  1683. "application/json": {
  1684. "schema": {
  1685. "$ref": "#/components/schemas/Error"
  1686. }
  1687. }
  1688. }
  1689. },
  1690. "500": {
  1691. "description": "Internal error",
  1692. "content": {
  1693. "application/json": {
  1694. "schema": {
  1695. "$ref": "#/components/schemas/Error"
  1696. }
  1697. }
  1698. }
  1699. }
  1700. }
  1701. }
  1702. },
  1703. "/memories": {
  1704. "get": {
  1705. "summary": "List memories (newest first)",
  1706. "security": [
  1707. {
  1708. "bearerAuth": []
  1709. }
  1710. ],
  1711. "parameters": [
  1712. {
  1713. "name": "namespace_id",
  1714. "in": "query",
  1715. "schema": {
  1716. "type": "string",
  1717. "format": "uuid"
  1718. }
  1719. },
  1720. {
  1721. "name": "type",
  1722. "in": "query",
  1723. "schema": {
  1724. "type": "string"
  1725. }
  1726. },
  1727. {
  1728. "name": "status",
  1729. "in": "query",
  1730. "schema": {
  1731. "type": "string",
  1732. "enum": [
  1733. "active",
  1734. "retired",
  1735. "superseded",
  1736. "all"
  1737. ],
  1738. "default": "active"
  1739. }
  1740. },
  1741. {
  1742. "name": "verification_status",
  1743. "in": "query",
  1744. "schema": {
  1745. "type": "string",
  1746. "enum": [
  1747. "unverified",
  1748. "verified",
  1749. "disputed",
  1750. "rejected"
  1751. ]
  1752. }
  1753. },
  1754. {
  1755. "name": "limit",
  1756. "in": "query",
  1757. "schema": {
  1758. "type": "integer",
  1759. "minimum": 1,
  1760. "maximum": 100,
  1761. "default": 20
  1762. }
  1763. },
  1764. {
  1765. "name": "cursor",
  1766. "in": "query",
  1767. "description": "next_cursor from the previous page",
  1768. "schema": {
  1769. "type": "string"
  1770. }
  1771. }
  1772. ],
  1773. "responses": {
  1774. "200": {
  1775. "description": "Page of memories",
  1776. "content": {
  1777. "application/json": {
  1778. "schema": {
  1779. "type": "object",
  1780. "properties": {
  1781. "data": {
  1782. "type": "array",
  1783. "items": {
  1784. "$ref": "#/components/schemas/Memory"
  1785. }
  1786. },
  1787. "next_cursor": {
  1788. "type": "string",
  1789. "nullable": true
  1790. }
  1791. }
  1792. }
  1793. }
  1794. }
  1795. },
  1796. "400": {
  1797. "description": "Invalid cursor",
  1798. "content": {
  1799. "application/json": {
  1800. "schema": {
  1801. "$ref": "#/components/schemas/Error"
  1802. }
  1803. }
  1804. }
  1805. },
  1806. "422": {
  1807. "description": "Invalid filter",
  1808. "content": {
  1809. "application/json": {
  1810. "schema": {
  1811. "$ref": "#/components/schemas/Error"
  1812. }
  1813. }
  1814. }
  1815. },
  1816. "401": {
  1817. "description": "Missing, invalid, revoked or expired API key",
  1818. "content": {
  1819. "application/json": {
  1820. "schema": {
  1821. "$ref": "#/components/schemas/Error"
  1822. }
  1823. }
  1824. }
  1825. },
  1826. "404": {
  1827. "description": "Not found or not visible to the caller",
  1828. "content": {
  1829. "application/json": {
  1830. "schema": {
  1831. "$ref": "#/components/schemas/Error"
  1832. }
  1833. }
  1834. }
  1835. },
  1836. "500": {
  1837. "description": "Internal error",
  1838. "content": {
  1839. "application/json": {
  1840. "schema": {
  1841. "$ref": "#/components/schemas/Error"
  1842. }
  1843. }
  1844. }
  1845. }
  1846. }
  1847. }
  1848. },
  1849. "/memories/{id}": {
  1850. "get": {
  1851. "summary": "Get a memory (optionally an older revision)",
  1852. "security": [
  1853. {
  1854. "bearerAuth": []
  1855. }
  1856. ],
  1857. "parameters": [
  1858. {
  1859. "name": "id",
  1860. "in": "path",
  1861. "required": true,
  1862. "schema": {
  1863. "type": "string",
  1864. "format": "uuid"
  1865. }
  1866. },
  1867. {
  1868. "name": "revision",
  1869. "in": "query",
  1870. "schema": {
  1871. "type": "integer"
  1872. }
  1873. }
  1874. ],
  1875. "responses": {
  1876. "200": {
  1877. "description": "The memory",
  1878. "content": {
  1879. "application/json": {
  1880. "schema": {
  1881. "type": "object",
  1882. "properties": {
  1883. "data": {
  1884. "$ref": "#/components/schemas/Memory"
  1885. }
  1886. }
  1887. }
  1888. }
  1889. }
  1890. },
  1891. "401": {
  1892. "description": "Missing, invalid, revoked or expired API key",
  1893. "content": {
  1894. "application/json": {
  1895. "schema": {
  1896. "$ref": "#/components/schemas/Error"
  1897. }
  1898. }
  1899. }
  1900. },
  1901. "404": {
  1902. "description": "Not found or not visible to the caller",
  1903. "content": {
  1904. "application/json": {
  1905. "schema": {
  1906. "$ref": "#/components/schemas/Error"
  1907. }
  1908. }
  1909. }
  1910. },
  1911. "500": {
  1912. "description": "Internal error",
  1913. "content": {
  1914. "application/json": {
  1915. "schema": {
  1916. "$ref": "#/components/schemas/Error"
  1917. }
  1918. }
  1919. }
  1920. }
  1921. }
  1922. },
  1923. "patch": {
  1924. "summary": "Correct a memory: creates the next revision, unverified",
  1925. "security": [
  1926. {
  1927. "bearerAuth": []
  1928. }
  1929. ],
  1930. "parameters": [
  1931. {
  1932. "name": "id",
  1933. "in": "path",
  1934. "required": true,
  1935. "schema": {
  1936. "type": "string",
  1937. "format": "uuid"
  1938. }
  1939. },
  1940. {
  1941. "name": "If-Match",
  1942. "in": "header",
  1943. "required": false,
  1944. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  1945. "schema": {
  1946. "type": "string"
  1947. }
  1948. }
  1949. ],
  1950. "requestBody": {
  1951. "required": true,
  1952. "content": {
  1953. "application/json": {
  1954. "schema": {
  1955. "type": "object",
  1956. "properties": {
  1957. "title": {
  1958. "type": "string"
  1959. },
  1960. "summary": {
  1961. "type": "string"
  1962. },
  1963. "content": {
  1964. "type": "string"
  1965. },
  1966. "tags": {
  1967. "type": "array",
  1968. "items": {
  1969. "type": "string"
  1970. }
  1971. },
  1972. "attributes": {
  1973. "type": "object"
  1974. },
  1975. "confidence": {
  1976. "type": "number"
  1977. },
  1978. "importance": {
  1979. "type": "number"
  1980. },
  1981. "change_reason": {
  1982. "type": "string"
  1983. },
  1984. "expected_revision": {
  1985. "type": "integer"
  1986. }
  1987. }
  1988. }
  1989. }
  1990. }
  1991. },
  1992. "responses": {
  1993. "200": {
  1994. "description": "New revision",
  1995. "content": {
  1996. "application/json": {
  1997. "schema": {
  1998. "$ref": "#/components/schemas/RememberResponse"
  1999. }
  2000. }
  2001. }
  2002. },
  2003. "400": {
  2004. "description": "Bad body / revision",
  2005. "content": {
  2006. "application/json": {
  2007. "schema": {
  2008. "$ref": "#/components/schemas/Error"
  2009. }
  2010. }
  2011. }
  2012. },
  2013. "409": {
  2014. "description": "Memory is not active",
  2015. "content": {
  2016. "application/json": {
  2017. "schema": {
  2018. "$ref": "#/components/schemas/Error"
  2019. }
  2020. }
  2021. }
  2022. },
  2023. "412": {
  2024. "description": "Stale revision (ETag header carries the current one)",
  2025. "content": {
  2026. "application/json": {
  2027. "schema": {
  2028. "$ref": "#/components/schemas/Error"
  2029. }
  2030. }
  2031. }
  2032. },
  2033. "422": {
  2034. "description": "Validation failed",
  2035. "content": {
  2036. "application/json": {
  2037. "schema": {
  2038. "$ref": "#/components/schemas/Error"
  2039. }
  2040. }
  2041. }
  2042. },
  2043. "428": {
  2044. "description": "If-Match missing",
  2045. "content": {
  2046. "application/json": {
  2047. "schema": {
  2048. "$ref": "#/components/schemas/Error"
  2049. }
  2050. }
  2051. }
  2052. },
  2053. "401": {
  2054. "description": "Missing, invalid, revoked or expired API key",
  2055. "content": {
  2056. "application/json": {
  2057. "schema": {
  2058. "$ref": "#/components/schemas/Error"
  2059. }
  2060. }
  2061. }
  2062. },
  2063. "404": {
  2064. "description": "Not found or not visible to the caller",
  2065. "content": {
  2066. "application/json": {
  2067. "schema": {
  2068. "$ref": "#/components/schemas/Error"
  2069. }
  2070. }
  2071. }
  2072. },
  2073. "500": {
  2074. "description": "Internal error",
  2075. "content": {
  2076. "application/json": {
  2077. "schema": {
  2078. "$ref": "#/components/schemas/Error"
  2079. }
  2080. }
  2081. }
  2082. }
  2083. }
  2084. },
  2085. "delete": {
  2086. "summary": "Forget: permanently delete the memory and its revisions (needs delete permission)",
  2087. "security": [
  2088. {
  2089. "bearerAuth": []
  2090. }
  2091. ],
  2092. "parameters": [
  2093. {
  2094. "name": "id",
  2095. "in": "path",
  2096. "required": true,
  2097. "schema": {
  2098. "type": "string",
  2099. "format": "uuid"
  2100. }
  2101. }
  2102. ],
  2103. "responses": {
  2104. "200": {
  2105. "description": "Deleted"
  2106. },
  2107. "401": {
  2108. "description": "Missing, invalid, revoked or expired API key",
  2109. "content": {
  2110. "application/json": {
  2111. "schema": {
  2112. "$ref": "#/components/schemas/Error"
  2113. }
  2114. }
  2115. }
  2116. },
  2117. "404": {
  2118. "description": "Not found or not visible to the caller",
  2119. "content": {
  2120. "application/json": {
  2121. "schema": {
  2122. "$ref": "#/components/schemas/Error"
  2123. }
  2124. }
  2125. }
  2126. },
  2127. "500": {
  2128. "description": "Internal error",
  2129. "content": {
  2130. "application/json": {
  2131. "schema": {
  2132. "$ref": "#/components/schemas/Error"
  2133. }
  2134. }
  2135. }
  2136. }
  2137. }
  2138. }
  2139. },
  2140. "/memories/{id}/retire": {
  2141. "post": {
  2142. "summary": "Retire: exclude from ordinary listing",
  2143. "security": [
  2144. {
  2145. "bearerAuth": []
  2146. }
  2147. ],
  2148. "parameters": [
  2149. {
  2150. "name": "id",
  2151. "in": "path",
  2152. "required": true,
  2153. "schema": {
  2154. "type": "string",
  2155. "format": "uuid"
  2156. }
  2157. }
  2158. ],
  2159. "responses": {
  2160. "200": {
  2161. "description": "Retired"
  2162. },
  2163. "401": {
  2164. "description": "Missing, invalid, revoked or expired API key",
  2165. "content": {
  2166. "application/json": {
  2167. "schema": {
  2168. "$ref": "#/components/schemas/Error"
  2169. }
  2170. }
  2171. }
  2172. },
  2173. "404": {
  2174. "description": "Not found or not visible to the caller",
  2175. "content": {
  2176. "application/json": {
  2177. "schema": {
  2178. "$ref": "#/components/schemas/Error"
  2179. }
  2180. }
  2181. }
  2182. },
  2183. "500": {
  2184. "description": "Internal error",
  2185. "content": {
  2186. "application/json": {
  2187. "schema": {
  2188. "$ref": "#/components/schemas/Error"
  2189. }
  2190. }
  2191. }
  2192. }
  2193. }
  2194. }
  2195. },
  2196. "/memories/{id}/versions": {
  2197. "get": {
  2198. "summary": "Revision history, newest first",
  2199. "security": [
  2200. {
  2201. "bearerAuth": []
  2202. }
  2203. ],
  2204. "parameters": [
  2205. {
  2206. "name": "id",
  2207. "in": "path",
  2208. "required": true,
  2209. "schema": {
  2210. "type": "string",
  2211. "format": "uuid"
  2212. }
  2213. }
  2214. ],
  2215. "responses": {
  2216. "200": {
  2217. "description": "Revisions"
  2218. },
  2219. "401": {
  2220. "description": "Missing, invalid, revoked or expired API key",
  2221. "content": {
  2222. "application/json": {
  2223. "schema": {
  2224. "$ref": "#/components/schemas/Error"
  2225. }
  2226. }
  2227. }
  2228. },
  2229. "404": {
  2230. "description": "Not found or not visible to the caller",
  2231. "content": {
  2232. "application/json": {
  2233. "schema": {
  2234. "$ref": "#/components/schemas/Error"
  2235. }
  2236. }
  2237. }
  2238. },
  2239. "500": {
  2240. "description": "Internal error",
  2241. "content": {
  2242. "application/json": {
  2243. "schema": {
  2244. "$ref": "#/components/schemas/Error"
  2245. }
  2246. }
  2247. }
  2248. }
  2249. }
  2250. }
  2251. },
  2252. "/sessions": {
  2253. "post": {
  2254. "summary": "Start a session",
  2255. "security": [
  2256. {
  2257. "bearerAuth": []
  2258. }
  2259. ],
  2260. "parameters": [
  2261. {
  2262. "name": "Idempotency-Key",
  2263. "in": "header",
  2264. "required": false,
  2265. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  2266. "schema": {
  2267. "type": "string",
  2268. "maxLength": 200
  2269. }
  2270. }
  2271. ],
  2272. "requestBody": {
  2273. "required": true,
  2274. "content": {
  2275. "application/json": {
  2276. "schema": {
  2277. "type": "object",
  2278. "required": [
  2279. "namespace_id",
  2280. "objective"
  2281. ],
  2282. "properties": {
  2283. "namespace_id": {
  2284. "type": "string",
  2285. "format": "uuid"
  2286. },
  2287. "objective": {
  2288. "type": "string",
  2289. "maxLength": 2000
  2290. }
  2291. }
  2292. }
  2293. }
  2294. }
  2295. },
  2296. "responses": {
  2297. "201": {
  2298. "description": "Started"
  2299. },
  2300. "422": {
  2301. "description": "Validation failed",
  2302. "content": {
  2303. "application/json": {
  2304. "schema": {
  2305. "$ref": "#/components/schemas/Error"
  2306. }
  2307. }
  2308. }
  2309. },
  2310. "409": {
  2311. "description": "Idempotency conflict",
  2312. "content": {
  2313. "application/json": {
  2314. "schema": {
  2315. "$ref": "#/components/schemas/Error"
  2316. }
  2317. }
  2318. }
  2319. },
  2320. "401": {
  2321. "description": "Missing, invalid, revoked or expired API key",
  2322. "content": {
  2323. "application/json": {
  2324. "schema": {
  2325. "$ref": "#/components/schemas/Error"
  2326. }
  2327. }
  2328. }
  2329. },
  2330. "404": {
  2331. "description": "Not found or not visible to the caller",
  2332. "content": {
  2333. "application/json": {
  2334. "schema": {
  2335. "$ref": "#/components/schemas/Error"
  2336. }
  2337. }
  2338. }
  2339. },
  2340. "500": {
  2341. "description": "Internal error",
  2342. "content": {
  2343. "application/json": {
  2344. "schema": {
  2345. "$ref": "#/components/schemas/Error"
  2346. }
  2347. }
  2348. }
  2349. }
  2350. }
  2351. }
  2352. },
  2353. "/sessions/{id}/state": {
  2354. "get": {
  2355. "summary": "Restore the latest checkpoint (revision 0 / state null when none)",
  2356. "security": [
  2357. {
  2358. "bearerAuth": []
  2359. }
  2360. ],
  2361. "parameters": [
  2362. {
  2363. "name": "id",
  2364. "in": "path",
  2365. "required": true,
  2366. "schema": {
  2367. "type": "string",
  2368. "format": "uuid"
  2369. }
  2370. }
  2371. ],
  2372. "responses": {
  2373. "200": {
  2374. "description": "Checkpoint; ETag = revision"
  2375. },
  2376. "401": {
  2377. "description": "Missing, invalid, revoked or expired API key",
  2378. "content": {
  2379. "application/json": {
  2380. "schema": {
  2381. "$ref": "#/components/schemas/Error"
  2382. }
  2383. }
  2384. }
  2385. },
  2386. "404": {
  2387. "description": "Not found or not visible to the caller",
  2388. "content": {
  2389. "application/json": {
  2390. "schema": {
  2391. "$ref": "#/components/schemas/Error"
  2392. }
  2393. }
  2394. }
  2395. },
  2396. "500": {
  2397. "description": "Internal error",
  2398. "content": {
  2399. "application/json": {
  2400. "schema": {
  2401. "$ref": "#/components/schemas/Error"
  2402. }
  2403. }
  2404. }
  2405. }
  2406. }
  2407. },
  2408. "put": {
  2409. "summary": "Save a checkpoint (If-Match = current checkpoint revision, 0 for the first)",
  2410. "security": [
  2411. {
  2412. "bearerAuth": []
  2413. }
  2414. ],
  2415. "parameters": [
  2416. {
  2417. "name": "id",
  2418. "in": "path",
  2419. "required": true,
  2420. "schema": {
  2421. "type": "string",
  2422. "format": "uuid"
  2423. }
  2424. },
  2425. {
  2426. "name": "If-Match",
  2427. "in": "header",
  2428. "required": false,
  2429. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  2430. "schema": {
  2431. "type": "string"
  2432. }
  2433. }
  2434. ],
  2435. "requestBody": {
  2436. "required": true,
  2437. "content": {
  2438. "application/json": {
  2439. "schema": {
  2440. "$ref": "#/components/schemas/SaveStateRequest"
  2441. }
  2442. }
  2443. }
  2444. },
  2445. "responses": {
  2446. "200": {
  2447. "description": "Saved; ETag = new revision"
  2448. },
  2449. "409": {
  2450. "description": "Session closed",
  2451. "content": {
  2452. "application/json": {
  2453. "schema": {
  2454. "$ref": "#/components/schemas/Error"
  2455. }
  2456. }
  2457. }
  2458. },
  2459. "412": {
  2460. "description": "Stale revision",
  2461. "content": {
  2462. "application/json": {
  2463. "schema": {
  2464. "$ref": "#/components/schemas/Error"
  2465. }
  2466. }
  2467. }
  2468. },
  2469. "422": {
  2470. "description": "Validation failed",
  2471. "content": {
  2472. "application/json": {
  2473. "schema": {
  2474. "$ref": "#/components/schemas/Error"
  2475. }
  2476. }
  2477. }
  2478. },
  2479. "428": {
  2480. "description": "If-Match missing",
  2481. "content": {
  2482. "application/json": {
  2483. "schema": {
  2484. "$ref": "#/components/schemas/Error"
  2485. }
  2486. }
  2487. }
  2488. },
  2489. "401": {
  2490. "description": "Missing, invalid, revoked or expired API key",
  2491. "content": {
  2492. "application/json": {
  2493. "schema": {
  2494. "$ref": "#/components/schemas/Error"
  2495. }
  2496. }
  2497. }
  2498. },
  2499. "404": {
  2500. "description": "Not found or not visible to the caller",
  2501. "content": {
  2502. "application/json": {
  2503. "schema": {
  2504. "$ref": "#/components/schemas/Error"
  2505. }
  2506. }
  2507. }
  2508. },
  2509. "500": {
  2510. "description": "Internal error",
  2511. "content": {
  2512. "application/json": {
  2513. "schema": {
  2514. "$ref": "#/components/schemas/Error"
  2515. }
  2516. }
  2517. }
  2518. }
  2519. }
  2520. }
  2521. },
  2522. "/sessions/{id}/complete": {
  2523. "post": {
  2524. "summary": "Complete a session",
  2525. "security": [
  2526. {
  2527. "bearerAuth": []
  2528. }
  2529. ],
  2530. "parameters": [
  2531. {
  2532. "name": "id",
  2533. "in": "path",
  2534. "required": true,
  2535. "schema": {
  2536. "type": "string",
  2537. "format": "uuid"
  2538. }
  2539. }
  2540. ],
  2541. "requestBody": {
  2542. "required": false,
  2543. "content": {
  2544. "application/json": {
  2545. "schema": {
  2546. "type": "object",
  2547. "properties": {
  2548. "outcome": {
  2549. "type": "string",
  2550. "maxLength": 4000
  2551. }
  2552. }
  2553. }
  2554. }
  2555. }
  2556. },
  2557. "responses": {
  2558. "200": {
  2559. "description": "Completed"
  2560. },
  2561. "409": {
  2562. "description": "Already closed",
  2563. "content": {
  2564. "application/json": {
  2565. "schema": {
  2566. "$ref": "#/components/schemas/Error"
  2567. }
  2568. }
  2569. }
  2570. },
  2571. "401": {
  2572. "description": "Missing, invalid, revoked or expired API key",
  2573. "content": {
  2574. "application/json": {
  2575. "schema": {
  2576. "$ref": "#/components/schemas/Error"
  2577. }
  2578. }
  2579. }
  2580. },
  2581. "404": {
  2582. "description": "Not found or not visible to the caller",
  2583. "content": {
  2584. "application/json": {
  2585. "schema": {
  2586. "$ref": "#/components/schemas/Error"
  2587. }
  2588. }
  2589. }
  2590. },
  2591. "500": {
  2592. "description": "Internal error",
  2593. "content": {
  2594. "application/json": {
  2595. "schema": {
  2596. "$ref": "#/components/schemas/Error"
  2597. }
  2598. }
  2599. }
  2600. }
  2601. }
  2602. }
  2603. },
  2604. "/memories/{id}/verifications": {
  2605. "post": {
  2606. "summary": "Record a verification of the current revision (needs the verify permission)",
  2607. "security": [
  2608. {
  2609. "bearerAuth": []
  2610. }
  2611. ],
  2612. "parameters": [
  2613. {
  2614. "name": "id",
  2615. "in": "path",
  2616. "required": true,
  2617. "schema": {
  2618. "type": "string",
  2619. "format": "uuid"
  2620. }
  2621. }
  2622. ],
  2623. "requestBody": {
  2624. "required": true,
  2625. "content": {
  2626. "application/json": {
  2627. "schema": {
  2628. "$ref": "#/components/schemas/VerifyRequest"
  2629. }
  2630. }
  2631. }
  2632. },
  2633. "responses": {
  2634. "200": {
  2635. "description": "Recorded; returns the new verification_status"
  2636. },
  2637. "409": {
  2638. "description": "Not the current revision",
  2639. "content": {
  2640. "application/json": {
  2641. "schema": {
  2642. "$ref": "#/components/schemas/Error"
  2643. }
  2644. }
  2645. }
  2646. },
  2647. "422": {
  2648. "description": "Validation failed",
  2649. "content": {
  2650. "application/json": {
  2651. "schema": {
  2652. "$ref": "#/components/schemas/Error"
  2653. }
  2654. }
  2655. }
  2656. },
  2657. "401": {
  2658. "description": "Missing, invalid, revoked or expired API key",
  2659. "content": {
  2660. "application/json": {
  2661. "schema": {
  2662. "$ref": "#/components/schemas/Error"
  2663. }
  2664. }
  2665. }
  2666. },
  2667. "404": {
  2668. "description": "Not found or not visible to the caller",
  2669. "content": {
  2670. "application/json": {
  2671. "schema": {
  2672. "$ref": "#/components/schemas/Error"
  2673. }
  2674. }
  2675. }
  2676. },
  2677. "500": {
  2678. "description": "Internal error",
  2679. "content": {
  2680. "application/json": {
  2681. "schema": {
  2682. "$ref": "#/components/schemas/Error"
  2683. }
  2684. }
  2685. }
  2686. }
  2687. }
  2688. }
  2689. },
  2690. "/recall": {
  2691. "post": {
  2692. "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",
  2693. "security": [
  2694. {
  2695. "bearerAuth": []
  2696. }
  2697. ],
  2698. "requestBody": {
  2699. "required": true,
  2700. "content": {
  2701. "application/json": {
  2702. "schema": {
  2703. "$ref": "#/components/schemas/RecallRequest"
  2704. }
  2705. }
  2706. }
  2707. },
  2708. "responses": {
  2709. "200": {
  2710. "description": "Ranked results with warnings"
  2711. },
  2712. "422": {
  2713. "description": "Validation failed",
  2714. "content": {
  2715. "application/json": {
  2716. "schema": {
  2717. "$ref": "#/components/schemas/Error"
  2718. }
  2719. }
  2720. }
  2721. },
  2722. "401": {
  2723. "description": "Missing, invalid, revoked or expired API key",
  2724. "content": {
  2725. "application/json": {
  2726. "schema": {
  2727. "$ref": "#/components/schemas/Error"
  2728. }
  2729. }
  2730. }
  2731. },
  2732. "404": {
  2733. "description": "Not found or not visible to the caller",
  2734. "content": {
  2735. "application/json": {
  2736. "schema": {
  2737. "$ref": "#/components/schemas/Error"
  2738. }
  2739. }
  2740. }
  2741. },
  2742. "500": {
  2743. "description": "Internal error",
  2744. "content": {
  2745. "application/json": {
  2746. "schema": {
  2747. "$ref": "#/components/schemas/Error"
  2748. }
  2749. }
  2750. }
  2751. }
  2752. },
  2753. "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."
  2754. }
  2755. },
  2756. "/ingestion/jobs": {
  2757. "post": {
  2758. "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.",
  2759. "security": [
  2760. {
  2761. "bearerAuth": []
  2762. }
  2763. ],
  2764. "parameters": [
  2765. {
  2766. "name": "Idempotency-Key",
  2767. "in": "header",
  2768. "required": false,
  2769. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  2770. "schema": {
  2771. "type": "string",
  2772. "maxLength": 200
  2773. }
  2774. }
  2775. ],
  2776. "requestBody": {
  2777. "required": true,
  2778. "content": {
  2779. "application/json": {
  2780. "schema": {
  2781. "$ref": "#/components/schemas/IngestRequest"
  2782. }
  2783. }
  2784. }
  2785. },
  2786. "responses": {
  2787. "201": {
  2788. "description": "Ingested (new document or new revision)",
  2789. "content": {
  2790. "application/json": {
  2791. "schema": {
  2792. "$ref": "#/components/schemas/IngestResponse"
  2793. }
  2794. }
  2795. }
  2796. },
  2797. "200": {
  2798. "description": "Unchanged or idempotent replay",
  2799. "content": {
  2800. "application/json": {
  2801. "schema": {
  2802. "$ref": "#/components/schemas/IngestResponse"
  2803. }
  2804. }
  2805. }
  2806. },
  2807. "400": {
  2808. "description": "Invalid JSON",
  2809. "content": {
  2810. "application/json": {
  2811. "schema": {
  2812. "$ref": "#/components/schemas/Error"
  2813. }
  2814. }
  2815. }
  2816. },
  2817. "409": {
  2818. "description": "Idempotency-Key reused with a different body",
  2819. "content": {
  2820. "application/json": {
  2821. "schema": {
  2822. "$ref": "#/components/schemas/Error"
  2823. }
  2824. }
  2825. }
  2826. },
  2827. "422": {
  2828. "description": "Validation failed",
  2829. "content": {
  2830. "application/json": {
  2831. "schema": {
  2832. "$ref": "#/components/schemas/Error"
  2833. }
  2834. }
  2835. }
  2836. },
  2837. "401": {
  2838. "description": "Missing, invalid, revoked or expired API key",
  2839. "content": {
  2840. "application/json": {
  2841. "schema": {
  2842. "$ref": "#/components/schemas/Error"
  2843. }
  2844. }
  2845. }
  2846. },
  2847. "404": {
  2848. "description": "Not found or not visible to the caller",
  2849. "content": {
  2850. "application/json": {
  2851. "schema": {
  2852. "$ref": "#/components/schemas/Error"
  2853. }
  2854. }
  2855. }
  2856. },
  2857. "500": {
  2858. "description": "Internal error. When the job was already stored, its input is kept and the worker retries it (Location: the job)",
  2859. "content": {
  2860. "application/json": {
  2861. "schema": {
  2862. "$ref": "#/components/schemas/Error"
  2863. }
  2864. }
  2865. }
  2866. },
  2867. "202": {
  2868. "description": "Queued (async): job reference; the worker publishes the revision",
  2869. "content": {
  2870. "application/json": {
  2871. "schema": {
  2872. "$ref": "#/components/schemas/JobQueued"
  2873. }
  2874. }
  2875. }
  2876. }
  2877. }
  2878. }
  2879. },
  2880. "/jobs/{id}": {
  2881. "get": {
  2882. "summary": "Ingestion job state",
  2883. "security": [
  2884. {
  2885. "bearerAuth": []
  2886. }
  2887. ],
  2888. "parameters": [
  2889. {
  2890. "name": "id",
  2891. "in": "path",
  2892. "required": true,
  2893. "schema": {
  2894. "type": "string",
  2895. "format": "uuid"
  2896. }
  2897. }
  2898. ],
  2899. "responses": {
  2900. "200": {
  2901. "description": "Job",
  2902. "content": {
  2903. "application/json": {
  2904. "schema": {
  2905. "$ref": "#/components/schemas/Job"
  2906. }
  2907. }
  2908. }
  2909. },
  2910. "401": {
  2911. "description": "Missing, invalid, revoked or expired API key",
  2912. "content": {
  2913. "application/json": {
  2914. "schema": {
  2915. "$ref": "#/components/schemas/Error"
  2916. }
  2917. }
  2918. }
  2919. },
  2920. "404": {
  2921. "description": "Not found or not visible to the caller",
  2922. "content": {
  2923. "application/json": {
  2924. "schema": {
  2925. "$ref": "#/components/schemas/Error"
  2926. }
  2927. }
  2928. }
  2929. },
  2930. "500": {
  2931. "description": "Internal error",
  2932. "content": {
  2933. "application/json": {
  2934. "schema": {
  2935. "$ref": "#/components/schemas/Error"
  2936. }
  2937. }
  2938. }
  2939. }
  2940. }
  2941. }
  2942. },
  2943. "/jobs/{id}/retry": {
  2944. "post": {
  2945. "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.",
  2946. "security": [
  2947. {
  2948. "bearerAuth": []
  2949. }
  2950. ],
  2951. "parameters": [
  2952. {
  2953. "name": "id",
  2954. "in": "path",
  2955. "required": true,
  2956. "schema": {
  2957. "type": "string",
  2958. "format": "uuid"
  2959. }
  2960. }
  2961. ],
  2962. "responses": {
  2963. "202": {
  2964. "description": "Queued",
  2965. "content": {
  2966. "application/json": {
  2967. "schema": {
  2968. "$ref": "#/components/schemas/JobQueued"
  2969. }
  2970. }
  2971. }
  2972. },
  2973. "401": {
  2974. "description": "Missing, invalid, revoked or expired API key",
  2975. "content": {
  2976. "application/json": {
  2977. "schema": {
  2978. "$ref": "#/components/schemas/Error"
  2979. }
  2980. }
  2981. }
  2982. },
  2983. "404": {
  2984. "description": "Not found, or no write permission on the job's namespace",
  2985. "content": {
  2986. "application/json": {
  2987. "schema": {
  2988. "$ref": "#/components/schemas/Error"
  2989. }
  2990. }
  2991. }
  2992. },
  2993. "409": {
  2994. "description": "job_not_retryable: the job is not failed, or its input is no longer stored",
  2995. "content": {
  2996. "application/json": {
  2997. "schema": {
  2998. "$ref": "#/components/schemas/Error"
  2999. }
  3000. }
  3001. }
  3002. },
  3003. "500": {
  3004. "description": "Internal error",
  3005. "content": {
  3006. "application/json": {
  3007. "schema": {
  3008. "$ref": "#/components/schemas/Error"
  3009. }
  3010. }
  3011. }
  3012. }
  3013. }
  3014. }
  3015. },
  3016. "/documents/{id}": {
  3017. "get": {
  3018. "summary": "Document metadata (?include_content=true adds the normalized text)",
  3019. "security": [
  3020. {
  3021. "bearerAuth": []
  3022. }
  3023. ],
  3024. "parameters": [
  3025. {
  3026. "name": "id",
  3027. "in": "path",
  3028. "required": true,
  3029. "schema": {
  3030. "type": "string",
  3031. "format": "uuid"
  3032. }
  3033. },
  3034. {
  3035. "name": "include_content",
  3036. "in": "query",
  3037. "schema": {
  3038. "type": "boolean"
  3039. }
  3040. }
  3041. ],
  3042. "responses": {
  3043. "200": {
  3044. "description": "Document"
  3045. },
  3046. "401": {
  3047. "description": "Missing, invalid, revoked or expired API key",
  3048. "content": {
  3049. "application/json": {
  3050. "schema": {
  3051. "$ref": "#/components/schemas/Error"
  3052. }
  3053. }
  3054. }
  3055. },
  3056. "404": {
  3057. "description": "Not found or not visible to the caller",
  3058. "content": {
  3059. "application/json": {
  3060. "schema": {
  3061. "$ref": "#/components/schemas/Error"
  3062. }
  3063. }
  3064. }
  3065. },
  3066. "500": {
  3067. "description": "Internal error",
  3068. "content": {
  3069. "application/json": {
  3070. "schema": {
  3071. "$ref": "#/components/schemas/Error"
  3072. }
  3073. }
  3074. }
  3075. }
  3076. }
  3077. }
  3078. },
  3079. "/chunks/{id}": {
  3080. "get": {
  3081. "summary": "One chunk with heading path and source locator (character offsets into the normalized document text)",
  3082. "security": [
  3083. {
  3084. "bearerAuth": []
  3085. }
  3086. ],
  3087. "parameters": [
  3088. {
  3089. "name": "id",
  3090. "in": "path",
  3091. "required": true,
  3092. "schema": {
  3093. "type": "string",
  3094. "format": "uuid"
  3095. }
  3096. }
  3097. ],
  3098. "responses": {
  3099. "200": {
  3100. "description": "Chunk"
  3101. },
  3102. "401": {
  3103. "description": "Missing, invalid, revoked or expired API key",
  3104. "content": {
  3105. "application/json": {
  3106. "schema": {
  3107. "$ref": "#/components/schemas/Error"
  3108. }
  3109. }
  3110. }
  3111. },
  3112. "404": {
  3113. "description": "Not found or not visible to the caller",
  3114. "content": {
  3115. "application/json": {
  3116. "schema": {
  3117. "$ref": "#/components/schemas/Error"
  3118. }
  3119. }
  3120. }
  3121. },
  3122. "500": {
  3123. "description": "Internal error",
  3124. "content": {
  3125. "application/json": {
  3126. "schema": {
  3127. "$ref": "#/components/schemas/Error"
  3128. }
  3129. }
  3130. }
  3131. }
  3132. }
  3133. }
  3134. },
  3135. "/search": {
  3136. "post": {
  3137. "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",
  3138. "security": [
  3139. {
  3140. "bearerAuth": []
  3141. }
  3142. ],
  3143. "requestBody": {
  3144. "required": true,
  3145. "content": {
  3146. "application/json": {
  3147. "schema": {
  3148. "$ref": "#/components/schemas/SearchRequest"
  3149. }
  3150. }
  3151. }
  3152. },
  3153. "responses": {
  3154. "200": {
  3155. "description": "Ranked chunks with locators and content_trust"
  3156. },
  3157. "422": {
  3158. "description": "Validation failed",
  3159. "content": {
  3160. "application/json": {
  3161. "schema": {
  3162. "$ref": "#/components/schemas/Error"
  3163. }
  3164. }
  3165. }
  3166. },
  3167. "401": {
  3168. "description": "Missing, invalid, revoked or expired API key",
  3169. "content": {
  3170. "application/json": {
  3171. "schema": {
  3172. "$ref": "#/components/schemas/Error"
  3173. }
  3174. }
  3175. }
  3176. },
  3177. "404": {
  3178. "description": "Not found or not visible to the caller",
  3179. "content": {
  3180. "application/json": {
  3181. "schema": {
  3182. "$ref": "#/components/schemas/Error"
  3183. }
  3184. }
  3185. }
  3186. },
  3187. "500": {
  3188. "description": "Internal error",
  3189. "content": {
  3190. "application/json": {
  3191. "schema": {
  3192. "$ref": "#/components/schemas/Error"
  3193. }
  3194. }
  3195. }
  3196. }
  3197. },
  3198. "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."
  3199. }
  3200. },
  3201. "/health/live": {
  3202. "get": {
  3203. "summary": "Liveness",
  3204. "responses": {
  3205. "200": {
  3206. "description": "Live"
  3207. }
  3208. }
  3209. }
  3210. },
  3211. "/health/ready": {
  3212. "get": {
  3213. "summary": "Readiness (database reachable)",
  3214. "responses": {
  3215. "200": {
  3216. "description": "Ready"
  3217. },
  3218. "503": {
  3219. "description": "Unavailable"
  3220. }
  3221. }
  3222. }
  3223. },
  3224. "/metrics": {
  3225. "get": {
  3226. "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.",
  3227. "tags": [
  3228. "health"
  3229. ],
  3230. "responses": {
  3231. "200": {
  3232. "description": "Metrics",
  3233. "content": {
  3234. "text/plain": {
  3235. "schema": {
  3236. "type": "string"
  3237. }
  3238. }
  3239. }
  3240. },
  3241. "401": {
  3242. "description": "Missing or wrong metrics token",
  3243. "content": {
  3244. "application/json": {
  3245. "schema": {
  3246. "$ref": "#/components/schemas/Error"
  3247. }
  3248. }
  3249. }
  3250. },
  3251. "404": {
  3252. "description": "Metrics are disabled (no AMK_METRICS_TOKEN)",
  3253. "content": {
  3254. "application/json": {
  3255. "schema": {
  3256. "$ref": "#/components/schemas/Error"
  3257. }
  3258. }
  3259. }
  3260. }
  3261. }
  3262. }
  3263. },
  3264. "/context": {
  3265. "post": {
  3266. "summary": "Assemble a token-budgeted task briefing: constraints by scope, working state, preferences, conflicts, hybrid matches and reference passages",
  3267. "security": [
  3268. {
  3269. "bearerAuth": []
  3270. }
  3271. ],
  3272. "requestBody": {
  3273. "required": true,
  3274. "content": {
  3275. "application/json": {
  3276. "schema": {
  3277. "$ref": "#/components/schemas/ContextRequest"
  3278. }
  3279. }
  3280. }
  3281. },
  3282. "responses": {
  3283. "200": {
  3284. "description": "Briefing",
  3285. "content": {
  3286. "application/json": {
  3287. "schema": {
  3288. "$ref": "#/components/schemas/ContextResponse"
  3289. }
  3290. }
  3291. }
  3292. },
  3293. "400": {
  3294. "description": "Empty body or invalid JSON",
  3295. "content": {
  3296. "application/json": {
  3297. "schema": {
  3298. "$ref": "#/components/schemas/Error"
  3299. }
  3300. }
  3301. }
  3302. },
  3303. "401": {
  3304. "description": "Missing, invalid, revoked or expired API key",
  3305. "content": {
  3306. "application/json": {
  3307. "schema": {
  3308. "$ref": "#/components/schemas/Error"
  3309. }
  3310. }
  3311. }
  3312. },
  3313. "404": {
  3314. "description": "session_id not found or not visible to the caller",
  3315. "content": {
  3316. "application/json": {
  3317. "schema": {
  3318. "$ref": "#/components/schemas/Error"
  3319. }
  3320. }
  3321. }
  3322. },
  3323. "422": {
  3324. "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)",
  3325. "content": {
  3326. "application/json": {
  3327. "schema": {
  3328. "$ref": "#/components/schemas/Error"
  3329. }
  3330. }
  3331. }
  3332. },
  3333. "500": {
  3334. "description": "Internal error",
  3335. "content": {
  3336. "application/json": {
  3337. "schema": {
  3338. "$ref": "#/components/schemas/Error"
  3339. }
  3340. }
  3341. }
  3342. }
  3343. }
  3344. }
  3345. },
  3346. "/sessions/{id}/events": {
  3347. "post": {
  3348. "summary": "Record an experience (task, problem, action, result, outcome) in an active session",
  3349. "tags": [
  3350. "learning"
  3351. ],
  3352. "security": [
  3353. {
  3354. "bearerAuth": []
  3355. }
  3356. ],
  3357. "parameters": [
  3358. {
  3359. "name": "id",
  3360. "in": "path",
  3361. "required": true,
  3362. "schema": {
  3363. "type": "string",
  3364. "format": "uuid"
  3365. }
  3366. },
  3367. {
  3368. "name": "Idempotency-Key",
  3369. "in": "header",
  3370. "required": false,
  3371. "schema": {
  3372. "type": "string",
  3373. "maxLength": 200
  3374. },
  3375. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  3376. }
  3377. ],
  3378. "requestBody": {
  3379. "required": true,
  3380. "content": {
  3381. "application/json": {
  3382. "schema": {
  3383. "$ref": "#/components/schemas/ExperienceRequest"
  3384. }
  3385. }
  3386. }
  3387. },
  3388. "responses": {
  3389. "201": {
  3390. "description": "Recorded",
  3391. "content": {
  3392. "application/json": {
  3393. "schema": {
  3394. "type": "object",
  3395. "properties": {
  3396. "id": {
  3397. "type": "string"
  3398. },
  3399. "session_id": {
  3400. "type": "string"
  3401. },
  3402. "outcome": {
  3403. "type": "string"
  3404. },
  3405. "created_at": {
  3406. "type": "string"
  3407. }
  3408. }
  3409. }
  3410. }
  3411. }
  3412. },
  3413. "400": {
  3414. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  3415. "content": {
  3416. "application/json": {
  3417. "schema": {
  3418. "$ref": "#/components/schemas/Error"
  3419. }
  3420. }
  3421. }
  3422. },
  3423. "401": {
  3424. "description": "Missing, invalid, revoked or expired API key",
  3425. "content": {
  3426. "application/json": {
  3427. "schema": {
  3428. "$ref": "#/components/schemas/Error"
  3429. }
  3430. }
  3431. }
  3432. },
  3433. "404": {
  3434. "description": "Session not found, or no write permission on its namespace",
  3435. "content": {
  3436. "application/json": {
  3437. "schema": {
  3438. "$ref": "#/components/schemas/Error"
  3439. }
  3440. }
  3441. }
  3442. },
  3443. "409": {
  3444. "description": "session_not_active (completed session) or idempotency_conflict",
  3445. "content": {
  3446. "application/json": {
  3447. "schema": {
  3448. "$ref": "#/components/schemas/Error"
  3449. }
  3450. }
  3451. }
  3452. },
  3453. "422": {
  3454. "description": "Validation failed or unsupported_character",
  3455. "content": {
  3456. "application/json": {
  3457. "schema": {
  3458. "$ref": "#/components/schemas/Error"
  3459. }
  3460. }
  3461. }
  3462. },
  3463. "500": {
  3464. "description": "Internal error",
  3465. "content": {
  3466. "application/json": {
  3467. "schema": {
  3468. "$ref": "#/components/schemas/Error"
  3469. }
  3470. }
  3471. }
  3472. }
  3473. }
  3474. },
  3475. "get": {
  3476. "summary": "List the experiences of a session, oldest first (max 200)",
  3477. "tags": [
  3478. "learning"
  3479. ],
  3480. "security": [
  3481. {
  3482. "bearerAuth": []
  3483. }
  3484. ],
  3485. "parameters": [
  3486. {
  3487. "name": "id",
  3488. "in": "path",
  3489. "required": true,
  3490. "schema": {
  3491. "type": "string",
  3492. "format": "uuid"
  3493. }
  3494. }
  3495. ],
  3496. "responses": {
  3497. "200": {
  3498. "description": "Experiences",
  3499. "content": {
  3500. "application/json": {
  3501. "schema": {
  3502. "type": "object",
  3503. "properties": {
  3504. "session_id": {
  3505. "type": "string"
  3506. },
  3507. "data": {
  3508. "type": "array",
  3509. "items": {
  3510. "$ref": "#/components/schemas/Experience"
  3511. }
  3512. }
  3513. }
  3514. }
  3515. }
  3516. }
  3517. },
  3518. "401": {
  3519. "description": "Missing, invalid, revoked or expired API key",
  3520. "content": {
  3521. "application/json": {
  3522. "schema": {
  3523. "$ref": "#/components/schemas/Error"
  3524. }
  3525. }
  3526. }
  3527. },
  3528. "404": {
  3529. "description": "Session not found or not readable",
  3530. "content": {
  3531. "application/json": {
  3532. "schema": {
  3533. "$ref": "#/components/schemas/Error"
  3534. }
  3535. }
  3536. }
  3537. },
  3538. "500": {
  3539. "description": "Internal error",
  3540. "content": {
  3541. "application/json": {
  3542. "schema": {
  3543. "$ref": "#/components/schemas/Error"
  3544. }
  3545. }
  3546. }
  3547. }
  3548. }
  3549. }
  3550. },
  3551. "/learn": {
  3552. "post": {
  3553. "summary": "Propose knowledge as a learning candidate (a new memory, or a new revision of target_memory_id at base_revision), with evidence",
  3554. "tags": [
  3555. "learning"
  3556. ],
  3557. "security": [
  3558. {
  3559. "bearerAuth": []
  3560. }
  3561. ],
  3562. "parameters": [
  3563. {
  3564. "name": "Idempotency-Key",
  3565. "in": "header",
  3566. "required": false,
  3567. "schema": {
  3568. "type": "string",
  3569. "maxLength": 200
  3570. },
  3571. "description": "Replays the stored response for a repeated request; 409 if reused with a different body."
  3572. }
  3573. ],
  3574. "requestBody": {
  3575. "required": true,
  3576. "content": {
  3577. "application/json": {
  3578. "schema": {
  3579. "$ref": "#/components/schemas/LearnRequest"
  3580. }
  3581. }
  3582. }
  3583. },
  3584. "responses": {
  3585. "201": {
  3586. "description": "Candidate proposed",
  3587. "content": {
  3588. "application/json": {
  3589. "schema": {
  3590. "type": "object",
  3591. "properties": {
  3592. "id": {
  3593. "type": "string"
  3594. },
  3595. "state": {
  3596. "type": "string",
  3597. "enum": [
  3598. "proposed"
  3599. ]
  3600. },
  3601. "namespace_id": {
  3602. "type": "string"
  3603. },
  3604. "type": {
  3605. "type": "string"
  3606. },
  3607. "evidence_count": {
  3608. "type": "integer"
  3609. }
  3610. }
  3611. }
  3612. }
  3613. }
  3614. },
  3615. "400": {
  3616. "description": "Empty body, invalid JSON or invalid Idempotency-Key",
  3617. "content": {
  3618. "application/json": {
  3619. "schema": {
  3620. "$ref": "#/components/schemas/Error"
  3621. }
  3622. }
  3623. }
  3624. },
  3625. "401": {
  3626. "description": "Missing, invalid, revoked or expired API key",
  3627. "content": {
  3628. "application/json": {
  3629. "schema": {
  3630. "$ref": "#/components/schemas/Error"
  3631. }
  3632. }
  3633. }
  3634. },
  3635. "404": {
  3636. "description": "Namespace not found or no write permission",
  3637. "content": {
  3638. "application/json": {
  3639. "schema": {
  3640. "$ref": "#/components/schemas/Error"
  3641. }
  3642. }
  3643. }
  3644. },
  3645. "409": {
  3646. "description": "idempotency_conflict",
  3647. "content": {
  3648. "application/json": {
  3649. "schema": {
  3650. "$ref": "#/components/schemas/Error"
  3651. }
  3652. }
  3653. }
  3654. },
  3655. "422": {
  3656. "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",
  3657. "content": {
  3658. "application/json": {
  3659. "schema": {
  3660. "$ref": "#/components/schemas/Error"
  3661. }
  3662. }
  3663. }
  3664. },
  3665. "500": {
  3666. "description": "Internal error",
  3667. "content": {
  3668. "application/json": {
  3669. "schema": {
  3670. "$ref": "#/components/schemas/Error"
  3671. }
  3672. }
  3673. }
  3674. }
  3675. }
  3676. }
  3677. },
  3678. "/candidates": {
  3679. "get": {
  3680. "summary": "List learning candidates in namespaces the caller can read, newest first",
  3681. "tags": [
  3682. "learning"
  3683. ],
  3684. "security": [
  3685. {
  3686. "bearerAuth": []
  3687. }
  3688. ],
  3689. "parameters": [
  3690. {
  3691. "name": "namespace_id",
  3692. "in": "query",
  3693. "schema": {
  3694. "type": "string",
  3695. "format": "uuid"
  3696. }
  3697. },
  3698. {
  3699. "name": "state",
  3700. "in": "query",
  3701. "schema": {
  3702. "type": "string",
  3703. "enum": [
  3704. "proposed",
  3705. "accepted",
  3706. "rejected"
  3707. ]
  3708. }
  3709. },
  3710. {
  3711. "name": "limit",
  3712. "in": "query",
  3713. "schema": {
  3714. "type": "integer",
  3715. "minimum": 1,
  3716. "maximum": 200,
  3717. "default": 50
  3718. }
  3719. }
  3720. ],
  3721. "responses": {
  3722. "200": {
  3723. "description": "Candidates (without content)",
  3724. "content": {
  3725. "application/json": {
  3726. "schema": {
  3727. "type": "object",
  3728. "properties": {
  3729. "data": {
  3730. "type": "array",
  3731. "items": {
  3732. "$ref": "#/components/schemas/Candidate"
  3733. }
  3734. }
  3735. }
  3736. }
  3737. }
  3738. }
  3739. },
  3740. "401": {
  3741. "description": "Missing, invalid, revoked or expired API key",
  3742. "content": {
  3743. "application/json": {
  3744. "schema": {
  3745. "$ref": "#/components/schemas/Error"
  3746. }
  3747. }
  3748. }
  3749. },
  3750. "422": {
  3751. "description": "Bad state or namespace_id",
  3752. "content": {
  3753. "application/json": {
  3754. "schema": {
  3755. "$ref": "#/components/schemas/Error"
  3756. }
  3757. }
  3758. }
  3759. },
  3760. "500": {
  3761. "description": "Internal error",
  3762. "content": {
  3763. "application/json": {
  3764. "schema": {
  3765. "$ref": "#/components/schemas/Error"
  3766. }
  3767. }
  3768. }
  3769. }
  3770. }
  3771. }
  3772. },
  3773. "/candidates/{id}": {
  3774. "get": {
  3775. "summary": "One candidate with content and evidence",
  3776. "tags": [
  3777. "learning"
  3778. ],
  3779. "security": [
  3780. {
  3781. "bearerAuth": []
  3782. }
  3783. ],
  3784. "parameters": [
  3785. {
  3786. "name": "id",
  3787. "in": "path",
  3788. "required": true,
  3789. "schema": {
  3790. "type": "string",
  3791. "format": "uuid"
  3792. }
  3793. }
  3794. ],
  3795. "responses": {
  3796. "200": {
  3797. "description": "Candidate",
  3798. "content": {
  3799. "application/json": {
  3800. "schema": {
  3801. "type": "object",
  3802. "properties": {
  3803. "data": {
  3804. "$ref": "#/components/schemas/Candidate"
  3805. }
  3806. }
  3807. }
  3808. }
  3809. }
  3810. },
  3811. "401": {
  3812. "description": "Missing, invalid, revoked or expired API key",
  3813. "content": {
  3814. "application/json": {
  3815. "schema": {
  3816. "$ref": "#/components/schemas/Error"
  3817. }
  3818. }
  3819. }
  3820. },
  3821. "404": {
  3822. "description": "Not found or not readable",
  3823. "content": {
  3824. "application/json": {
  3825. "schema": {
  3826. "$ref": "#/components/schemas/Error"
  3827. }
  3828. }
  3829. }
  3830. },
  3831. "500": {
  3832. "description": "Internal error",
  3833. "content": {
  3834. "application/json": {
  3835. "schema": {
  3836. "$ref": "#/components/schemas/Error"
  3837. }
  3838. }
  3839. }
  3840. }
  3841. }
  3842. }
  3843. },
  3844. "/candidates/{id}/review": {
  3845. "post": {
  3846. "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.",
  3847. "tags": [
  3848. "learning"
  3849. ],
  3850. "security": [
  3851. {
  3852. "bearerAuth": []
  3853. }
  3854. ],
  3855. "parameters": [
  3856. {
  3857. "name": "id",
  3858. "in": "path",
  3859. "required": true,
  3860. "schema": {
  3861. "type": "string",
  3862. "format": "uuid"
  3863. }
  3864. }
  3865. ],
  3866. "requestBody": {
  3867. "required": true,
  3868. "content": {
  3869. "application/json": {
  3870. "schema": {
  3871. "$ref": "#/components/schemas/ReviewRequest"
  3872. }
  3873. }
  3874. }
  3875. },
  3876. "responses": {
  3877. "200": {
  3878. "description": "Reviewed",
  3879. "content": {
  3880. "application/json": {
  3881. "schema": {
  3882. "type": "object",
  3883. "properties": {
  3884. "id": {
  3885. "type": "string"
  3886. },
  3887. "state": {
  3888. "type": "string",
  3889. "enum": [
  3890. "accepted",
  3891. "rejected"
  3892. ]
  3893. },
  3894. "resulting_memory_id": {
  3895. "type": "string"
  3896. },
  3897. "resulting_revision": {
  3898. "type": "integer"
  3899. },
  3900. "verification_status": {
  3901. "type": "string"
  3902. },
  3903. "duplicate": {
  3904. "type": "boolean"
  3905. }
  3906. }
  3907. }
  3908. }
  3909. }
  3910. },
  3911. "400": {
  3912. "description": "Empty body or invalid JSON",
  3913. "content": {
  3914. "application/json": {
  3915. "schema": {
  3916. "$ref": "#/components/schemas/Error"
  3917. }
  3918. }
  3919. }
  3920. },
  3921. "401": {
  3922. "description": "Missing, invalid, revoked or expired API key",
  3923. "content": {
  3924. "application/json": {
  3925. "schema": {
  3926. "$ref": "#/components/schemas/Error"
  3927. }
  3928. }
  3929. }
  3930. },
  3931. "403": {
  3932. "description": "self_review_not_allowed",
  3933. "content": {
  3934. "application/json": {
  3935. "schema": {
  3936. "$ref": "#/components/schemas/Error"
  3937. }
  3938. }
  3939. }
  3940. },
  3941. "404": {
  3942. "description": "Candidate not found or no verify permission",
  3943. "content": {
  3944. "application/json": {
  3945. "schema": {
  3946. "$ref": "#/components/schemas/Error"
  3947. }
  3948. }
  3949. }
  3950. },
  3951. "409": {
  3952. "description": "candidate_already_reviewed, stale_candidate (target memory changed since base_revision), target_memory_missing or target_memory_not_active",
  3953. "content": {
  3954. "application/json": {
  3955. "schema": {
  3956. "$ref": "#/components/schemas/Error"
  3957. }
  3958. }
  3959. }
  3960. },
  3961. "422": {
  3962. "description": "Validation failed",
  3963. "content": {
  3964. "application/json": {
  3965. "schema": {
  3966. "$ref": "#/components/schemas/Error"
  3967. }
  3968. }
  3969. }
  3970. },
  3971. "500": {
  3972. "description": "Internal error",
  3973. "content": {
  3974. "application/json": {
  3975. "schema": {
  3976. "$ref": "#/components/schemas/Error"
  3977. }
  3978. }
  3979. }
  3980. }
  3981. }
  3982. }
  3983. },
  3984. "/memories/{id}/sources": {
  3985. "get": {
  3986. "summary": "Evidence and verifications behind a memory revision. Evidence the caller cannot read is listed with available false and no id.",
  3987. "tags": [
  3988. "learning"
  3989. ],
  3990. "security": [
  3991. {
  3992. "bearerAuth": []
  3993. }
  3994. ],
  3995. "parameters": [
  3996. {
  3997. "name": "id",
  3998. "in": "path",
  3999. "required": true,
  4000. "schema": {
  4001. "type": "string",
  4002. "format": "uuid"
  4003. }
  4004. },
  4005. {
  4006. "name": "revision",
  4007. "in": "query",
  4008. "schema": {
  4009. "type": "integer",
  4010. "minimum": 1
  4011. },
  4012. "description": "Default: current revision"
  4013. }
  4014. ],
  4015. "responses": {
  4016. "200": {
  4017. "description": "Sources",
  4018. "content": {
  4019. "application/json": {
  4020. "schema": {
  4021. "$ref": "#/components/schemas/Sources"
  4022. }
  4023. }
  4024. }
  4025. },
  4026. "401": {
  4027. "description": "Missing, invalid, revoked or expired API key",
  4028. "content": {
  4029. "application/json": {
  4030. "schema": {
  4031. "$ref": "#/components/schemas/Error"
  4032. }
  4033. }
  4034. }
  4035. },
  4036. "404": {
  4037. "description": "Memory not found or not readable",
  4038. "content": {
  4039. "application/json": {
  4040. "schema": {
  4041. "$ref": "#/components/schemas/Error"
  4042. }
  4043. }
  4044. }
  4045. },
  4046. "422": {
  4047. "description": "revision out of range",
  4048. "content": {
  4049. "application/json": {
  4050. "schema": {
  4051. "$ref": "#/components/schemas/Error"
  4052. }
  4053. }
  4054. }
  4055. },
  4056. "500": {
  4057. "description": "Internal error",
  4058. "content": {
  4059. "application/json": {
  4060. "schema": {
  4061. "$ref": "#/components/schemas/Error"
  4062. }
  4063. }
  4064. }
  4065. }
  4066. }
  4067. }
  4068. },
  4069. "/feedback": {
  4070. "post": {
  4071. "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.",
  4072. "tags": [
  4073. "learning"
  4074. ],
  4075. "security": [
  4076. {
  4077. "bearerAuth": []
  4078. }
  4079. ],
  4080. "requestBody": {
  4081. "required": true,
  4082. "content": {
  4083. "application/json": {
  4084. "schema": {
  4085. "$ref": "#/components/schemas/FeedbackRequest"
  4086. }
  4087. }
  4088. }
  4089. },
  4090. "responses": {
  4091. "200": {
  4092. "description": "Updated",
  4093. "content": {
  4094. "application/json": {
  4095. "schema": {
  4096. "$ref": "#/components/schemas/Feedback"
  4097. }
  4098. }
  4099. }
  4100. },
  4101. "201": {
  4102. "description": "Recorded",
  4103. "content": {
  4104. "application/json": {
  4105. "schema": {
  4106. "$ref": "#/components/schemas/Feedback"
  4107. }
  4108. }
  4109. }
  4110. },
  4111. "400": {
  4112. "description": "Empty body or invalid JSON",
  4113. "content": {
  4114. "application/json": {
  4115. "schema": {
  4116. "$ref": "#/components/schemas/Error"
  4117. }
  4118. }
  4119. }
  4120. },
  4121. "401": {
  4122. "description": "Missing, invalid, revoked or expired API key",
  4123. "content": {
  4124. "application/json": {
  4125. "schema": {
  4126. "$ref": "#/components/schemas/Error"
  4127. }
  4128. }
  4129. }
  4130. },
  4131. "404": {
  4132. "description": "result_not_found: the result was not returned by that query, is gone, or is not readable",
  4133. "content": {
  4134. "application/json": {
  4135. "schema": {
  4136. "$ref": "#/components/schemas/Error"
  4137. }
  4138. }
  4139. }
  4140. },
  4141. "422": {
  4142. "description": "Validation failed",
  4143. "content": {
  4144. "application/json": {
  4145. "schema": {
  4146. "$ref": "#/components/schemas/Error"
  4147. }
  4148. }
  4149. }
  4150. },
  4151. "500": {
  4152. "description": "Internal error",
  4153. "content": {
  4154. "application/json": {
  4155. "schema": {
  4156. "$ref": "#/components/schemas/Error"
  4157. }
  4158. }
  4159. }
  4160. }
  4161. }
  4162. }
  4163. },
  4164. "/exports": {
  4165. "post": {
  4166. "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.",
  4167. "tags": [
  4168. "portability"
  4169. ],
  4170. "security": [
  4171. {
  4172. "bearerAuth": []
  4173. }
  4174. ],
  4175. "requestBody": {
  4176. "required": false,
  4177. "content": {
  4178. "application/json": {
  4179. "schema": {
  4180. "$ref": "#/components/schemas/ExportRequest"
  4181. }
  4182. }
  4183. }
  4184. },
  4185. "responses": {
  4186. "200": {
  4187. "description": "The export document",
  4188. "content": {
  4189. "application/json": {
  4190. "schema": {
  4191. "$ref": "#/components/schemas/Export"
  4192. }
  4193. }
  4194. }
  4195. },
  4196. "400": {
  4197. "description": "Invalid JSON",
  4198. "content": {
  4199. "application/json": {
  4200. "schema": {
  4201. "$ref": "#/components/schemas/Error"
  4202. }
  4203. }
  4204. }
  4205. },
  4206. "401": {
  4207. "description": "Missing, invalid, revoked or expired API key",
  4208. "content": {
  4209. "application/json": {
  4210. "schema": {
  4211. "$ref": "#/components/schemas/Error"
  4212. }
  4213. }
  4214. }
  4215. },
  4216. "422": {
  4217. "description": "Validation failed (namespace_ids is not an array of ids)",
  4218. "content": {
  4219. "application/json": {
  4220. "schema": {
  4221. "$ref": "#/components/schemas/Error"
  4222. }
  4223. }
  4224. }
  4225. },
  4226. "500": {
  4227. "description": "Internal error",
  4228. "content": {
  4229. "application/json": {
  4230. "schema": {
  4231. "$ref": "#/components/schemas/Error"
  4232. }
  4233. }
  4234. }
  4235. }
  4236. }
  4237. }
  4238. },
  4239. "/imports": {
  4240. "post": {
  4241. "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.",
  4242. "tags": [
  4243. "portability"
  4244. ],
  4245. "security": [
  4246. {
  4247. "bearerAuth": []
  4248. }
  4249. ],
  4250. "requestBody": {
  4251. "required": true,
  4252. "content": {
  4253. "application/json": {
  4254. "schema": {
  4255. "$ref": "#/components/schemas/Export"
  4256. }
  4257. }
  4258. }
  4259. },
  4260. "responses": {
  4261. "201": {
  4262. "description": "Imported",
  4263. "content": {
  4264. "application/json": {
  4265. "schema": {
  4266. "$ref": "#/components/schemas/ImportResult"
  4267. }
  4268. }
  4269. }
  4270. },
  4271. "400": {
  4272. "description": "Empty body or invalid JSON",
  4273. "content": {
  4274. "application/json": {
  4275. "schema": {
  4276. "$ref": "#/components/schemas/Error"
  4277. }
  4278. }
  4279. }
  4280. },
  4281. "401": {
  4282. "description": "Missing, invalid, revoked or expired API key",
  4283. "content": {
  4284. "application/json": {
  4285. "schema": {
  4286. "$ref": "#/components/schemas/Error"
  4287. }
  4288. }
  4289. }
  4290. },
  4291. "409": {
  4292. "description": "import_conflict: an id in the document already exists; nothing was imported",
  4293. "content": {
  4294. "application/json": {
  4295. "schema": {
  4296. "$ref": "#/components/schemas/Error"
  4297. }
  4298. }
  4299. }
  4300. },
  4301. "413": {
  4302. "description": "body_too_large: more than 8 MiB",
  4303. "content": {
  4304. "application/json": {
  4305. "schema": {
  4306. "$ref": "#/components/schemas/Error"
  4307. }
  4308. }
  4309. }
  4310. },
  4311. "422": {
  4312. "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",
  4313. "content": {
  4314. "application/json": {
  4315. "schema": {
  4316. "$ref": "#/components/schemas/Error"
  4317. }
  4318. }
  4319. }
  4320. },
  4321. "500": {
  4322. "description": "Internal error; nothing was imported",
  4323. "content": {
  4324. "application/json": {
  4325. "schema": {
  4326. "$ref": "#/components/schemas/Error"
  4327. }
  4328. }
  4329. }
  4330. }
  4331. }
  4332. }
  4333. },
  4334. "/me": {
  4335. "get": {
  4336. "summary": "The caller: principal, tenant and its grants.",
  4337. "security": [
  4338. {
  4339. "bearerAuth": []
  4340. }
  4341. ],
  4342. "responses": {
  4343. "200": {
  4344. "description": "Caller",
  4345. "content": {
  4346. "application/json": {
  4347. "schema": {
  4348. "$ref": "#/components/schemas/Me"
  4349. }
  4350. }
  4351. }
  4352. },
  4353. "401": {
  4354. "description": "Missing, invalid, revoked or expired API key",
  4355. "content": {
  4356. "application/json": {
  4357. "schema": {
  4358. "$ref": "#/components/schemas/Error"
  4359. }
  4360. }
  4361. }
  4362. }
  4363. }
  4364. }
  4365. },
  4366. "/namespaces": {
  4367. "get": {
  4368. "summary": "Namespaces the caller can read, with the caller's effective permissions on each.",
  4369. "security": [
  4370. {
  4371. "bearerAuth": []
  4372. }
  4373. ],
  4374. "responses": {
  4375. "200": {
  4376. "description": "Namespaces",
  4377. "content": {
  4378. "application/json": {
  4379. "schema": {
  4380. "type": "object",
  4381. "properties": {
  4382. "data": {
  4383. "type": "array",
  4384. "items": {
  4385. "$ref": "#/components/schemas/Namespace"
  4386. }
  4387. }
  4388. }
  4389. }
  4390. }
  4391. }
  4392. },
  4393. "401": {
  4394. "description": "Missing, invalid, revoked or expired API key",
  4395. "content": {
  4396. "application/json": {
  4397. "schema": {
  4398. "$ref": "#/components/schemas/Error"
  4399. }
  4400. }
  4401. }
  4402. }
  4403. }
  4404. },
  4405. "post": {
  4406. "summary": "Create a namespace (and missing parents). Needs an inheriting admin grant covering the new path; top-level namespaces are created with the CLI.",
  4407. "security": [
  4408. {
  4409. "bearerAuth": []
  4410. }
  4411. ],
  4412. "requestBody": {
  4413. "required": true,
  4414. "content": {
  4415. "application/json": {
  4416. "schema": {
  4417. "$ref": "#/components/schemas/NamespaceRequest"
  4418. }
  4419. }
  4420. }
  4421. },
  4422. "responses": {
  4423. "201": {
  4424. "description": "Created",
  4425. "content": {
  4426. "application/json": {
  4427. "schema": {
  4428. "$ref": "#/components/schemas/NamespaceCreated"
  4429. }
  4430. }
  4431. }
  4432. },
  4433. "400": {
  4434. "description": "Body is not valid JSON",
  4435. "content": {
  4436. "application/json": {
  4437. "schema": {
  4438. "$ref": "#/components/schemas/Error"
  4439. }
  4440. }
  4441. }
  4442. },
  4443. "401": {
  4444. "description": "Missing, invalid, revoked or expired API key",
  4445. "content": {
  4446. "application/json": {
  4447. "schema": {
  4448. "$ref": "#/components/schemas/Error"
  4449. }
  4450. }
  4451. }
  4452. },
  4453. "404": {
  4454. "description": "No inheriting admin grant covers the path",
  4455. "content": {
  4456. "application/json": {
  4457. "schema": {
  4458. "$ref": "#/components/schemas/Error"
  4459. }
  4460. }
  4461. }
  4462. },
  4463. "409": {
  4464. "description": "namespace_exists",
  4465. "content": {
  4466. "application/json": {
  4467. "schema": {
  4468. "$ref": "#/components/schemas/Error"
  4469. }
  4470. }
  4471. }
  4472. },
  4473. "422": {
  4474. "description": "Validation failed",
  4475. "content": {
  4476. "application/json": {
  4477. "schema": {
  4478. "$ref": "#/components/schemas/Error"
  4479. }
  4480. }
  4481. }
  4482. },
  4483. "500": {
  4484. "description": "Internal error",
  4485. "content": {
  4486. "application/json": {
  4487. "schema": {
  4488. "$ref": "#/components/schemas/Error"
  4489. }
  4490. }
  4491. }
  4492. }
  4493. }
  4494. }
  4495. },
  4496. "/principals": {
  4497. "get": {
  4498. "summary": "Principals of the caller's tenant. Needs admin on at least one namespace.",
  4499. "security": [
  4500. {
  4501. "bearerAuth": []
  4502. }
  4503. ],
  4504. "responses": {
  4505. "200": {
  4506. "description": "Principals",
  4507. "content": {
  4508. "application/json": {
  4509. "schema": {
  4510. "type": "object",
  4511. "properties": {
  4512. "data": {
  4513. "type": "array",
  4514. "items": {
  4515. "$ref": "#/components/schemas/Principal"
  4516. }
  4517. }
  4518. }
  4519. }
  4520. }
  4521. }
  4522. },
  4523. "401": {
  4524. "description": "Missing, invalid, revoked or expired API key",
  4525. "content": {
  4526. "application/json": {
  4527. "schema": {
  4528. "$ref": "#/components/schemas/Error"
  4529. }
  4530. }
  4531. }
  4532. },
  4533. "404": {
  4534. "description": "Caller is not an admin anywhere",
  4535. "content": {
  4536. "application/json": {
  4537. "schema": {
  4538. "$ref": "#/components/schemas/Error"
  4539. }
  4540. }
  4541. }
  4542. }
  4543. }
  4544. },
  4545. "post": {
  4546. "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.",
  4547. "security": [
  4548. {
  4549. "bearerAuth": []
  4550. }
  4551. ],
  4552. "requestBody": {
  4553. "required": true,
  4554. "content": {
  4555. "application/json": {
  4556. "schema": {
  4557. "$ref": "#/components/schemas/PrincipalRequest"
  4558. }
  4559. }
  4560. }
  4561. },
  4562. "responses": {
  4563. "201": {
  4564. "description": "Created",
  4565. "content": {
  4566. "application/json": {
  4567. "schema": {
  4568. "$ref": "#/components/schemas/PrincipalCreated"
  4569. }
  4570. }
  4571. }
  4572. },
  4573. "400": {
  4574. "description": "Body is not valid JSON",
  4575. "content": {
  4576. "application/json": {
  4577. "schema": {
  4578. "$ref": "#/components/schemas/Error"
  4579. }
  4580. }
  4581. }
  4582. },
  4583. "401": {
  4584. "description": "Missing, invalid, revoked or expired API key",
  4585. "content": {
  4586. "application/json": {
  4587. "schema": {
  4588. "$ref": "#/components/schemas/Error"
  4589. }
  4590. }
  4591. }
  4592. },
  4593. "404": {
  4594. "description": "Caller is not an admin anywhere",
  4595. "content": {
  4596. "application/json": {
  4597. "schema": {
  4598. "$ref": "#/components/schemas/Error"
  4599. }
  4600. }
  4601. }
  4602. },
  4603. "422": {
  4604. "description": "Validation failed",
  4605. "content": {
  4606. "application/json": {
  4607. "schema": {
  4608. "$ref": "#/components/schemas/Error"
  4609. }
  4610. }
  4611. }
  4612. },
  4613. "500": {
  4614. "description": "Internal error",
  4615. "content": {
  4616. "application/json": {
  4617. "schema": {
  4618. "$ref": "#/components/schemas/Error"
  4619. }
  4620. }
  4621. }
  4622. }
  4623. }
  4624. }
  4625. },
  4626. "/principals/{id}": {
  4627. "get": {
  4628. "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).",
  4629. "security": [
  4630. {
  4631. "bearerAuth": []
  4632. }
  4633. ],
  4634. "parameters": [
  4635. {
  4636. "name": "id",
  4637. "in": "path",
  4638. "required": true,
  4639. "schema": {
  4640. "type": "string",
  4641. "format": "uuid"
  4642. }
  4643. }
  4644. ],
  4645. "responses": {
  4646. "200": {
  4647. "description": "Principal",
  4648. "content": {
  4649. "application/json": {
  4650. "schema": {
  4651. "$ref": "#/components/schemas/PrincipalDetail"
  4652. }
  4653. }
  4654. }
  4655. },
  4656. "401": {
  4657. "description": "Missing, invalid, revoked or expired API key",
  4658. "content": {
  4659. "application/json": {
  4660. "schema": {
  4661. "$ref": "#/components/schemas/Error"
  4662. }
  4663. }
  4664. }
  4665. },
  4666. "404": {
  4667. "description": "Not found, or the caller is not an admin and not this principal",
  4668. "content": {
  4669. "application/json": {
  4670. "schema": {
  4671. "$ref": "#/components/schemas/Error"
  4672. }
  4673. }
  4674. }
  4675. }
  4676. }
  4677. },
  4678. "patch": {
  4679. "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.",
  4680. "security": [
  4681. {
  4682. "bearerAuth": []
  4683. }
  4684. ],
  4685. "parameters": [
  4686. {
  4687. "name": "id",
  4688. "in": "path",
  4689. "required": true,
  4690. "schema": {
  4691. "type": "string",
  4692. "format": "uuid"
  4693. }
  4694. }
  4695. ],
  4696. "requestBody": {
  4697. "required": true,
  4698. "content": {
  4699. "application/json": {
  4700. "schema": {
  4701. "$ref": "#/components/schemas/PrincipalUpdate"
  4702. }
  4703. }
  4704. }
  4705. },
  4706. "responses": {
  4707. "200": {
  4708. "description": "Updated",
  4709. "content": {
  4710. "application/json": {
  4711. "schema": {
  4712. "$ref": "#/components/schemas/Principal"
  4713. }
  4714. }
  4715. }
  4716. },
  4717. "400": {
  4718. "description": "Body is not valid JSON",
  4719. "content": {
  4720. "application/json": {
  4721. "schema": {
  4722. "$ref": "#/components/schemas/Error"
  4723. }
  4724. }
  4725. }
  4726. },
  4727. "401": {
  4728. "description": "Missing, invalid, revoked or expired API key",
  4729. "content": {
  4730. "application/json": {
  4731. "schema": {
  4732. "$ref": "#/components/schemas/Error"
  4733. }
  4734. }
  4735. }
  4736. },
  4737. "404": {
  4738. "description": "Not found or not manageable by the caller",
  4739. "content": {
  4740. "application/json": {
  4741. "schema": {
  4742. "$ref": "#/components/schemas/Error"
  4743. }
  4744. }
  4745. }
  4746. },
  4747. "422": {
  4748. "description": "Validation failed, or cannot_change_self",
  4749. "content": {
  4750. "application/json": {
  4751. "schema": {
  4752. "$ref": "#/components/schemas/Error"
  4753. }
  4754. }
  4755. }
  4756. },
  4757. "500": {
  4758. "description": "Internal error",
  4759. "content": {
  4760. "application/json": {
  4761. "schema": {
  4762. "$ref": "#/components/schemas/Error"
  4763. }
  4764. }
  4765. }
  4766. }
  4767. }
  4768. }
  4769. },
  4770. "/principals/{id}/keys": {
  4771. "post": {
  4772. "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.",
  4773. "security": [
  4774. {
  4775. "bearerAuth": []
  4776. }
  4777. ],
  4778. "parameters": [
  4779. {
  4780. "name": "id",
  4781. "in": "path",
  4782. "required": true,
  4783. "schema": {
  4784. "type": "string",
  4785. "format": "uuid"
  4786. }
  4787. }
  4788. ],
  4789. "responses": {
  4790. "201": {
  4791. "description": "Created",
  4792. "content": {
  4793. "application/json": {
  4794. "schema": {
  4795. "$ref": "#/components/schemas/KeyCreated"
  4796. }
  4797. }
  4798. }
  4799. },
  4800. "401": {
  4801. "description": "Missing, invalid, revoked or expired API key",
  4802. "content": {
  4803. "application/json": {
  4804. "schema": {
  4805. "$ref": "#/components/schemas/Error"
  4806. }
  4807. }
  4808. }
  4809. },
  4810. "404": {
  4811. "description": "Not found or not manageable by the caller",
  4812. "content": {
  4813. "application/json": {
  4814. "schema": {
  4815. "$ref": "#/components/schemas/Error"
  4816. }
  4817. }
  4818. }
  4819. },
  4820. "409": {
  4821. "description": "principal_not_active",
  4822. "content": {
  4823. "application/json": {
  4824. "schema": {
  4825. "$ref": "#/components/schemas/Error"
  4826. }
  4827. }
  4828. }
  4829. },
  4830. "500": {
  4831. "description": "Internal error",
  4832. "content": {
  4833. "application/json": {
  4834. "schema": {
  4835. "$ref": "#/components/schemas/Error"
  4836. }
  4837. }
  4838. }
  4839. }
  4840. }
  4841. }
  4842. },
  4843. "/keys/{id}": {
  4844. "delete": {
  4845. "summary": "Revoke an API key (idempotent). Same rule as issuing keys.",
  4846. "security": [
  4847. {
  4848. "bearerAuth": []
  4849. }
  4850. ],
  4851. "parameters": [
  4852. {
  4853. "name": "id",
  4854. "in": "path",
  4855. "required": true,
  4856. "schema": {
  4857. "type": "string",
  4858. "format": "uuid"
  4859. }
  4860. }
  4861. ],
  4862. "responses": {
  4863. "200": {
  4864. "description": "Revoked",
  4865. "content": {
  4866. "application/json": {
  4867. "schema": {
  4868. "type": "object",
  4869. "properties": {
  4870. "id": {
  4871. "type": "string"
  4872. },
  4873. "principal_id": {
  4874. "type": "string"
  4875. },
  4876. "status": {
  4877. "type": "string",
  4878. "enum": [
  4879. "revoked"
  4880. ]
  4881. }
  4882. }
  4883. }
  4884. }
  4885. }
  4886. },
  4887. "401": {
  4888. "description": "Missing, invalid, revoked or expired API key",
  4889. "content": {
  4890. "application/json": {
  4891. "schema": {
  4892. "$ref": "#/components/schemas/Error"
  4893. }
  4894. }
  4895. }
  4896. },
  4897. "404": {
  4898. "description": "Not found or not manageable by the caller",
  4899. "content": {
  4900. "application/json": {
  4901. "schema": {
  4902. "$ref": "#/components/schemas/Error"
  4903. }
  4904. }
  4905. }
  4906. },
  4907. "500": {
  4908. "description": "Internal error",
  4909. "content": {
  4910. "application/json": {
  4911. "schema": {
  4912. "$ref": "#/components/schemas/Error"
  4913. }
  4914. }
  4915. }
  4916. }
  4917. }
  4918. }
  4919. },
  4920. "/grants": {
  4921. "get": {
  4922. "summary": "Grants on namespaces the caller administers.",
  4923. "security": [
  4924. {
  4925. "bearerAuth": []
  4926. }
  4927. ],
  4928. "parameters": [
  4929. {
  4930. "name": "namespace_id",
  4931. "in": "query",
  4932. "schema": {
  4933. "type": "string",
  4934. "format": "uuid"
  4935. }
  4936. },
  4937. {
  4938. "name": "principal_id",
  4939. "in": "query",
  4940. "schema": {
  4941. "type": "string",
  4942. "format": "uuid"
  4943. }
  4944. }
  4945. ],
  4946. "responses": {
  4947. "200": {
  4948. "description": "Grants",
  4949. "content": {
  4950. "application/json": {
  4951. "schema": {
  4952. "type": "object",
  4953. "properties": {
  4954. "data": {
  4955. "type": "array",
  4956. "items": {
  4957. "$ref": "#/components/schemas/Grant"
  4958. }
  4959. }
  4960. }
  4961. }
  4962. }
  4963. }
  4964. },
  4965. "401": {
  4966. "description": "Missing, invalid, revoked or expired API key",
  4967. "content": {
  4968. "application/json": {
  4969. "schema": {
  4970. "$ref": "#/components/schemas/Error"
  4971. }
  4972. }
  4973. }
  4974. },
  4975. "404": {
  4976. "description": "Caller is not an admin anywhere",
  4977. "content": {
  4978. "application/json": {
  4979. "schema": {
  4980. "$ref": "#/components/schemas/Error"
  4981. }
  4982. }
  4983. }
  4984. },
  4985. "422": {
  4986. "description": "Validation failed",
  4987. "content": {
  4988. "application/json": {
  4989. "schema": {
  4990. "$ref": "#/components/schemas/Error"
  4991. }
  4992. }
  4993. }
  4994. }
  4995. }
  4996. },
  4997. "post": {
  4998. "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.",
  4999. "security": [
  5000. {
  5001. "bearerAuth": []
  5002. }
  5003. ],
  5004. "requestBody": {
  5005. "required": true,
  5006. "content": {
  5007. "application/json": {
  5008. "schema": {
  5009. "$ref": "#/components/schemas/GrantRequest"
  5010. }
  5011. }
  5012. }
  5013. },
  5014. "responses": {
  5015. "201": {
  5016. "description": "Created",
  5017. "content": {
  5018. "application/json": {
  5019. "schema": {
  5020. "$ref": "#/components/schemas/Grant"
  5021. }
  5022. }
  5023. }
  5024. },
  5025. "400": {
  5026. "description": "Body is not valid JSON",
  5027. "content": {
  5028. "application/json": {
  5029. "schema": {
  5030. "$ref": "#/components/schemas/Error"
  5031. }
  5032. }
  5033. }
  5034. },
  5035. "401": {
  5036. "description": "Missing, invalid, revoked or expired API key",
  5037. "content": {
  5038. "application/json": {
  5039. "schema": {
  5040. "$ref": "#/components/schemas/Error"
  5041. }
  5042. }
  5043. }
  5044. },
  5045. "404": {
  5046. "description": "Namespace not found or caller lacks admin on it",
  5047. "content": {
  5048. "application/json": {
  5049. "schema": {
  5050. "$ref": "#/components/schemas/Error"
  5051. }
  5052. }
  5053. }
  5054. },
  5055. "409": {
  5056. "description": "grant_exists",
  5057. "content": {
  5058. "application/json": {
  5059. "schema": {
  5060. "$ref": "#/components/schemas/Error"
  5061. }
  5062. }
  5063. }
  5064. },
  5065. "422": {
  5066. "description": "Validation failed, principal_not_found or inherit_not_allowed",
  5067. "content": {
  5068. "application/json": {
  5069. "schema": {
  5070. "$ref": "#/components/schemas/Error"
  5071. }
  5072. }
  5073. }
  5074. },
  5075. "500": {
  5076. "description": "Internal error",
  5077. "content": {
  5078. "application/json": {
  5079. "schema": {
  5080. "$ref": "#/components/schemas/Error"
  5081. }
  5082. }
  5083. }
  5084. }
  5085. }
  5086. }
  5087. },
  5088. "/grants/{id}": {
  5089. "delete": {
  5090. "summary": "Remove a grant. Needs admin on its namespace; a principal cannot remove its own grants.",
  5091. "security": [
  5092. {
  5093. "bearerAuth": []
  5094. }
  5095. ],
  5096. "parameters": [
  5097. {
  5098. "name": "id",
  5099. "in": "path",
  5100. "required": true,
  5101. "schema": {
  5102. "type": "string",
  5103. "format": "uuid"
  5104. }
  5105. }
  5106. ],
  5107. "responses": {
  5108. "200": {
  5109. "description": "Deleted",
  5110. "content": {
  5111. "application/json": {
  5112. "schema": {
  5113. "type": "object",
  5114. "properties": {
  5115. "id": {
  5116. "type": "string"
  5117. },
  5118. "deleted": {
  5119. "type": "boolean"
  5120. }
  5121. }
  5122. }
  5123. }
  5124. }
  5125. },
  5126. "401": {
  5127. "description": "Missing, invalid, revoked or expired API key",
  5128. "content": {
  5129. "application/json": {
  5130. "schema": {
  5131. "$ref": "#/components/schemas/Error"
  5132. }
  5133. }
  5134. }
  5135. },
  5136. "404": {
  5137. "description": "Not found or caller lacks admin on its namespace",
  5138. "content": {
  5139. "application/json": {
  5140. "schema": {
  5141. "$ref": "#/components/schemas/Error"
  5142. }
  5143. }
  5144. }
  5145. },
  5146. "422": {
  5147. "description": "cannot_change_self",
  5148. "content": {
  5149. "application/json": {
  5150. "schema": {
  5151. "$ref": "#/components/schemas/Error"
  5152. }
  5153. }
  5154. }
  5155. },
  5156. "500": {
  5157. "description": "Internal error",
  5158. "content": {
  5159. "application/json": {
  5160. "schema": {
  5161. "$ref": "#/components/schemas/Error"
  5162. }
  5163. }
  5164. }
  5165. }
  5166. }
  5167. }
  5168. }
  5169. }
  5170. }

Powered by TurnKey Linux.