{
  "openapi": "3.1.0",
  "info": {
    "title": "ToolMint SAM.gov Opportunities JSON",
    "version": "0.1.1",
    "description": "US federal contract opportunities (SAM.gov) as normalized JSON for AI agents. Pay per search with USDC on Base via x402. Not an official GSA product.",
    "x-guidance": "Use GET /opportunities with any of q, naics, state, postedFrom, postedTo (YYYY-MM-DD), page, limit (1-100). Unpaid calls receive HTTP 402 with x402 payment requirements (USDC on Base). Bad params return 400 before any payment is asked for. 503 carries Retry-After. Zero results is a valid 200. Free: /, /health, /openapi.json, /.well-known/x402.",
    "contact": {
      "email": "toolmint.dev@gmail.com",
      "name": "ToolMint"
    }
  },
  "paths": {
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Liveness",
        "security": [],
        "responses": {
          "200": {
            "description": "ok"
          }
        }
      }
    },
    "/opportunities": {
      "get": {
        "operationId": "sam_opportunities_search",
        "summary": "Search SAM.gov contract opportunities",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.020000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ],
          "network": "eip155:8453",
          "payTo": "0xfbF7413bcB3a604936775C96FDbe0b0C9c9E37F5",
          "asset": "USDC",
          "scheme": "exact",
          "amountAtomic": "20000"
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "naics",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\d{2,6}$"
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            }
          },
          {
            "name": "postedFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "postedTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9999,
              "default": 0
            },
            "description": "0-based; (page+1)*limit must stay within the first 10,000 records"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            },
            "description": "Alias: size"
          },
          {
            "name": "activeOnly",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "useOfficialApi",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Normalized opportunities with provenance + terms"
          },
          "400": {
            "description": "Bad parameters, code bad_input (rejected before payment; not charged)"
          },
          "402": {
            "description": "Payment Required"
          },
          "500": {
            "description": "Internal error, code internal (not charged)"
          },
          "502": {
            "description": "Upstream SAM.gov error, code upstream_error (not charged)"
          },
          "503": {
            "description": "Rate limited (code rate_limited, Retry-After) or payment init down (code payment_unavailable); not charged"
          }
        }
      }
    }
  }
}