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

1959 行
49KB

  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "Agent Memory API",
  5. "version": "1.0.0-phase2",
  6. "description": "Universal AI Agent Memory platform, phases 1-2: 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."
  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. }
  250. },
  251. "IngestResponse": {
  252. "type": "object",
  253. "properties": {
  254. "job": {
  255. "type": "object",
  256. "properties": {
  257. "id": {
  258. "type": "string"
  259. },
  260. "type": {
  261. "type": "string"
  262. },
  263. "state": {
  264. "type": "string"
  265. }
  266. }
  267. },
  268. "document_id": {
  269. "type": "string"
  270. },
  271. "revision": {
  272. "type": "integer"
  273. },
  274. "chunk_count": {
  275. "type": "integer"
  276. },
  277. "unchanged": {
  278. "type": "boolean",
  279. "description": "true when identical text was already the current revision (no new chunks)"
  280. },
  281. "indexing_status": {
  282. "type": "string",
  283. "example": "lexical_indexed"
  284. }
  285. }
  286. },
  287. "SearchRequest": {
  288. "type": "object",
  289. "required": [
  290. "query"
  291. ],
  292. "properties": {
  293. "query": {
  294. "type": "string",
  295. "maxLength": 1000
  296. },
  297. "namespace_ids": {
  298. "type": "array",
  299. "items": {
  300. "type": "string",
  301. "format": "uuid"
  302. }
  303. },
  304. "max_results": {
  305. "type": "integer",
  306. "minimum": 1,
  307. "maximum": 50
  308. },
  309. "detail_level": {
  310. "type": "string",
  311. "enum": [
  312. "full",
  313. "snippet"
  314. ]
  315. }
  316. }
  317. },
  318. "RecallRequest": {
  319. "type": "object",
  320. "required": [
  321. "query"
  322. ],
  323. "properties": {
  324. "query": {
  325. "type": "string",
  326. "maxLength": 1000
  327. },
  328. "namespace_ids": {
  329. "type": "array",
  330. "items": {
  331. "type": "string",
  332. "format": "uuid"
  333. }
  334. },
  335. "types": {
  336. "type": "array",
  337. "items": {
  338. "type": "string"
  339. }
  340. },
  341. "tags": {
  342. "type": "array",
  343. "items": {
  344. "type": "string"
  345. }
  346. },
  347. "max_results": {
  348. "type": "integer"
  349. },
  350. "detail_level": {
  351. "type": "string",
  352. "enum": [
  353. "full",
  354. "summary"
  355. ]
  356. },
  357. "verification_filter": {
  358. "type": "string",
  359. "enum": [
  360. "verified_only",
  361. "include_unverified"
  362. ],
  363. "default": "verified_only"
  364. }
  365. }
  366. },
  367. "VerifyRequest": {
  368. "type": "object",
  369. "required": [
  370. "result",
  371. "method",
  372. "revision"
  373. ],
  374. "properties": {
  375. "result": {
  376. "type": "string",
  377. "enum": [
  378. "verified",
  379. "disputed",
  380. "rejected"
  381. ]
  382. },
  383. "method": {
  384. "type": "string",
  385. "maxLength": 200
  386. },
  387. "notes": {
  388. "type": "string",
  389. "maxLength": 2000
  390. },
  391. "revision": {
  392. "type": "integer",
  393. "description": "Must be the current revision"
  394. }
  395. }
  396. },
  397. "SaveStateRequest": {
  398. "type": "object",
  399. "required": [
  400. "state"
  401. ],
  402. "properties": {
  403. "state": {
  404. "type": "object",
  405. "description": "Structured working state, max 64 KB"
  406. },
  407. "expected_revision": {
  408. "type": "integer"
  409. }
  410. }
  411. }
  412. }
  413. },
  414. "paths": {
  415. "/remember": {
  416. "post": {
  417. "summary": "Create a memory",
  418. "security": [
  419. {
  420. "bearerAuth": []
  421. }
  422. ],
  423. "parameters": [
  424. {
  425. "name": "Idempotency-Key",
  426. "in": "header",
  427. "required": false,
  428. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  429. "schema": {
  430. "type": "string",
  431. "maxLength": 200
  432. }
  433. }
  434. ],
  435. "requestBody": {
  436. "required": true,
  437. "content": {
  438. "application/json": {
  439. "schema": {
  440. "$ref": "#/components/schemas/RememberRequest"
  441. }
  442. }
  443. }
  444. },
  445. "responses": {
  446. "201": {
  447. "description": "Created",
  448. "content": {
  449. "application/json": {
  450. "schema": {
  451. "$ref": "#/components/schemas/RememberResponse"
  452. }
  453. }
  454. }
  455. },
  456. "200": {
  457. "description": "Exact duplicate (or idempotent replay of a 200)",
  458. "content": {
  459. "application/json": {
  460. "schema": {
  461. "$ref": "#/components/schemas/RememberResponse"
  462. }
  463. }
  464. }
  465. },
  466. "400": {
  467. "description": "Invalid JSON / body",
  468. "content": {
  469. "application/json": {
  470. "schema": {
  471. "$ref": "#/components/schemas/Error"
  472. }
  473. }
  474. }
  475. },
  476. "409": {
  477. "description": "Idempotency-Key reused with a different body",
  478. "content": {
  479. "application/json": {
  480. "schema": {
  481. "$ref": "#/components/schemas/Error"
  482. }
  483. }
  484. }
  485. },
  486. "422": {
  487. "description": "Validation failed",
  488. "content": {
  489. "application/json": {
  490. "schema": {
  491. "$ref": "#/components/schemas/Error"
  492. }
  493. }
  494. }
  495. },
  496. "401": {
  497. "description": "Missing, invalid, revoked or expired API key",
  498. "content": {
  499. "application/json": {
  500. "schema": {
  501. "$ref": "#/components/schemas/Error"
  502. }
  503. }
  504. }
  505. },
  506. "404": {
  507. "description": "Not found or not visible to the caller",
  508. "content": {
  509. "application/json": {
  510. "schema": {
  511. "$ref": "#/components/schemas/Error"
  512. }
  513. }
  514. }
  515. },
  516. "500": {
  517. "description": "Internal error",
  518. "content": {
  519. "application/json": {
  520. "schema": {
  521. "$ref": "#/components/schemas/Error"
  522. }
  523. }
  524. }
  525. }
  526. }
  527. }
  528. },
  529. "/memories": {
  530. "get": {
  531. "summary": "List memories (newest first)",
  532. "security": [
  533. {
  534. "bearerAuth": []
  535. }
  536. ],
  537. "parameters": [
  538. {
  539. "name": "namespace_id",
  540. "in": "query",
  541. "schema": {
  542. "type": "string",
  543. "format": "uuid"
  544. }
  545. },
  546. {
  547. "name": "type",
  548. "in": "query",
  549. "schema": {
  550. "type": "string"
  551. }
  552. },
  553. {
  554. "name": "status",
  555. "in": "query",
  556. "schema": {
  557. "type": "string",
  558. "enum": [
  559. "active",
  560. "retired",
  561. "superseded",
  562. "all"
  563. ],
  564. "default": "active"
  565. }
  566. },
  567. {
  568. "name": "verification_status",
  569. "in": "query",
  570. "schema": {
  571. "type": "string",
  572. "enum": [
  573. "unverified",
  574. "verified",
  575. "disputed",
  576. "rejected"
  577. ]
  578. }
  579. },
  580. {
  581. "name": "limit",
  582. "in": "query",
  583. "schema": {
  584. "type": "integer",
  585. "minimum": 1,
  586. "maximum": 100,
  587. "default": 20
  588. }
  589. },
  590. {
  591. "name": "cursor",
  592. "in": "query",
  593. "description": "next_cursor from the previous page",
  594. "schema": {
  595. "type": "string"
  596. }
  597. }
  598. ],
  599. "responses": {
  600. "200": {
  601. "description": "Page of memories",
  602. "content": {
  603. "application/json": {
  604. "schema": {
  605. "type": "object",
  606. "properties": {
  607. "data": {
  608. "type": "array",
  609. "items": {
  610. "$ref": "#/components/schemas/Memory"
  611. }
  612. },
  613. "next_cursor": {
  614. "type": "string",
  615. "nullable": true
  616. }
  617. }
  618. }
  619. }
  620. }
  621. },
  622. "400": {
  623. "description": "Invalid cursor",
  624. "content": {
  625. "application/json": {
  626. "schema": {
  627. "$ref": "#/components/schemas/Error"
  628. }
  629. }
  630. }
  631. },
  632. "422": {
  633. "description": "Invalid filter",
  634. "content": {
  635. "application/json": {
  636. "schema": {
  637. "$ref": "#/components/schemas/Error"
  638. }
  639. }
  640. }
  641. },
  642. "401": {
  643. "description": "Missing, invalid, revoked or expired API key",
  644. "content": {
  645. "application/json": {
  646. "schema": {
  647. "$ref": "#/components/schemas/Error"
  648. }
  649. }
  650. }
  651. },
  652. "404": {
  653. "description": "Not found or not visible to the caller",
  654. "content": {
  655. "application/json": {
  656. "schema": {
  657. "$ref": "#/components/schemas/Error"
  658. }
  659. }
  660. }
  661. },
  662. "500": {
  663. "description": "Internal error",
  664. "content": {
  665. "application/json": {
  666. "schema": {
  667. "$ref": "#/components/schemas/Error"
  668. }
  669. }
  670. }
  671. }
  672. }
  673. }
  674. },
  675. "/memories/{id}": {
  676. "get": {
  677. "summary": "Get a memory (optionally an older revision)",
  678. "security": [
  679. {
  680. "bearerAuth": []
  681. }
  682. ],
  683. "parameters": [
  684. {
  685. "name": "id",
  686. "in": "path",
  687. "required": true,
  688. "schema": {
  689. "type": "string",
  690. "format": "uuid"
  691. }
  692. },
  693. {
  694. "name": "revision",
  695. "in": "query",
  696. "schema": {
  697. "type": "integer"
  698. }
  699. }
  700. ],
  701. "responses": {
  702. "200": {
  703. "description": "The memory",
  704. "content": {
  705. "application/json": {
  706. "schema": {
  707. "type": "object",
  708. "properties": {
  709. "data": {
  710. "$ref": "#/components/schemas/Memory"
  711. }
  712. }
  713. }
  714. }
  715. }
  716. },
  717. "401": {
  718. "description": "Missing, invalid, revoked or expired API key",
  719. "content": {
  720. "application/json": {
  721. "schema": {
  722. "$ref": "#/components/schemas/Error"
  723. }
  724. }
  725. }
  726. },
  727. "404": {
  728. "description": "Not found or not visible to the caller",
  729. "content": {
  730. "application/json": {
  731. "schema": {
  732. "$ref": "#/components/schemas/Error"
  733. }
  734. }
  735. }
  736. },
  737. "500": {
  738. "description": "Internal error",
  739. "content": {
  740. "application/json": {
  741. "schema": {
  742. "$ref": "#/components/schemas/Error"
  743. }
  744. }
  745. }
  746. }
  747. }
  748. },
  749. "patch": {
  750. "summary": "Correct a memory: creates the next revision, unverified",
  751. "security": [
  752. {
  753. "bearerAuth": []
  754. }
  755. ],
  756. "parameters": [
  757. {
  758. "name": "id",
  759. "in": "path",
  760. "required": true,
  761. "schema": {
  762. "type": "string",
  763. "format": "uuid"
  764. }
  765. },
  766. {
  767. "name": "If-Match",
  768. "in": "header",
  769. "required": false,
  770. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  771. "schema": {
  772. "type": "string"
  773. }
  774. }
  775. ],
  776. "requestBody": {
  777. "required": true,
  778. "content": {
  779. "application/json": {
  780. "schema": {
  781. "type": "object",
  782. "properties": {
  783. "title": {
  784. "type": "string"
  785. },
  786. "summary": {
  787. "type": "string"
  788. },
  789. "content": {
  790. "type": "string"
  791. },
  792. "tags": {
  793. "type": "array",
  794. "items": {
  795. "type": "string"
  796. }
  797. },
  798. "attributes": {
  799. "type": "object"
  800. },
  801. "confidence": {
  802. "type": "number"
  803. },
  804. "importance": {
  805. "type": "number"
  806. },
  807. "change_reason": {
  808. "type": "string"
  809. },
  810. "expected_revision": {
  811. "type": "integer"
  812. }
  813. }
  814. }
  815. }
  816. }
  817. },
  818. "responses": {
  819. "200": {
  820. "description": "New revision",
  821. "content": {
  822. "application/json": {
  823. "schema": {
  824. "$ref": "#/components/schemas/RememberResponse"
  825. }
  826. }
  827. }
  828. },
  829. "400": {
  830. "description": "Bad body / revision",
  831. "content": {
  832. "application/json": {
  833. "schema": {
  834. "$ref": "#/components/schemas/Error"
  835. }
  836. }
  837. }
  838. },
  839. "409": {
  840. "description": "Memory is not active",
  841. "content": {
  842. "application/json": {
  843. "schema": {
  844. "$ref": "#/components/schemas/Error"
  845. }
  846. }
  847. }
  848. },
  849. "412": {
  850. "description": "Stale revision (ETag header carries the current one)",
  851. "content": {
  852. "application/json": {
  853. "schema": {
  854. "$ref": "#/components/schemas/Error"
  855. }
  856. }
  857. }
  858. },
  859. "422": {
  860. "description": "Validation failed",
  861. "content": {
  862. "application/json": {
  863. "schema": {
  864. "$ref": "#/components/schemas/Error"
  865. }
  866. }
  867. }
  868. },
  869. "428": {
  870. "description": "If-Match missing",
  871. "content": {
  872. "application/json": {
  873. "schema": {
  874. "$ref": "#/components/schemas/Error"
  875. }
  876. }
  877. }
  878. },
  879. "401": {
  880. "description": "Missing, invalid, revoked or expired API key",
  881. "content": {
  882. "application/json": {
  883. "schema": {
  884. "$ref": "#/components/schemas/Error"
  885. }
  886. }
  887. }
  888. },
  889. "404": {
  890. "description": "Not found or not visible to the caller",
  891. "content": {
  892. "application/json": {
  893. "schema": {
  894. "$ref": "#/components/schemas/Error"
  895. }
  896. }
  897. }
  898. },
  899. "500": {
  900. "description": "Internal error",
  901. "content": {
  902. "application/json": {
  903. "schema": {
  904. "$ref": "#/components/schemas/Error"
  905. }
  906. }
  907. }
  908. }
  909. }
  910. },
  911. "delete": {
  912. "summary": "Forget: permanently delete the memory and its revisions (needs delete permission)",
  913. "security": [
  914. {
  915. "bearerAuth": []
  916. }
  917. ],
  918. "parameters": [
  919. {
  920. "name": "id",
  921. "in": "path",
  922. "required": true,
  923. "schema": {
  924. "type": "string",
  925. "format": "uuid"
  926. }
  927. }
  928. ],
  929. "responses": {
  930. "200": {
  931. "description": "Deleted"
  932. },
  933. "401": {
  934. "description": "Missing, invalid, revoked or expired API key",
  935. "content": {
  936. "application/json": {
  937. "schema": {
  938. "$ref": "#/components/schemas/Error"
  939. }
  940. }
  941. }
  942. },
  943. "404": {
  944. "description": "Not found or not visible to the caller",
  945. "content": {
  946. "application/json": {
  947. "schema": {
  948. "$ref": "#/components/schemas/Error"
  949. }
  950. }
  951. }
  952. },
  953. "500": {
  954. "description": "Internal error",
  955. "content": {
  956. "application/json": {
  957. "schema": {
  958. "$ref": "#/components/schemas/Error"
  959. }
  960. }
  961. }
  962. }
  963. }
  964. }
  965. },
  966. "/memories/{id}/retire": {
  967. "post": {
  968. "summary": "Retire: exclude from ordinary listing",
  969. "security": [
  970. {
  971. "bearerAuth": []
  972. }
  973. ],
  974. "parameters": [
  975. {
  976. "name": "id",
  977. "in": "path",
  978. "required": true,
  979. "schema": {
  980. "type": "string",
  981. "format": "uuid"
  982. }
  983. }
  984. ],
  985. "responses": {
  986. "200": {
  987. "description": "Retired"
  988. },
  989. "401": {
  990. "description": "Missing, invalid, revoked or expired API key",
  991. "content": {
  992. "application/json": {
  993. "schema": {
  994. "$ref": "#/components/schemas/Error"
  995. }
  996. }
  997. }
  998. },
  999. "404": {
  1000. "description": "Not found or not visible to the caller",
  1001. "content": {
  1002. "application/json": {
  1003. "schema": {
  1004. "$ref": "#/components/schemas/Error"
  1005. }
  1006. }
  1007. }
  1008. },
  1009. "500": {
  1010. "description": "Internal error",
  1011. "content": {
  1012. "application/json": {
  1013. "schema": {
  1014. "$ref": "#/components/schemas/Error"
  1015. }
  1016. }
  1017. }
  1018. }
  1019. }
  1020. }
  1021. },
  1022. "/memories/{id}/versions": {
  1023. "get": {
  1024. "summary": "Revision history, newest first",
  1025. "security": [
  1026. {
  1027. "bearerAuth": []
  1028. }
  1029. ],
  1030. "parameters": [
  1031. {
  1032. "name": "id",
  1033. "in": "path",
  1034. "required": true,
  1035. "schema": {
  1036. "type": "string",
  1037. "format": "uuid"
  1038. }
  1039. }
  1040. ],
  1041. "responses": {
  1042. "200": {
  1043. "description": "Revisions"
  1044. },
  1045. "401": {
  1046. "description": "Missing, invalid, revoked or expired API key",
  1047. "content": {
  1048. "application/json": {
  1049. "schema": {
  1050. "$ref": "#/components/schemas/Error"
  1051. }
  1052. }
  1053. }
  1054. },
  1055. "404": {
  1056. "description": "Not found or not visible to the caller",
  1057. "content": {
  1058. "application/json": {
  1059. "schema": {
  1060. "$ref": "#/components/schemas/Error"
  1061. }
  1062. }
  1063. }
  1064. },
  1065. "500": {
  1066. "description": "Internal error",
  1067. "content": {
  1068. "application/json": {
  1069. "schema": {
  1070. "$ref": "#/components/schemas/Error"
  1071. }
  1072. }
  1073. }
  1074. }
  1075. }
  1076. }
  1077. },
  1078. "/sessions": {
  1079. "post": {
  1080. "summary": "Start a session",
  1081. "security": [
  1082. {
  1083. "bearerAuth": []
  1084. }
  1085. ],
  1086. "parameters": [
  1087. {
  1088. "name": "Idempotency-Key",
  1089. "in": "header",
  1090. "required": false,
  1091. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  1092. "schema": {
  1093. "type": "string",
  1094. "maxLength": 200
  1095. }
  1096. }
  1097. ],
  1098. "requestBody": {
  1099. "required": true,
  1100. "content": {
  1101. "application/json": {
  1102. "schema": {
  1103. "type": "object",
  1104. "required": [
  1105. "namespace_id",
  1106. "objective"
  1107. ],
  1108. "properties": {
  1109. "namespace_id": {
  1110. "type": "string",
  1111. "format": "uuid"
  1112. },
  1113. "objective": {
  1114. "type": "string",
  1115. "maxLength": 2000
  1116. }
  1117. }
  1118. }
  1119. }
  1120. }
  1121. },
  1122. "responses": {
  1123. "201": {
  1124. "description": "Started"
  1125. },
  1126. "422": {
  1127. "description": "Validation failed",
  1128. "content": {
  1129. "application/json": {
  1130. "schema": {
  1131. "$ref": "#/components/schemas/Error"
  1132. }
  1133. }
  1134. }
  1135. },
  1136. "409": {
  1137. "description": "Idempotency conflict",
  1138. "content": {
  1139. "application/json": {
  1140. "schema": {
  1141. "$ref": "#/components/schemas/Error"
  1142. }
  1143. }
  1144. }
  1145. },
  1146. "401": {
  1147. "description": "Missing, invalid, revoked or expired API key",
  1148. "content": {
  1149. "application/json": {
  1150. "schema": {
  1151. "$ref": "#/components/schemas/Error"
  1152. }
  1153. }
  1154. }
  1155. },
  1156. "404": {
  1157. "description": "Not found or not visible to the caller",
  1158. "content": {
  1159. "application/json": {
  1160. "schema": {
  1161. "$ref": "#/components/schemas/Error"
  1162. }
  1163. }
  1164. }
  1165. },
  1166. "500": {
  1167. "description": "Internal error",
  1168. "content": {
  1169. "application/json": {
  1170. "schema": {
  1171. "$ref": "#/components/schemas/Error"
  1172. }
  1173. }
  1174. }
  1175. }
  1176. }
  1177. }
  1178. },
  1179. "/sessions/{id}/state": {
  1180. "get": {
  1181. "summary": "Restore the latest checkpoint (revision 0 / state null when none)",
  1182. "security": [
  1183. {
  1184. "bearerAuth": []
  1185. }
  1186. ],
  1187. "parameters": [
  1188. {
  1189. "name": "id",
  1190. "in": "path",
  1191. "required": true,
  1192. "schema": {
  1193. "type": "string",
  1194. "format": "uuid"
  1195. }
  1196. }
  1197. ],
  1198. "responses": {
  1199. "200": {
  1200. "description": "Checkpoint; ETag = revision"
  1201. },
  1202. "401": {
  1203. "description": "Missing, invalid, revoked or expired API key",
  1204. "content": {
  1205. "application/json": {
  1206. "schema": {
  1207. "$ref": "#/components/schemas/Error"
  1208. }
  1209. }
  1210. }
  1211. },
  1212. "404": {
  1213. "description": "Not found or not visible to the caller",
  1214. "content": {
  1215. "application/json": {
  1216. "schema": {
  1217. "$ref": "#/components/schemas/Error"
  1218. }
  1219. }
  1220. }
  1221. },
  1222. "500": {
  1223. "description": "Internal error",
  1224. "content": {
  1225. "application/json": {
  1226. "schema": {
  1227. "$ref": "#/components/schemas/Error"
  1228. }
  1229. }
  1230. }
  1231. }
  1232. }
  1233. },
  1234. "put": {
  1235. "summary": "Save a checkpoint (If-Match = current checkpoint revision, 0 for the first)",
  1236. "security": [
  1237. {
  1238. "bearerAuth": []
  1239. }
  1240. ],
  1241. "parameters": [
  1242. {
  1243. "name": "id",
  1244. "in": "path",
  1245. "required": true,
  1246. "schema": {
  1247. "type": "string",
  1248. "format": "uuid"
  1249. }
  1250. },
  1251. {
  1252. "name": "If-Match",
  1253. "in": "header",
  1254. "required": false,
  1255. "description": "Current revision number (quoted ETag form accepted). Required unless expected_revision is in the body.",
  1256. "schema": {
  1257. "type": "string"
  1258. }
  1259. }
  1260. ],
  1261. "requestBody": {
  1262. "required": true,
  1263. "content": {
  1264. "application/json": {
  1265. "schema": {
  1266. "$ref": "#/components/schemas/SaveStateRequest"
  1267. }
  1268. }
  1269. }
  1270. },
  1271. "responses": {
  1272. "200": {
  1273. "description": "Saved; ETag = new revision"
  1274. },
  1275. "409": {
  1276. "description": "Session closed",
  1277. "content": {
  1278. "application/json": {
  1279. "schema": {
  1280. "$ref": "#/components/schemas/Error"
  1281. }
  1282. }
  1283. }
  1284. },
  1285. "412": {
  1286. "description": "Stale revision",
  1287. "content": {
  1288. "application/json": {
  1289. "schema": {
  1290. "$ref": "#/components/schemas/Error"
  1291. }
  1292. }
  1293. }
  1294. },
  1295. "422": {
  1296. "description": "Validation failed",
  1297. "content": {
  1298. "application/json": {
  1299. "schema": {
  1300. "$ref": "#/components/schemas/Error"
  1301. }
  1302. }
  1303. }
  1304. },
  1305. "428": {
  1306. "description": "If-Match missing",
  1307. "content": {
  1308. "application/json": {
  1309. "schema": {
  1310. "$ref": "#/components/schemas/Error"
  1311. }
  1312. }
  1313. }
  1314. },
  1315. "401": {
  1316. "description": "Missing, invalid, revoked or expired API key",
  1317. "content": {
  1318. "application/json": {
  1319. "schema": {
  1320. "$ref": "#/components/schemas/Error"
  1321. }
  1322. }
  1323. }
  1324. },
  1325. "404": {
  1326. "description": "Not found or not visible to the caller",
  1327. "content": {
  1328. "application/json": {
  1329. "schema": {
  1330. "$ref": "#/components/schemas/Error"
  1331. }
  1332. }
  1333. }
  1334. },
  1335. "500": {
  1336. "description": "Internal error",
  1337. "content": {
  1338. "application/json": {
  1339. "schema": {
  1340. "$ref": "#/components/schemas/Error"
  1341. }
  1342. }
  1343. }
  1344. }
  1345. }
  1346. }
  1347. },
  1348. "/sessions/{id}/complete": {
  1349. "post": {
  1350. "summary": "Complete a session",
  1351. "security": [
  1352. {
  1353. "bearerAuth": []
  1354. }
  1355. ],
  1356. "parameters": [
  1357. {
  1358. "name": "id",
  1359. "in": "path",
  1360. "required": true,
  1361. "schema": {
  1362. "type": "string",
  1363. "format": "uuid"
  1364. }
  1365. }
  1366. ],
  1367. "requestBody": {
  1368. "required": false,
  1369. "content": {
  1370. "application/json": {
  1371. "schema": {
  1372. "type": "object",
  1373. "properties": {
  1374. "outcome": {
  1375. "type": "string",
  1376. "maxLength": 4000
  1377. }
  1378. }
  1379. }
  1380. }
  1381. }
  1382. },
  1383. "responses": {
  1384. "200": {
  1385. "description": "Completed"
  1386. },
  1387. "409": {
  1388. "description": "Already closed",
  1389. "content": {
  1390. "application/json": {
  1391. "schema": {
  1392. "$ref": "#/components/schemas/Error"
  1393. }
  1394. }
  1395. }
  1396. },
  1397. "401": {
  1398. "description": "Missing, invalid, revoked or expired API key",
  1399. "content": {
  1400. "application/json": {
  1401. "schema": {
  1402. "$ref": "#/components/schemas/Error"
  1403. }
  1404. }
  1405. }
  1406. },
  1407. "404": {
  1408. "description": "Not found or not visible to the caller",
  1409. "content": {
  1410. "application/json": {
  1411. "schema": {
  1412. "$ref": "#/components/schemas/Error"
  1413. }
  1414. }
  1415. }
  1416. },
  1417. "500": {
  1418. "description": "Internal error",
  1419. "content": {
  1420. "application/json": {
  1421. "schema": {
  1422. "$ref": "#/components/schemas/Error"
  1423. }
  1424. }
  1425. }
  1426. }
  1427. }
  1428. }
  1429. },
  1430. "/memories/{id}/verifications": {
  1431. "post": {
  1432. "summary": "Record a verification of the current revision (needs the verify permission)",
  1433. "security": [
  1434. {
  1435. "bearerAuth": []
  1436. }
  1437. ],
  1438. "parameters": [
  1439. {
  1440. "name": "id",
  1441. "in": "path",
  1442. "required": true,
  1443. "schema": {
  1444. "type": "string",
  1445. "format": "uuid"
  1446. }
  1447. }
  1448. ],
  1449. "requestBody": {
  1450. "required": true,
  1451. "content": {
  1452. "application/json": {
  1453. "schema": {
  1454. "$ref": "#/components/schemas/VerifyRequest"
  1455. }
  1456. }
  1457. }
  1458. },
  1459. "responses": {
  1460. "200": {
  1461. "description": "Recorded; returns the new verification_status"
  1462. },
  1463. "409": {
  1464. "description": "Not the current revision",
  1465. "content": {
  1466. "application/json": {
  1467. "schema": {
  1468. "$ref": "#/components/schemas/Error"
  1469. }
  1470. }
  1471. }
  1472. },
  1473. "422": {
  1474. "description": "Validation failed",
  1475. "content": {
  1476. "application/json": {
  1477. "schema": {
  1478. "$ref": "#/components/schemas/Error"
  1479. }
  1480. }
  1481. }
  1482. },
  1483. "401": {
  1484. "description": "Missing, invalid, revoked or expired API key",
  1485. "content": {
  1486. "application/json": {
  1487. "schema": {
  1488. "$ref": "#/components/schemas/Error"
  1489. }
  1490. }
  1491. }
  1492. },
  1493. "404": {
  1494. "description": "Not found or not visible to the caller",
  1495. "content": {
  1496. "application/json": {
  1497. "schema": {
  1498. "$ref": "#/components/schemas/Error"
  1499. }
  1500. }
  1501. }
  1502. },
  1503. "500": {
  1504. "description": "Internal error",
  1505. "content": {
  1506. "application/json": {
  1507. "schema": {
  1508. "$ref": "#/components/schemas/Error"
  1509. }
  1510. }
  1511. }
  1512. }
  1513. }
  1514. }
  1515. },
  1516. "/recall": {
  1517. "post": {
  1518. "summary": "Lexical recall over active memories; unverified memories are hidden unless verification_filter=include_unverified",
  1519. "security": [
  1520. {
  1521. "bearerAuth": []
  1522. }
  1523. ],
  1524. "requestBody": {
  1525. "required": true,
  1526. "content": {
  1527. "application/json": {
  1528. "schema": {
  1529. "$ref": "#/components/schemas/RecallRequest"
  1530. }
  1531. }
  1532. }
  1533. },
  1534. "responses": {
  1535. "200": {
  1536. "description": "Ranked results with warnings"
  1537. },
  1538. "422": {
  1539. "description": "Validation failed",
  1540. "content": {
  1541. "application/json": {
  1542. "schema": {
  1543. "$ref": "#/components/schemas/Error"
  1544. }
  1545. }
  1546. }
  1547. },
  1548. "401": {
  1549. "description": "Missing, invalid, revoked or expired API key",
  1550. "content": {
  1551. "application/json": {
  1552. "schema": {
  1553. "$ref": "#/components/schemas/Error"
  1554. }
  1555. }
  1556. }
  1557. },
  1558. "404": {
  1559. "description": "Not found or not visible to the caller",
  1560. "content": {
  1561. "application/json": {
  1562. "schema": {
  1563. "$ref": "#/components/schemas/Error"
  1564. }
  1565. }
  1566. }
  1567. },
  1568. "500": {
  1569. "description": "Internal error",
  1570. "content": {
  1571. "application/json": {
  1572. "schema": {
  1573. "$ref": "#/components/schemas/Error"
  1574. }
  1575. }
  1576. }
  1577. }
  1578. }
  1579. }
  1580. },
  1581. "/ingestion/jobs": {
  1582. "post": {
  1583. "summary": "Ingest a Markdown/text document (chunked, indexed)",
  1584. "security": [
  1585. {
  1586. "bearerAuth": []
  1587. }
  1588. ],
  1589. "parameters": [
  1590. {
  1591. "name": "Idempotency-Key",
  1592. "in": "header",
  1593. "required": false,
  1594. "description": "Replays the stored response for an identical body; a different body with the same key is 409.",
  1595. "schema": {
  1596. "type": "string",
  1597. "maxLength": 200
  1598. }
  1599. }
  1600. ],
  1601. "requestBody": {
  1602. "required": true,
  1603. "content": {
  1604. "application/json": {
  1605. "schema": {
  1606. "$ref": "#/components/schemas/IngestRequest"
  1607. }
  1608. }
  1609. }
  1610. },
  1611. "responses": {
  1612. "201": {
  1613. "description": "Ingested (new document or new revision)",
  1614. "content": {
  1615. "application/json": {
  1616. "schema": {
  1617. "$ref": "#/components/schemas/IngestResponse"
  1618. }
  1619. }
  1620. }
  1621. },
  1622. "200": {
  1623. "description": "Unchanged or idempotent replay",
  1624. "content": {
  1625. "application/json": {
  1626. "schema": {
  1627. "$ref": "#/components/schemas/IngestResponse"
  1628. }
  1629. }
  1630. }
  1631. },
  1632. "400": {
  1633. "description": "Invalid JSON",
  1634. "content": {
  1635. "application/json": {
  1636. "schema": {
  1637. "$ref": "#/components/schemas/Error"
  1638. }
  1639. }
  1640. }
  1641. },
  1642. "409": {
  1643. "description": "Idempotency-Key reused with a different body",
  1644. "content": {
  1645. "application/json": {
  1646. "schema": {
  1647. "$ref": "#/components/schemas/Error"
  1648. }
  1649. }
  1650. }
  1651. },
  1652. "422": {
  1653. "description": "Validation failed",
  1654. "content": {
  1655. "application/json": {
  1656. "schema": {
  1657. "$ref": "#/components/schemas/Error"
  1658. }
  1659. }
  1660. }
  1661. },
  1662. "401": {
  1663. "description": "Missing, invalid, revoked or expired API key",
  1664. "content": {
  1665. "application/json": {
  1666. "schema": {
  1667. "$ref": "#/components/schemas/Error"
  1668. }
  1669. }
  1670. }
  1671. },
  1672. "404": {
  1673. "description": "Not found or not visible to the caller",
  1674. "content": {
  1675. "application/json": {
  1676. "schema": {
  1677. "$ref": "#/components/schemas/Error"
  1678. }
  1679. }
  1680. }
  1681. },
  1682. "500": {
  1683. "description": "Internal error",
  1684. "content": {
  1685. "application/json": {
  1686. "schema": {
  1687. "$ref": "#/components/schemas/Error"
  1688. }
  1689. }
  1690. }
  1691. }
  1692. }
  1693. }
  1694. },
  1695. "/jobs/{id}": {
  1696. "get": {
  1697. "summary": "Ingestion job state",
  1698. "security": [
  1699. {
  1700. "bearerAuth": []
  1701. }
  1702. ],
  1703. "parameters": [
  1704. {
  1705. "name": "id",
  1706. "in": "path",
  1707. "required": true,
  1708. "schema": {
  1709. "type": "string",
  1710. "format": "uuid"
  1711. }
  1712. }
  1713. ],
  1714. "responses": {
  1715. "200": {
  1716. "description": "Job"
  1717. },
  1718. "401": {
  1719. "description": "Missing, invalid, revoked or expired API key",
  1720. "content": {
  1721. "application/json": {
  1722. "schema": {
  1723. "$ref": "#/components/schemas/Error"
  1724. }
  1725. }
  1726. }
  1727. },
  1728. "404": {
  1729. "description": "Not found or not visible to the caller",
  1730. "content": {
  1731. "application/json": {
  1732. "schema": {
  1733. "$ref": "#/components/schemas/Error"
  1734. }
  1735. }
  1736. }
  1737. },
  1738. "500": {
  1739. "description": "Internal error",
  1740. "content": {
  1741. "application/json": {
  1742. "schema": {
  1743. "$ref": "#/components/schemas/Error"
  1744. }
  1745. }
  1746. }
  1747. }
  1748. }
  1749. }
  1750. },
  1751. "/documents/{id}": {
  1752. "get": {
  1753. "summary": "Document metadata (?include_content=true adds the normalized text)",
  1754. "security": [
  1755. {
  1756. "bearerAuth": []
  1757. }
  1758. ],
  1759. "parameters": [
  1760. {
  1761. "name": "id",
  1762. "in": "path",
  1763. "required": true,
  1764. "schema": {
  1765. "type": "string",
  1766. "format": "uuid"
  1767. }
  1768. },
  1769. {
  1770. "name": "include_content",
  1771. "in": "query",
  1772. "schema": {
  1773. "type": "boolean"
  1774. }
  1775. }
  1776. ],
  1777. "responses": {
  1778. "200": {
  1779. "description": "Document"
  1780. },
  1781. "401": {
  1782. "description": "Missing, invalid, revoked or expired API key",
  1783. "content": {
  1784. "application/json": {
  1785. "schema": {
  1786. "$ref": "#/components/schemas/Error"
  1787. }
  1788. }
  1789. }
  1790. },
  1791. "404": {
  1792. "description": "Not found or not visible to the caller",
  1793. "content": {
  1794. "application/json": {
  1795. "schema": {
  1796. "$ref": "#/components/schemas/Error"
  1797. }
  1798. }
  1799. }
  1800. },
  1801. "500": {
  1802. "description": "Internal error",
  1803. "content": {
  1804. "application/json": {
  1805. "schema": {
  1806. "$ref": "#/components/schemas/Error"
  1807. }
  1808. }
  1809. }
  1810. }
  1811. }
  1812. }
  1813. },
  1814. "/chunks/{id}": {
  1815. "get": {
  1816. "summary": "One chunk with heading path and source locator (character offsets into the normalized document text)",
  1817. "security": [
  1818. {
  1819. "bearerAuth": []
  1820. }
  1821. ],
  1822. "parameters": [
  1823. {
  1824. "name": "id",
  1825. "in": "path",
  1826. "required": true,
  1827. "schema": {
  1828. "type": "string",
  1829. "format": "uuid"
  1830. }
  1831. }
  1832. ],
  1833. "responses": {
  1834. "200": {
  1835. "description": "Chunk"
  1836. },
  1837. "401": {
  1838. "description": "Missing, invalid, revoked or expired API key",
  1839. "content": {
  1840. "application/json": {
  1841. "schema": {
  1842. "$ref": "#/components/schemas/Error"
  1843. }
  1844. }
  1845. }
  1846. },
  1847. "404": {
  1848. "description": "Not found or not visible to the caller",
  1849. "content": {
  1850. "application/json": {
  1851. "schema": {
  1852. "$ref": "#/components/schemas/Error"
  1853. }
  1854. }
  1855. }
  1856. },
  1857. "500": {
  1858. "description": "Internal error",
  1859. "content": {
  1860. "application/json": {
  1861. "schema": {
  1862. "$ref": "#/components/schemas/Error"
  1863. }
  1864. }
  1865. }
  1866. }
  1867. }
  1868. }
  1869. },
  1870. "/search": {
  1871. "post": {
  1872. "summary": "Lexical (FTS5/bm25) search over current document chunks; results are untrusted reference data",
  1873. "security": [
  1874. {
  1875. "bearerAuth": []
  1876. }
  1877. ],
  1878. "requestBody": {
  1879. "required": true,
  1880. "content": {
  1881. "application/json": {
  1882. "schema": {
  1883. "$ref": "#/components/schemas/SearchRequest"
  1884. }
  1885. }
  1886. }
  1887. },
  1888. "responses": {
  1889. "200": {
  1890. "description": "Ranked chunks with locators and content_trust"
  1891. },
  1892. "422": {
  1893. "description": "Validation failed",
  1894. "content": {
  1895. "application/json": {
  1896. "schema": {
  1897. "$ref": "#/components/schemas/Error"
  1898. }
  1899. }
  1900. }
  1901. },
  1902. "401": {
  1903. "description": "Missing, invalid, revoked or expired API key",
  1904. "content": {
  1905. "application/json": {
  1906. "schema": {
  1907. "$ref": "#/components/schemas/Error"
  1908. }
  1909. }
  1910. }
  1911. },
  1912. "404": {
  1913. "description": "Not found or not visible to the caller",
  1914. "content": {
  1915. "application/json": {
  1916. "schema": {
  1917. "$ref": "#/components/schemas/Error"
  1918. }
  1919. }
  1920. }
  1921. },
  1922. "500": {
  1923. "description": "Internal error",
  1924. "content": {
  1925. "application/json": {
  1926. "schema": {
  1927. "$ref": "#/components/schemas/Error"
  1928. }
  1929. }
  1930. }
  1931. }
  1932. }
  1933. }
  1934. },
  1935. "/health/live": {
  1936. "get": {
  1937. "summary": "Liveness",
  1938. "responses": {
  1939. "200": {
  1940. "description": "Live"
  1941. }
  1942. }
  1943. }
  1944. },
  1945. "/health/ready": {
  1946. "get": {
  1947. "summary": "Readiness (database reachable)",
  1948. "responses": {
  1949. "200": {
  1950. "description": "Ready"
  1951. },
  1952. "503": {
  1953. "description": "Unavailable"
  1954. }
  1955. }
  1956. }
  1957. }
  1958. }
  1959. }

Powered by TurnKey Linux.