{
  "openapi": "3.1.0",
  "info": {
    "title": "CentQuery x402 synthetic testnet gateway",
    "version": "0.1.0-preview",
    "description": "Machine-readable contract for the currently verified CentQuery synthetic-only gateway. This preview is not a commercial data marketplace. The new api.centquery.dev host currently advertises the old workers.dev canonical x402 resource URL until a separately validated deployment. No agent should sign or purchase automatically based on this specification.",
    "contact": {
      "url": "https://centquery.dev/docs/"
    }
  },
  "servers": [
    {
      "url": "https://api.centquery.dev",
      "description": "New public hostname. Unsigned GET 402 is available, but signed client compatibility is NOT yet verified; challenge currently advertises the legacy workers.dev resource URL."
    },
    {
      "url": "https://centquery-gateway-lab.tomashcv-centquery-lab.workers.dev",
      "description": "Original protected testnet gateway; retained for existing purchasers and their signed recoveries."
    }
  ],
  "tags": [
    {
      "name": "inspection",
      "description": "Read-only calls requiring no wallet or payment."
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "getGatewayReadiness",
        "tags": [
          "inspection"
        ],
        "summary": "Inspect gateway configuration readiness",
        "description": "Unauthenticated read-only GET. A healthy response reflects the existence of required gateway secrets and rate limiter bindings, NOT the availability of Supabase upstream or settlement.",
        "responses": {
          "200": {
            "description": "Gateway configuration is present, without proving upstream availability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "service",
                    "mode",
                    "status"
                  ],
                  "properties": {
                    "service": {
                      "type": "string",
                      "const": "centquery-gateway"
                    },
                    "mode": {
                      "type": "string",
                      "const": "testnet"
                    },
                    "status": {
                      "type": "string",
                      "const": "configured"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Gateway binding or configuration unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/functions/v1/paid-demo/report": {
      "get": {
        "operationId": "inspectSyntheticReportChallenge",
        "tags": [
          "inspection"
        ],
        "summary": "Inspect unsigned x402 payment requirements for a synthetic report",
        "description": "Without PAYMENT-SIGNATURE this operation advertises x402 v2 requirements (Base Sepolia eip155:84532, 10000 atomic units or 0.01 test-USDC) and returns HTTP 402, without charging. Only a fully verified and settled authorized payment can return the synthetic report. The api.centquery.dev hostname's challenge currently advertises the legacy workers.dev resource URL, so do not attempt a new-host signed purchase until the dual-host migration is deployed and verified. Always validate the live challenge terms and require explicit user approval before any signed purchase.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Synthetic report delivered only after verified settlement. Requires a separately authorized x402 client; not a public response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyntheticReport"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Payment required. Safe to inspect without authorizing anything.",
            "headers": {
              "PAYMENT-REQUIRED": {
                "description": "Base64-encoded x402 v2 payment requirements; must be decoded and independently validated by any buyer.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Gateway rate limit exceeded.",
            "headers": {
              "Retry-After": {
                "description": "Number of seconds until a retry is permitted.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "503": {
            "description": "Protected gateway or origin unavailable; no guarantee of settlement.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": true
      },
      "SyntheticReport": {
        "type": "object",
        "required": [
          "synthetic",
          "report"
        ],
        "properties": {
          "synthetic": {
            "type": "boolean",
            "const": true
          },
          "report": {
            "type": "object",
            "required": [
              "observations",
              "temperature_mean_c"
            ],
            "properties": {
              "observations": {
                "type": "integer",
                "minimum": 0
              },
              "temperature_mean_c": {
                "type": "number"
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  },
  "x-centquery-discovery": {
    "preview": true,
    "synthetic_only": true,
    "network": "eip155:84532",
    "autonomous_purchase_supported": false,
    "reason": "New API-host resource binding not deployed; commercial catalog and mainnet payments not available",
    "canonical_legacy_report_url": "https://centquery-gateway-lab.tomashcv-centquery-lab.workers.dev/functions/v1/paid-demo/report",
    "metadata_url": "https://centquery.dev/catalog.json",
    "documentation_url": "https://centquery.dev/docs/"
  }
}
