{
  "openapi": "3.1.0",
  "info": {
    "title": "Notunuver Açık API",
    "version": "1.0.0",
    "summary": "Marka Cevap Skoru ve sektör sıralaması — CC BY 4.0, atıf zorunlu.",
    "description": "Kamuya açık, salt okunur veri. Her yanıt `X-License: CC BY 4.0` başlığı ve gövdede `license`/`attribution` alanları taşır; veriyi kullanırken `attribution` metnini ve bağlantıyı gösterin. Hız sınırı: IP başına 60 istek/dk (aşımda 429 + Retry-After). CORS: tüm kaynaklara açık. Kişisel veri yok; not gövdeleri bu API'de yer almaz.",
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    },
    "contact": {
      "url": "https://notunuver.net/metodoloji"
    },
    "x-mcp": {
      "url": "https://notunuver.net/api/mcp",
      "discovery": "https://notunuver.net/.well-known/mcp.json",
      "transport": "streamable-http",
      "note": "Aynı veri MCP araçlarıyla da sunulur (salt okunur, kimlik doğrulama yok)."
    }
  },
  "servers": [
    {
      "url": "https://notunuver.net/api/v1"
    }
  ],
  "paths": {
    "/brands/{slug}": {
      "get": {
        "operationId": "getBrand",
        "summary": "Marka çekirdeği + son dönem metrikleri + Cevap Skoru",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Marka slug'ı (/marka/{slug})"
          }
        ],
        "responses": {
          "200": {
            "description": "Marka",
            "headers": {
              "X-License": {
                "schema": {
                  "type": "string",
                  "const": "CC BY 4.0"
                }
              },
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string",
                  "const": "*"
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Brand"
                }
              }
            }
          },
          "404": {
            "description": "Marka yok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Hız sınırı",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rankings/{sector}": {
      "get": {
        "operationId": "getRankings",
        "summary": "Sektör sıralaması (Cevap Skoru azalan)",
        "parameters": [
          {
            "name": "sector",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Sektör slug'ı"
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            },
            "description": "ISO hafta yyyy-ww; verilmezse son dönem"
          }
        ],
        "responses": {
          "200": {
            "description": "Sıralama",
            "headers": {
              "X-License": {
                "schema": {
                  "type": "string",
                  "const": "CC BY 4.0"
                }
              },
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string",
                  "const": "*"
                }
              },
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Rankings"
                }
              }
            }
          },
          "404": {
            "description": "Sektör yok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Hız sınırı",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "enum": [
              "not_found",
              "rate_limited",
              "bad_request",
              "internal"
            ]
          },
          "license": {
            "type": "string"
          }
        }
      },
      "License": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "const": "CC BY 4.0"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Methodology": {
        "type": "object",
        "properties": {
          "version": {
            "type": "string",
            "examples": [
              "v1"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "min_notes": {
            "type": "integer"
          },
          "window_days": {
            "type": "integer"
          }
        }
      },
      "Brand": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "legal_name",
          "website",
          "sector",
          "status",
          "status_label",
          "verified_domain",
          "wikidata_qid",
          "same_as",
          "answer_score",
          "metrics",
          "published_note_count",
          "url",
          "methodology",
          "license",
          "attribution",
          "updated_at"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "legal_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "sector": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "rankings_url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "unclaimed",
              "claim_pending",
              "claimed",
              "suspended"
            ]
          },
          "status_label": {
            "type": "string"
          },
          "verified_domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "wikidata_qid": {
            "type": [
              "string",
              "null"
            ]
          },
          "same_as": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "answer_score": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100,
            "description": "null = Yetersiz veri"
          },
          "metrics": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "period": {
                "type": "string"
              },
              "window_days": {
                "type": "integer"
              },
              "note_count": {
                "type": "integer"
              },
              "response_rate": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "avg_first_response_hours": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "resolution_rate": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "avg_rating": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "computed_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "published_note_count": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "methodology": {
            "$ref": "#/components/schemas/Methodology"
          },
          "license": {
            "$ref": "#/components/schemas/License"
          },
          "attribution": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Rankings": {
        "type": "object",
        "required": [
          "sector",
          "period",
          "available_periods",
          "count",
          "items",
          "url",
          "methodology",
          "license",
          "attribution"
        ],
        "properties": {
          "sector": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "period": {
            "type": "string"
          },
          "available_periods": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "count": {
            "type": "integer"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "rank",
                "slug",
                "name",
                "status",
                "answer_score",
                "url"
              ],
              "properties": {
                "rank": {
                  "type": "integer"
                },
                "slug": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "answer_score": {
                  "type": "number"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "methodology": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Methodology"
              },
              {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string"
                  }
                }
              }
            ]
          },
          "license": {
            "$ref": "#/components/schemas/License"
          },
          "attribution": {
            "type": "string"
          }
        }
      }
    }
  }
}