{
  "openapi": "3.1.0",
  "info": {
    "title": "SignalGuard API",
    "version": "2026-05-21",
    "description": "Customer-facing API for SignalGuard event-security scans, saved scans, and event listings."
  },
  "servers": [
    {
      "url": "https://signalguard.live",
      "description": "Production"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/v1/status": {
      "get": {
        "summary": "Validate an API key",
        "responses": {
          "200": {
            "description": "Key is valid"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Team or Enterprise tier required"
          },
          "429": {
            "description": "API key rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/events": {
      "get": {
        "summary": "List saved events in the key scope",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }
          }
        ],
        "responses": {
          "200": {
            "description": "Scoped event list"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Team or Enterprise tier required"
          },
          "429": {
            "description": "API key rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/scan": {
      "post": {
        "summary": "Run and persist a SignalGuard scan",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["eventLocation"],
                "properties": {
                  "eventName": { "type": "string" },
                  "eventLocation": { "type": "string" },
                  "eventDate": { "type": "string", "format": "date-time" },
                  "eventEnd": { "type": "string", "format": "date-time" },
                  "keyword": { "type": "string" },
                  "lat": { "type": "number" },
                  "lon": { "type": "number" }
                }
              },
              "examples": {
                "googleIo": {
                  "value": {
                    "eventName": "Google I/O 2026",
                    "eventLocation": "Shoreline Amphitheatre, Mountain View, CA",
                    "eventDate": "2026-05-20T09:00:00-07:00",
                    "keyword": "Google I/O"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Scan created"
          },
          "400": {
            "description": "Missing eventLocation"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Team or Enterprise tier required"
          },
          "429": {
            "description": "API key rate limit exceeded"
          },
          "502": {
            "description": "Scan failed"
          }
        }
      }
    },
    "/api/v1/scan/{scanId}": {
      "get": {
        "summary": "Fetch a stored scan",
        "parameters": [
          {
            "name": "scanId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Stored scan with signal payloads"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Team or Enterprise tier required"
          },
          "404": {
            "description": "Scan not found in key scope"
          },
          "429": {
            "description": "API key rate limit exceeded"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "SignalGuard API key"
      }
    }
  }
}
