{
  "openapi": "3.1.0",
  "info": {
    "title": "星創網絡 StarChase Official Public API",
    "version": "1.0.0",
    "description": "Public API endpoints for StarChase Network: health checks, lead intake, and developer services.",
    "termsOfService": "https://www.star-chase.com/terms/",
    "license": {
      "name": "Proprietary",
      "url": "https://www.star-chase.com/terms/"
    },
    "contact": {
      "name": "StarChase Developer Support",
      "url": "https://www.star-chase.com/contact/",
      "email": "info@star-chase.com"
    }
  },
  "externalDocs": {
    "description": "StarChase Developer Docs, Versioning Policy, and Error Guidance",
    "url": "https://www.star-chase.com/docs"
  },
  "servers": [
    {
      "url": "https://www.star-chase.com",
      "description": "Production Server"
    }
  ],
  "tags": [
    {
      "name": "Health",
      "description": "API status and health monitoring endpoints"
    },
    {
      "name": "Leads",
      "description": "Business inquiry and consultation intake endpoints"
    }
  ],
  "paths": {
    "/api/v1/health": {
      "get": {
        "operationId": "getHealthV1",
        "summary": "Health check endpoint (v1)",
        "description": "Returns current API operational status, service identifier, and timestamp.",
        "tags": [
          "Health"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "API is healthy",
            "headers": {
              "RateLimit-Limit": {
                "description": "Request quota limit per minute window",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "description": "Remaining requests in the current window",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "description": "Seconds until the current quota window resets",
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Policy": {
                "description": "Rate limit policy specification",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/lead": {
      "post": {
        "operationId": "submitLeadV1",
        "summary": "Submit consultation inquiry (v1)",
        "description": "Submit a business lead or consultation request with contact details and selected services.",
        "tags": [
          "Leads"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSubmission"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lead received successfully",
            "headers": {
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                }
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid submission payload or missing required fields",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal delivery error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealthLegacy",
        "summary": "Health check legacy alias",
        "description": "Deprecated alias for /api/v1/health. Please migrate to /api/v1/health.",
        "deprecated": true,
        "tags": [
          "Health"
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/lead": {
      "post": {
        "operationId": "submitLeadLegacy",
        "summary": "Submit consultation legacy alias",
        "description": "Deprecated alias for /api/v1/lead. Please migrate to /api/v1/lead.",
        "deprecated": true,
        "tags": [
          "Leads"
        ],
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadSubmission"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "required": [
          "status",
          "service",
          "timestamp"
        ],
        "properties": {
          "status": {
            "type": "string",
            "example": "ok"
          },
          "service": {
            "type": "string",
            "example": "starchase-official"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "example": "2026-08-24T00:00:00.000Z"
          }
        }
      },
      "LeadSubmission": {
        "type": "object",
        "required": [
          "name",
          "industry",
          "service"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "聯絡人姓名或稱呼",
            "example": "王小明"
          },
          "company": {
            "type": "string",
            "description": "公司或品牌名稱",
            "example": "好物選品有限公司"
          },
          "industry": {
            "type": "string",
            "description": "產業分類",
            "example": "電商零售"
          },
          "service": {
            "type": "string",
            "description": "諮詢服務項目",
            "example": "短影音製作、數位廣告投放"
          },
          "site": {
            "type": "string",
            "description": "官網或社群連結",
            "example": "https://example.com"
          },
          "phone": {
            "type": "string",
            "description": "聯絡電話",
            "example": "0912345678"
          },
          "line": {
            "type": "string",
            "description": "LINE ID",
            "example": "starchase_line"
          }
        }
      },
      "LeadResponse": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "example": true
          },
          "message": {
            "type": "string",
            "example": "感謝您的諮詢，專人將於 24 小時內聯繫。"
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "instance",
          "code",
          "resolution"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "example": "https://www.star-chase.com/docs#errors"
          },
          "title": {
            "type": "string",
            "example": "Invalid Request"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599,
            "example": 400
          },
          "detail": {
            "type": "string",
            "example": "Missing required field: service"
          },
          "instance": {
            "type": "string",
            "format": "uri-reference",
            "example": "/api/v1/lead"
          },
          "code": {
            "type": "string",
            "example": "missing_required_field"
          },
          "resolution": {
            "type": "string",
            "example": "Please provide name, industry, and service in the JSON body."
          },
          "documentation_url": {
            "type": "string",
            "format": "uri",
            "example": "https://www.star-chase.com/docs"
          }
        }
      }
    }
  },
  "x-rate-limit-policy": {
    "name": "public-api",
    "quota": 120,
    "window_seconds": 60,
    "partition": "client IP address"
  },
  "x-api-lifecycle": {
    "current_major_version": "v1",
    "deprecation_policy_url": "https://www.star-chase.com/docs#versioning-and-deprecation"
  }
}