{
  "openapi": "3.0.3",
  "info": { "title": "Wicked Memory", "version": "0.1.0", "description": "Portable agent memory. Auth: per-request wallet signature headers (see /llms.txt)." },
  "components": {
    "securitySchemes": {
      "walletSignature": { "type": "apiKey", "in": "header", "name": "x-wallet-signature", "description": "Also requires x-wallet-address, x-wallet-timestamp, x-wallet-nonce. See /llms.txt." },
      "apiKey": { "type": "apiKey", "in": "header", "name": "x-api-key" }
    }
  },
  "paths": {
    "/memories": { "post": { "summary": "Store a memory", "security": [{ "walletSignature": [] }], "responses": { "201": { "description": "Created" } } } },
    "/memories/search": { "get": { "summary": "Semantic search (x402-metered; free with x-api-key)", "security": [{ "walletSignature": [], "apiKey": [] }], "parameters": [
      { "name": "q", "in": "query", "required": true, "schema": { "type": "string" } },
      { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 10 } },
      { "name": "tags", "in": "query", "schema": { "type": "string" } },
      { "name": "created_after", "in": "query", "schema": { "type": "string", "format": "date-time" } },
      { "name": "created_before", "in": "query", "schema": { "type": "string", "format": "date-time" } },
      { "name": "as_of", "in": "query", "schema": { "type": "string", "format": "date-time" } },
      { "name": "include_superseded", "in": "query", "schema": { "type": "boolean" } }
    ], "responses": { "200": { "description": "Ranked results" }, "402": { "description": "x402 payment required" } } } },
    "/memories/{id}": {
      "get": { "summary": "Get a memory", "security": [{ "walletSignature": [] }], "responses": { "200": { "description": "OK" }, "404": { "description": "Not found" } } },
      "patch": { "summary": "Supersede (new version)", "security": [{ "walletSignature": [] }], "responses": { "200": { "description": "OK" }, "409": { "description": "Already superseded" } } },
      "delete": { "summary": "Hard delete (audited)", "security": [{ "walletSignature": [] }], "responses": { "200": { "description": "OK" } } }
    },
    "/memories/{id}/history": { "get": { "summary": "Version chain", "security": [{ "walletSignature": [] }], "responses": { "200": { "description": "OK" } } } },
    "/memory-deletions": { "get": { "summary": "Deletion audit log", "security": [{ "walletSignature": [] }], "responses": { "200": { "description": "OK" } } } },
    "/health": { "get": { "summary": "Liveness", "responses": { "200": { "description": "OK" } } } },
    "/v1/status": { "get": { "summary": "Service status", "responses": { "200": { "description": "OK" } } } }
  }
}
