{
  "openapi": "3.1.0",
  "info": {
    "title": "HADİ app.api",
    "version": "2027-01-15",
    "description": "App-level API (client_credentials + DPoP; confidential clients with private_key_jwt): public data and community bots. No member data.",
    "x-hadi-tr": "Uygulama düzeyi API (client_credentials + DPoP; yalnızca gizli istemci): herkese açık veri ve topluluk botları. Üye verisi yok.",
    "termsOfService": "https://devs.hadisosyal.com/politikalar/gelistirici-sozlesmesi",
    "contact": {
      "url": "https://devs.hadisosyal.com"
    }
  },
  "servers": [
    {
      "url": "https://app.api.hadisosyal.com",
      "description": "Production"
    },
    {
      "url": "https://app.api.sandbox.hadisosyal.com",
      "description": "Sandbox"
    }
  ],
  "paths": {
    "/v1/public/events": {
      "get": {
        "operationId": "publicEventsList",
        "summary": "Public events",
        "description": "Same data as api.hadisosyal.com: upcoming public events (location at district level).",
        "x-hadi-tr": {
          "summary": "Herkese açık etkinlikler",
          "description": "api.hadisosyal.com ile aynı veri: yaklaşan herkese açık etkinlikler (konum il/ilçe).",
          "appFeature": null
        },
        "x-hadi-scope": [
          "public:read"
        ],
        "x-hadi-risk": "R0",
        "x-hadi-services": [
          "public_api"
        ],
        "security": [
          {
            "DPoP": [
              "public:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size (max 50, default 20).",
            "x-hadi-tr": "Sayfa boyutu (en çok 50, varsayılan 20).",
            "schema": {
              "type": "integer",
              "maximum": 50,
              "minimum": 1
            }
          },
          {
            "$ref": "#/components/parameters/HadiVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "items": [
                    {
                      "eventId": "evt_s4nd",
                      "datetime": "2027-01-20T16:00:00.000Z",
                      "location": "Kadıköy, İstanbul",
                      "name": "Pazar Kahvaltısı",
                      "description": "…",
                      "capacity": 20,
                      "price": 0,
                      "attendees": 8,
                      "imageUrl": "https://…"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          },
          "503": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/v1/public/events/{id}": {
      "get": {
        "operationId": "publicEventsGet",
        "summary": "A public event",
        "x-hadi-tr": {
          "summary": "Herkese açık etkinlik",
          "description": null,
          "appFeature": null
        },
        "x-hadi-scope": [
          "public:read"
        ],
        "x-hadi-risk": "R0",
        "x-hadi-services": [
          "public_api"
        ],
        "security": [
          {
            "DPoP": [
              "public:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Event id.",
            "x-hadi-tr": "Etkinlik kimliği.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{1,64}$"
            }
          },
          {
            "$ref": "#/components/parameters/HadiVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "eventId": "evt_s4nd",
                  "datetime": "2027-01-20T16:00:00.000Z",
                  "location": "Kadıköy, İstanbul",
                  "name": "Pazar Kahvaltısı",
                  "description": "…",
                  "capacity": 20,
                  "price": 0,
                  "attendees": 8,
                  "imageUrl": "https://…"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          },
          "503": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/v1/bot/messages": {
      "post": {
        "operationId": "botsPost",
        "summary": "Post to the community chat as a bot",
        "description": "Only to the community it is installed in (installation in the token); stops working when the community owner removes it. Profanity filter applies; max 30 messages per hour.",
        "x-hadi-tr": {
          "summary": "Bot olarak topluluk sohbetine yaz",
          "description": "Yalnızca kurulduğu topluluğa (jetondaki kurulum); topluluk kurucusu botu kaldırınca jeton çalışmaz. Küfür denetimi uygulanır; saatte en çok 30 mesaj.",
          "appFeature": null
        },
        "x-hadi-scope": [
          "bot:post"
        ],
        "x-hadi-risk": "R3",
        "x-hadi-services": [
          "api_bots"
        ],
        "security": [
          {
            "DPoP": [
              "bot:post"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/HadiVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Message, max 1,000 chars. Appears in the community chat with the bot name and app label.",
                    "x-hadi-tr": "Mesaj, en çok 1.000 karakter. Topluluk sohbetinde bot adıyla ve uygulama etiketiyle görünür."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "example": {
                  "id": "m_7f3k",
                  "status": "sent"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "409": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "428": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          },
          "503": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "DPoP": {
        "type": "oauth2",
        "description": "client_credentials + private_key_jwt; DPoP-bound (RFC 9449).",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://auth.hadisosyal.com/token",
            "scopes": {
              "public:read": "Public data",
              "bot:post": "Post as an installed community bot (installation_id)"
            }
          }
        }
      }
    },
    "parameters": {
      "HadiVersion": {
        "name": "HADI-Version",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "2027-01-15"
          ]
        },
        "description": "API version (dated)."
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{8,64}$"
        },
        "description": "Required for writes; the same key returns the same response for 24 h (different body → 422)."
      }
    },
    "responses": {
      "Problem": {
        "description": "RFC 9457 problem details",
        "content": {
          "application/problem+json": {
            "schema": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "format": "uri"
                },
                "title": {
                  "type": "string"
                },
                "status": {
                  "type": "integer"
                },
                "detail": {
                  "type": "string"
                },
                "instance": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "title",
                "status"
              ]
            }
          }
        }
      }
    }
  }
}
