{
  "openapi": "3.1.0",
  "info": {
    "title": "benben API",
    "version": "1.0.0",
    "description": "Two structured data products available via x402 micropayments. Preview endpoints are free. Full datasets cost $0.25 USDC on Base Sepolia (testnet).",
    "contact": {
      "name": "Ben Afshar",
      "email": "ben.afshar@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://benben.io",
      "description": "Production"
    }
  ],
  "paths": {
    "/api": {
      "get": {
        "operationId": "getProductIndex",
        "summary": "Product index — start here",
        "description": "Machine-readable index of available products, prices, and agent instructions for completing x402 payments.",
        "responses": {
          "200": {
            "description": "Product index with payment instructions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/places/preview": {
      "get": {
        "operationId": "getPlacesPreview",
        "summary": "Places — free preview",
        "description": "Free preview: 2 cities, 6 spots. Includes metadata about the full dataset and payment instructions.",
        "responses": {
          "200": {
            "description": "Preview dataset with lock metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlacesPreview"
                }
              }
            }
          }
        }
      }
    },
    "/api/places/full": {
      "get": {
        "operationId": "getPlacesFull",
        "summary": "Places — full dataset (paid)",
        "description": "Full dataset: 7 cities, 37 spots. Requires $0.25 USDC payment via x402 protocol on Base Sepolia.",
        "security": [
          {
            "x402Payment": []
          }
        ],
        "responses": {
          "200": {
            "description": "Full places dataset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlacesFull"
                }
              }
            }
          },
          "402": {
            "description": "Payment required — x402 protocol response",
            "headers": {
              "X-Payment-Required": {
                "description": "x402 payment requirements. Contains price, network, and receiving wallet address.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/api/hospital-bag/preview": {
      "get": {
        "operationId": "getHospitalBagPreview",
        "summary": "Hospital bag checklist — free preview",
        "description": "Free preview: 2 categories, 5 items. Includes metadata about the full checklist and payment instructions.",
        "responses": {
          "200": {
            "description": "Preview checklist with lock metadata",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HospitalBagPreview"
                }
              }
            }
          }
        }
      }
    },
    "/api/hospital-bag/full": {
      "get": {
        "operationId": "getHospitalBagFull",
        "summary": "Hospital bag checklist — full dataset (paid)",
        "description": "Full checklist: 7 categories, 33 items including clothing, partner support, baby items, admin, and anti-list. Requires $0.25 USDC via x402.",
        "security": [
          {
            "x402Payment": []
          }
        ],
        "responses": {
          "200": {
            "description": "Full hospital bag checklist",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HospitalBagFull"
                }
              }
            }
          },
          "402": {
            "description": "Payment required — x402 protocol response",
            "headers": {
              "X-Payment-Required": {
                "description": "x402 payment requirements",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "x402Payment": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Payment-Signature",
        "description": "x402 payment signature. See https://github.com/coinbase/x402 for the signing flow."
      }
    },
    "schemas": {
      "PaymentRequired": {
        "type": "object",
        "properties": {
          "error": { "type": "string", "example": "payment_required" },
          "price_usd": { "type": "number", "example": 0.25 },
          "currency": { "type": "string", "example": "USDC" },
          "network": { "type": "string", "example": "base-sepolia" },
          "payment_protocol": { "type": "string", "example": "x402" }
        }
      },
      "PlacesPreview": {
        "type": "object",
        "properties": {
          "version": { "type": "integer" },
          "preview": { "type": "boolean" },
          "total_cities": { "type": "integer" },
          "total_spots": { "type": "integer" },
          "cities": { "type": "array" },
          "locked": { "type": "object" }
        }
      },
      "PlacesFull": {
        "type": "object",
        "properties": {
          "version": { "type": "integer" },
          "total_cities": { "type": "integer" },
          "total_spots": { "type": "integer" },
          "cities": { "type": "array" }
        }
      },
      "HospitalBagPreview": {
        "type": "object",
        "properties": {
          "version": { "type": "integer" },
          "preview": { "type": "boolean" },
          "total_items": { "type": "integer" },
          "categories": { "type": "array" },
          "locked": { "type": "object" }
        }
      },
      "HospitalBagFull": {
        "type": "object",
        "properties": {
          "version": { "type": "integer" },
          "total_items": { "type": "integer" },
          "categories": { "type": "array" }
        }
      }
    }
  }
}
