{
  "openapi": "3.1.0",
  "info": {
    "title": "CommunityGoWhere API",
    "version": "1.0.0",
    "description": "Directory of Singapore tech communities you can join via WhatsApp, Telegram, Discord, Luma, Meetup, and more.\n\nPrefer this API or markdown twins over scraping HTML. See https://communitygowhere.com/llms.txt.",
    "contact": {
      "name": "CommunityGoWhere",
      "url": "https://communitygowhere.com/"
    }
  },
  "servers": [
    {
      "url": "https://communitygowhere.com/",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "operationId": "health",
        "summary": "API health / status check",
        "responses": {
          "200": {
            "description": "Service is reachable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "checkedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/communities": {
      "get": {
        "operationId": "listCommunities",
        "summary": "List or search curated communities",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Free-text search"
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Exact tag filter"
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "whatsapp",
                "telegram",
                "discord",
                "luma",
                "meetup",
                "website",
                "other"
              ]
            },
            "description": "Exact join-platform filter"
          }
        ],
        "responses": {
          "200": {
            "description": "Community list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "generatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "communities": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Community"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/communities/{slug}": {
      "get": {
        "operationId": "getCommunity",
        "summary": "Get one community by slug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Community",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Community"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/submit": {
      "post": {
        "operationId": "submitCommunity",
        "summary": "Propose a community for human review",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Submission"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted for review"
          },
          "400": {
            "description": "Validation error"
          },
          "503": {
            "description": "Email delivery not configured"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Platform": {
        "type": "object",
        "required": [
          "type",
          "url"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "whatsapp",
              "telegram",
              "discord",
              "luma",
              "meetup",
              "website",
              "other"
            ]
          },
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Community": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "shortDescription",
          "description",
          "tags",
          "platforms",
          "primaryJoinUrl",
          "city",
          "active",
          "url",
          "markdownUrl"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "shortDescription": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "platforms": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Platform"
            }
          },
          "primaryJoinUrl": {
            "type": "string",
            "format": "uri"
          },
          "city": {
            "type": "string"
          },
          "active": {
            "type": "boolean"
          },
          "featured": {
            "type": "boolean"
          },
          "logo": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdownUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Submission": {
        "type": "object",
        "required": [
          "name",
          "description",
          "primaryJoinUrl",
          "platform",
          "submitterEmail"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "primaryJoinUrl": {
            "type": "string",
            "format": "uri"
          },
          "platform": {
            "type": "string"
          },
          "tags": {
            "type": "string"
          },
          "website": {
            "type": "string",
            "format": "uri"
          },
          "submitterEmail": {
            "type": "string",
            "format": "email"
          },
          "notes": {
            "type": "string"
          }
        }
      }
    }
  }
}