{
  "openapi": "3.1.0",
  "info": {
    "title": "Sayod 111 Commercial Intelligence Radar API",
    "version": "3.0.0",
    "description": "Pre-cached sub-50ms Cloudflare D1 Compound B2B Buying Signals (Shopify E-Com Growth Radar, Cyber/GRC Deal Radar, WealthPulse U.S. SEC Form ADV RIAs) plus live single-domain HTTP/2 & DNS auditors.",
    "contact": {
      "name": "Sayed Ali (Sayod 111)",
      "email": "sayod111publishing@gmail.com",
      "url": "https://sayod111-radar.pages.dev/"
    }
  },
  "servers": [
    {
      "url": "https://sayod111-radar-api.sayodyalawi.workers.dev",
      "description": "Cloudflare Global Edge Production"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Scoped API key (`dp_live_...`) provisioned via Dodo Payments."
      }
    }
  },
  "paths": {
    "/v1/health": {
      "get": {
        "summary": "Edge D1 Health & Dataset Telemetry",
        "responses": {
          "200": {
            "description": "Live record counts, sync timestamps, and D1 query latency."
          }
        }
      }
    },
    "/v1/public/live-audit": {
      "post": {
        "summary": "Live Single-Domain HTTP/2 & DNS Audit",
        "description": "3 free live audits/day per IP; unlimited (quota-metered) with `Authorization: Bearer dp_live_...` header.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "domain"
                ],
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "shopify",
                      "trust",
                      "dmarc"
                    ],
                    "default": "shopify"
                  },
                  "domain": {
                    "type": "string",
                    "example": "hexclad.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Live audit JSON payload"
          },
          "429": {
            "description": "Daily free limit exceeded"
          }
        }
      }
    },
    "/v1/public/ria-search": {
      "get": {
        "summary": "Indexed U.S. SEC Form ADV RIA Search",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Prefix firm name or exact CRD number"
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "2-letter U.S. state code (e.g. CA, NY)"
          },
          {
            "name": "mismatch_only",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1
              ]
            },
            "description": "1 = SEC disclosure indicator flagged firms only"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 25,
              "default": 15
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Indexed SEC RIA records"
          }
        }
      }
    },
    "/v1/public/sample/{vertical}": {
      "get": {
        "summary": "Download 25-Row Public Sample (CSV or JSON)",
        "parameters": [
          {
            "name": "vertical",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ecom_radar",
                "cyber_grc",
                "ria_wealth"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json"
              ],
              "default": "csv"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Clean flat sample rows"
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "summary": "Check Subscription Tier & Monthly Row Quota",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Active tier, used rows, remaining quota, and renewal timestamp"
          },
          "401": {
            "description": "Invalid or revoked API key"
          }
        }
      }
    },
    "/v1/radar/{vertical}": {
      "get": {
        "summary": "Query Pre-Cached Compound Intelligence Feed (Sub-50ms)",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "vertical",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ecom_radar",
                "cyber_grc",
                "ria_wealth"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 50,
              "default": 25
            }
          },
          {
            "name": "after_id",
            "in": "query",
            "schema": {
              "type": "integer",
              "description": "Keyset pagination cursor (ecom_radar / cyber_grc)"
            }
          },
          {
            "name": "after_crd",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Keyset pagination cursor (ria_wealth)"
            }
          },
          {
            "name": "min_score",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "delta_only",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "description": "1 = only new or changed rows since prior sync"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated compound intelligence records"
          }
        }
      }
    },
    "/v1/alerts": {
      "post": {
        "summary": "Register Automated Weekly Delta Webhook",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "feed_type",
                  "target_endpoint"
                ],
                "properties": {
                  "feed_type": {
                    "type": "string",
                    "enum": [
                      "ecom_radar",
                      "cyber_grc",
                      "ria_wealth"
                    ]
                  },
                  "delivery_channel": {
                    "type": "string",
                    "enum": [
                      "webhook"
                    ],
                    "default": "webhook"
                  },
                  "target_endpoint": {
                    "type": "string",
                    "format": "uri",
                    "example": "https://hooks.slack.com/services/..."
                  },
                  "cadence": {
                    "type": "string",
                    "enum": [
                      "weekly",
                      "daily"
                    ],
                    "default": "weekly"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook alert subscription active"
          }
        }
      }
    }
  }
}