{
  "openapi": "3.0.3",
  "info": {
    "title": "hemo-vault",
    "version": "1.0.0",
    "description": "Persistent key-value state for AI agents â€” your agent's database, no signup. Optional HELIOS provenance sealing: receipts or it didn't happen. Docs: https://hemo-vault.oooooooooo.se/llms.txt"
  },
  "servers": [
    {
      "url": "https://hemo-vault.oooooooooo.se"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "HELIOS agent token"
      },
      "operatorAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "OPERATOR_TOKEN secret (operator doors)"
      }
    }
  },
  "paths": {
    "/api/v1/state/{key}": {
      "parameters": [
        {
          "name": "key",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^[a-z0-9_.-]{1,120}$"
          }
        }
      ],
      "put": {
        "summary": "Store a value (raw JSON/text body)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ttl",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 60
            },
            "description": "Expiration seconds (KV min 60)"
          },
          {
            "name": "seal",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            },
            "description": "Also append a provenance record to HELIOS"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/plain": {
              "schema": {
                "type": "string",
                "maxLength": 102400
              }
            },
            "application/json": {
              "schema": {
                "type": "string",
                "maxLength": 102400
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "overwritten"
          },
          "201": {
            "description": "created"
          },
          "400": {
            "description": "invalid key or ttl"
          },
          "401": {
            "description": "invalid helios token"
          },
          "413": {
            "description": "value over 100KB"
          },
          "429": {
            "description": "keys-per-agent fuse tripped (1000)"
          },
          "503": {
            "description": "global ops valve"
          }
        }
      },
      "get": {
        "summary": "Read a value",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "{key, value, sealed_records, updated_at}"
          },
          "401": {
            "description": "invalid helios token"
          },
          "404": {
            "description": "not found"
          }
        }
      },
      "delete": {
        "summary": "Delete a key",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "deleted"
          },
          "401": {
            "description": "invalid helios token"
          },
          "404": {
            "description": "not found"
          }
        }
      }
    },
    "/api/v1/state": {
      "get": {
        "summary": "List caller's keys (sizes + updated_at)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "paged key list"
          },
          "401": {
            "description": "invalid helios token"
          }
        }
      }
    },
    "/api/v1/seal/{key}": {
      "post": {
        "summary": "Notarize current value on HELIOS without rewriting it",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "seal receipt incl. record_id (or already_sealed:true)"
          },
          "401": {
            "description": "invalid helios token"
          },
          "404": {
            "description": "not found"
          },
          "502": {
            "description": "ledger unreachable"
          }
        }
      }
    },
    "/api/v1/status": {
      "get": {
        "summary": "Caller's usage (keys, bytes, seals)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "usage snapshot; daily_limit:null always"
          },
          "401": {
            "description": "invalid helios token"
          }
        }
      }
    },
    "/api/v1/report": {
      "get": {
        "summary": "PUBLIC totals (agents, keys, bytes, seals)",
        "security": [],
        "responses": {
          "200": {
            "description": "cached ~5 min"
          }
        }
      }
    },
    "/api/v1/admin/log": {
      "get": {
        "summary": "Recent seal/fuse events",
        "security": [
          {
            "operatorAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "event log"
          },
          "401": {
            "description": "operator only"
          }
        }
      }
    },
    "/api/v1/admin/report": {
      "get": {
        "summary": "Force-refresh public totals",
        "security": [
          {
            "operatorAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "fresh totals"
          },
          "401": {
            "description": "operator only"
          }
        }
      }
    }
  }
}