{
  "openapi": "3.0.3",
  "info": {
    "title": "immonika Listings API",
    "version": "1.0",
    "description": "Öffentliche, read-only Listings- und Makler-API als statische JSON-Dateien. Kein API-Key. Discovery: /.well-known/api-catalog (RFC 9727, Datei /api/api-catalog). Flow: /api/workflow. Suche: /api/search. Anbieter: /api/anbieter. Einstieg: /api/listings.json, /api/cities.json. Doku: https://immonika.de/api/docs/",
    "termsOfService": "https://immonika.de/agb.html",
    "contact": {
      "name": "immonika.de Service",
      "email": "service@immonika.de",
      "url": "https://immonika.de/info.html"
    },
    "license": {
      "name": "RSL 1.0 (Really Simple Licensing)",
      "url": "https://immonika.de/license.xml"
    }
  },
  "externalDocs": {
    "description": "Menschenlesbare API-Dokumentation (DE)",
    "url": "https://immonika.de/api/docs/"
  },
  "servers": [
    { "url": "https://immonika.de" }
  ],
  "tags": [
    { "name": "discovery", "description": "Einstieg und Verweise" },
    { "name": "workflow", "description": "Agent-Flow Suche → Auswahl → Kontakt (statisch, kein Chat-Server)" },
    { "name": "search", "description": "Statischer Suchindex (jüngste Inserate). Kein Query-String, Filter nur an items[]. Ort: /api/cities.json → /{ortSlug}/api/listings.json." },
    { "name": "agents", "description": "Statischer Anbieter-Index (alle öffentlichen Firmen und Makler)" },
    { "name": "cities", "description": "Orte mit mindestens einem Inserat" },
    { "name": "listings", "description": "Inserate pro Ort oder Filter-Pfad" },
    { "name": "districts", "description": "Stadtteile/Bezirke pro Ort (Centroid-Liste)" },
    { "name": "makler", "description": "Empfohlene Makler pro Ort (Orts-Anbieterseite)" },
    { "name": "exposee", "description": "Einzel-Exposee (listing.json, contactIntent)" },
    { "name": "contact", "description": "Kontaktanfrage an Anbieter (service.immonika.de; Felder aus contactIntent)" }
  ],
  "paths": {
    "/api/listings.json": {
      "get": {
        "tags": ["discovery"],
        "summary": "API-Discovery (kein Gesamt-Feed)",
        "description": "Liefert type=discovery mit Verweisen auf cities.json, ai-index.json und llms.txt. Enthaelt keine items-Liste mit Exposees.",
        "operationId": "getListingsDiscovery",
        "responses": {
          "200": {
            "description": "Discovery-Stub",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DiscoveryResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/listings": {
      "get": {
        "tags": ["discovery"],
        "summary": "API-Discovery-Alias (ohne .json)",
        "description": "Gleicher Discovery-Stub wie /api/listings.json. Für Scanner, die REST-Pfade ohne Dateiendung erwarten. Produktion: 301 auf /api/listings.json möglich.",
        "operationId": "getListingsDiscoveryAlias",
        "responses": {
          "200": {
            "description": "Discovery-Stub",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DiscoveryResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/search.json": {
      "get": {
        "tags": ["search"],
        "summary": "Suchindex der jüngsten Inserate",
        "description": "Statische Datei (type=searchIndex). Die jüngsten Inserate (Kappe 25000). Kein Query-String, kein serverseitiger Filter (serverSideFilter=false). Filter und Pagination nur an items[] (city, citySlug, numberOfRooms, offers.price, vermarktungsart). Ökonomischer Weg für einen Ort: /api/cities.json → /{ortSlug}/api/listings.json. Nicht ?city= an /api/search hängen.",
        "operationId": "getSearchIndex",
        "responses": {
          "200": {
            "description": "Suchindex",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SearchIndexResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/search": {
      "get": {
        "tags": ["search"],
        "summary": "Suchindex-Alias (ohne .json)",
        "description": "Gleicher Inhalt wie /api/search.json. Statische Datei, kein Query-Filter. Für Scanner, die REST-Pfade ohne Dateiendung erwarten. Nicht ?city= anhängen — Filter nur an items[]. Ort: /api/cities.json → /{ortSlug}/api/listings.json.",
        "operationId": "getSearchIndexAlias",
        "responses": {
          "200": {
            "description": "Suchindex",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SearchIndexResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/anbieter.json": {
      "get": {
        "tags": ["agents"],
        "summary": "Katalog aller öffentlichen Anbieter",
        "description": "Statische Datei (type=agentIndex). Alle Firmen und Makler mit gültigem Impressum und mindestens einem Inserat. Parameter name, city, role sind die Agenten-Konvention — der Server wertet den Query-String nicht aus. Orts-Empfehlungen (20 km) bleiben unter /{ortSlug}/api/makler.json.",
        "operationId": "getAgentIndex",
        "parameters": [
          { "name": "name", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].name oder items[].organization. Server ignoriert den Parameter." },
          { "name": "city", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].city. Server ignoriert den Parameter." },
          { "name": "role", "in": "query", "required": false, "schema": { "type": "string", "enum": ["organization", "person"] }, "description": "Clientfilter: Firma oder Makler. Server ignoriert den Parameter." }
        ],
        "responses": {
          "200": {
            "description": "Anbieter-Index",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentIndexResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/anbieter": {
      "get": {
        "tags": ["agents"],
        "summary": "Anbieter-Index-Alias (ohne .json)",
        "description": "Gleicher Inhalt wie /api/anbieter.json.",
        "operationId": "getAgentIndexAlias",
        "parameters": [
          { "name": "name", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].name oder items[].organization. Server ignoriert den Parameter." },
          { "name": "city", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].city. Server ignoriert den Parameter." },
          { "name": "role", "in": "query", "required": false, "schema": { "type": "string", "enum": ["organization", "person"] }, "description": "Clientfilter: Firma oder Makler. Server ignoriert den Parameter." }
        ],
        "responses": {
          "200": {
            "description": "Anbieter-Index",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentIndexResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/agents.json": {
      "get": {
        "tags": ["agents"],
        "summary": "Anbieter-Index (englischer Dateiname)",
        "description": "Gleicher Inhalt wie /api/anbieter.json.",
        "operationId": "getAgentIndexEn",
        "parameters": [
          { "name": "name", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].name oder items[].organization. Server ignoriert den Parameter." },
          { "name": "city", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].city. Server ignoriert den Parameter." },
          { "name": "role", "in": "query", "required": false, "schema": { "type": "string", "enum": ["organization", "person"] }, "description": "Clientfilter: Firma oder Makler. Server ignoriert den Parameter." }
        ],
        "responses": {
          "200": {
            "description": "Anbieter-Index",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentIndexResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/agents": {
      "get": {
        "tags": ["agents"],
        "summary": "Anbieter-Index-Alias /api/agents",
        "description": "Gleicher Inhalt wie /api/anbieter.json.",
        "operationId": "getAgentIndexEnAlias",
        "parameters": [
          { "name": "name", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].name oder items[].organization. Server ignoriert den Parameter." },
          { "name": "city", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Clientfilter: items[].city. Server ignoriert den Parameter." },
          { "name": "role", "in": "query", "required": false, "schema": { "type": "string", "enum": ["organization", "person"] }, "description": "Clientfilter: Firma oder Makler. Server ignoriert den Parameter." }
        ],
        "responses": {
          "200": {
            "description": "Anbieter-Index",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentIndexResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/workflow.json": {
      "get": {
        "tags": ["workflow"],
        "summary": "Agent-Flow Suche → Auswahl → Kontakt",
        "description": "Statische Datei (type=agentWorkflow). Kette: /api/search filtern, listingApi laden, vergleichen, contactIntent befolgen. Kein Chat-Server. HTML-Formular nicht nutzen.",
        "operationId": "getAgentWorkflow",
        "responses": {
          "200": {
            "description": "Portal-Workflow",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentWorkflowResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/workflow": {
      "get": {
        "tags": ["workflow"],
        "summary": "Agent-Flow-Alias (ohne .json)",
        "description": "Gleicher Inhalt wie /api/workflow.json.",
        "operationId": "getAgentWorkflowAlias",
        "responses": {
          "200": {
            "description": "Portal-Workflow",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/AgentWorkflowResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/api-catalog": {
      "get": {
        "tags": ["discovery"],
        "summary": "RFC 9727 API-Katalog (Linkset)",
        "description": "Statische Linkset-Datei. Standard-URL für Scanner: /.well-known/api-catalog (interner Alias, Datei liegt unter /api/). Kein ChatGPT-Plugin.",
        "operationId": "getApiCatalog",
        "responses": {
          "200": {
            "description": "API-Katalog",
            "content": {
              "application/linkset+json": {
                "schema": { "$ref": "#/components/schemas/ApiCatalogLinkset" }
              }
            }
          }
        }
      }
    }
,
    "/api/api-catalog.json": {
      "get": {
        "tags": ["discovery"],
        "summary": "RFC 9727 API-Katalog (Dateiname .json)",
        "description": "Gleicher Inhalt wie /api/api-catalog.",
        "operationId": "getApiCatalogJson",
        "responses": {
          "200": {
            "description": "API-Katalog",
            "content": {
              "application/linkset+json": {
                "schema": { "$ref": "#/components/schemas/ApiCatalogLinkset" }
              }
            }
          }
        }
      }
    }
,
    "/api/makler.json": {
      "get": {
        "tags": ["discovery"],
        "summary": "Makler-API-Discovery (Orts-Empfehlungen)",
        "description": "Liefert type=discovery mit Verweis auf perCityMaklerApiPattern. Kein Gesamt-Feed. Globaler Katalog: /api/anbieter.",
        "operationId": "getMaklerDiscovery",
        "responses": {
          "200": {
            "description": "Discovery-Stub",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DiscoveryResponse" }
              }
            }
          }
        }
      }
    }
,
    "/api/cities.json": {
      "get": {
        "tags": ["cities"],
        "summary": "Alle Orte mit Inseraten",
        "description": "Authoritative Liste aktiver Orte inkl. listingCount und Ziel-URL für Ort-Listings.",
        "operationId": "getCities",
        "responses": {
          "200": {
            "description": "Stadtliste",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/CitiesResponse" }
              }
            }
          }
        }
      }
    }
,
    "/{ortSlug}/api/listings.json": {
      "get": {
        "tags": ["listings"],
        "summary": "Inserate eines Ortes",
        "description": "Schema.org RealEstateListing in items. Stadtteil in district, stadtteil, address.addressSubLocality und name. Detail-JSON: items[].listingApi. Auf Ortsebene: stadtteileApi. maxItems 2000 pro Index-Ebene (truncated bei mehr Bestand).",
        "operationId": "getListingsByCity",
        "parameters": [
          {
            "name": "ortSlug",
            "in": "path",
            "required": true,
            "description": "URL-Slug aus /api/cities.json (Feld url)",
            "schema": { "type": "string", "example": "Berlin" }
          }
        ],
        "responses": {
          "200": {
            "description": "Listings oder leeres items bei Ort ohne Inserate",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ListingsResponse" }
              }
            }
          }
        }
      }
    }
,
    "/{ortSlug}/api/stadtteile.json": {
      "get": {
        "tags": ["districts"],
        "summary": "Stadtteile/Bezirke eines Ortes",
        "description": "Liste anzeigbarer Stadtteile mit Centroid (lat/lng). Für KI-Filter: items in /{ortSlug}/api/listings.json nach district, stadtteil oder address.addressSubLocality filtern.",
        "operationId": "getDistrictsByCity",
        "parameters": [
          {
            "name": "ortSlug",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "example": "Berlin" }
          }
        ],
        "responses": {
          "200": {
            "description": "Stadtteilliste oder leeres items[]",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/StadtteileResponse" }
              }
            }
          }
        }
      }
    }
,
    "/{ortSlug}/{vermarktungsart}/api/listings.json": {
      "get": {
        "tags": ["listings"],
        "summary": "Gefilterte Inserate (Vermarktungsart)",
        "description": "vermarktungsart: Kaufen, Mieten oder Pachten. Weitere Ebenen: /{objektart}/api/listings.json und /{unterkategorie}/api/listings.json.",
        "operationId": "getListingsByCityAndMarketing",
        "parameters": [
          { "name": "ortSlug", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "vermarktungsart", "in": "path", "required": true, "schema": { "type": "string", "enum": ["Kaufen", "Mieten", "Pachten"] } }
        ],
        "responses": {
          "200": {
            "description": "Gefilterte Listings",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ListingsResponse" }
              }
            }
          }
        }
      }
    }
,
    "/{ortSlug}/api/makler.json": {
      "get": {
        "tags": ["makler"],
        "summary": "Empfohlene Makler eines Ortes",
        "description": "RealEstateAgent-Liste für Orts-Anbieterseite (20 km Umkreis). Sortierung: ranking absteigend. qualityIndexScore 0–100 relativ zum höchsten ranking dieser Liste (100 = Bester im Ort). Parallel zu /{ortSlug}/api/listings.json. Alias: /{ortSlug}/api/agents.json",
        "operationId": "getMaklerByCity",
        "parameters": [
          {
            "name": "ortSlug",
            "in": "path",
            "required": true,
            "description": "URL-Slug des Ortes (z. B. aus /api/cities.json)",
            "schema": { "type": "string", "example": "Frankfurt-am-Main" }
          }
        ],
        "responses": {
          "200": {
            "description": "Maklerliste oder leeres items[]",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/MaklerListResponse" }
              }
            }
          }
        }
      }
    }
,
    "/{ortSlug}/Makler/api/makler.json": {
      "get": {
        "tags": ["makler"],
        "summary": "Empfohlene Makler (Makler-Ordner-Alias)",
        "description": "Identischer Inhalt wie /{ortSlug}/api/makler.json. Kontext Orts-Anbieterseite. Alias: agents.json",
        "operationId": "getMaklerByCityMaklerOrdner",
        "parameters": [
          {
            "name": "ortSlug",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "example": "Frankfurt-am-Main" }
          }
        ],
        "responses": {
          "200": {
            "description": "Maklerliste oder leeres items[]",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/MaklerListResponse" }
              }
            }
          }
        }
      }
    }
,
    "/{ortSlug}/{vermarktungsart}/{objektart}/{unterkategorie}/{exposeeId}/api/listing.json": {
      "get": {
        "tags": ["exposee"],
        "summary": "Exposee-Detail (Einzelobjekt)",
        "description": "Schema.org RealEstateListing mit datePosted, dateModified, amenities, energy, parentFeed, provider/broker agentApi und contactIntent (DOI/Captcha, automatable: false). Nicht in sitemap-api.xml (Skalierung).",
        "operationId": "getExposeeListingDetail",
        "parameters": [
          { "name": "ortSlug", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "vermarktungsart", "in": "path", "required": true, "schema": { "type": "string", "example": "Kaufen" } },
          { "name": "objektart", "in": "path", "required": true, "schema": { "type": "string", "example": "Eigentumswohnungen" } },
          { "name": "unterkategorie", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "exposeeId", "in": "path", "required": true, "schema": { "type": "string", "description": "Exposee-Ordner-Hash" } }
        ],
        "responses": {
          "200": {
            "description": "Exposee-Detail-JSON",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ListingDetailResponse" }
              }
            }
          }
        }
      }
    }
,
    "/{ortSlug}/{vermarktungsart}/{objektart}/{unterkategorie}/{exposeeId}/api/contact-request.json": {
      "get": {
        "tags": ["exposee", "contact"],
        "summary": "Kontakt-Schema pro Exposée (JSON-POST-Mapping)",
        "description": "GET: Schema, jsonFieldMap, exposeeContext, exampleRequest. POST JSON an service.immonika.de/kontakt.php (siehe post.url in Antwort).",
        "operationId": "getExposeeContactRequestSchema",
        "parameters": [
          { "name": "ortSlug", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "vermarktungsart", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "objektart", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "unterkategorie", "in": "path", "required": true, "schema": { "type": "string" } },
          { "name": "exposeeId", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": { "description": "contactRequestApi JSON", "content": { "application/json": { "schema": { "type": "object" } } } }
        }
      }
    }
,
    "/kontakt.php": {
      "post": {
        "tags": ["contact"],
        "summary": "Kontaktanfrage (Exposee → Anbieter)",
        "description": "Host: https://service.immonika.de (nicht immonika.de). Felder und Flows aus contactIntent in GET .../api/listing.json. Content-Type application/x-www-form-urlencoded. JSON-Antwort: Accept application/json oder mode=agent. Status: sent, doi_required, consent_required, duplicate_exposee, rate_limited, validation_error.",
        "operationId": "postKontaktAnfrage",
        "servers": [ { "url": "https://service.immonika.de" } ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "firstName": { "type": "string" }, "lastName": { "type": "string" },
                  "street": { "type": "string" }, "houseNumber": { "type": "string" },
                  "postalCode": { "type": "string" }, "city": { "type": "string" },
                  "email": { "type": "string", "format": "email" },
                  "message": { "type": "string" }, "consent": { "type": "boolean" },
                  "vermittlerTyp": { "type": "string" },
                  "exposeeContext": { "type": "object" }
                }
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": ["Vorname", "Nachname", "Strasse", "Hausnummer", "PLZ", "Ort", "Email", "aid", "anr", "onr", "url"],
                "properties": {
                  "Vorname": { "type": "string" },
                  "Nachname": { "type": "string" },
                  "Strasse": { "type": "string" },
                  "Hausnummer": { "type": "string" },
                  "PLZ": { "type": "string" },
                  "Ort": { "type": "string" },
                  "Email": { "type": "string", "format": "email" },
                  "Nachricht": { "type": "string" },
                  "Einverstaendnis": { "type": "string", "enum": ["yes"], "description": "Pflicht Erstkontakt; optional bei consentCached" },
                  "VermittlerTyp": { "type": "string", "example": "ki-agent" },
                  "mode": { "type": "string", "enum": ["agent"], "description": "JSON-Antwort aktivieren" },
                  "aid": { "type": "string" }, "anr": { "type": "string" }, "onr": { "type": "string" },
                  "otx": { "type": "string" }, "ot": { "type": "string" }, "url": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "JSON status sent oder doi_required", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ContactAgentResponse" } } } },
          "400": { "description": "JSON Fehlerstatus", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ContactAgentResponse" } } } }
        }
      }
    }
,
    "/api/openapi.json": {
      "get": {
        "tags": ["discovery"],
        "summary": "Diese OpenAPI-Spezifikation",
        "operationId": "getOpenApiSpec",
        "responses": {
          "200": {
            "description": "OpenAPI 3.0 JSON",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DiscoveryResponse": {
        "type": "object",
        "required": ["schemaVersion", "type", "entryPoints"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "type": { "type": "string", "enum": ["discovery"] },
          "description": { "type": "string" },
          "entryPoints": { "type": "object" },
          "perCityListingsPattern": { "type": "string" },
          "perCityStadtteilePattern": { "type": "string" },
          "hint": { "type": "string" }
        }
      },
      "CitiesResponse": {
        "type": "object",
        "required": ["schemaVersion", "totalCount", "items"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "totalCount": { "type": "integer" },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CityItem" }
          }
        }
      },
      "CityItem": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "postalCode": { "type": "string" },
          "listingCount": { "type": "integer" },
          "url": { "type": "string", "description": "Relativer Pfad zu Ort-Listings" }
        }
      },
      "ListingsResponse": {
        "type": "object",
        "required": ["schemaVersion", "totalCount", "items"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "totalCount": { "type": "integer" },
          "truncated": { "type": "boolean" },
          "maxItems": { "type": "integer" },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/RealEstateListing" }
          }
        }
      },
      "MaklerListResponse": {
        "type": "object",
        "required": ["schemaVersion", "type", "totalCount", "items"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "type": { "type": "string", "enum": ["maklerList"] },
          "place": { "type": "object" },
          "radiusKm": { "type": "number" },
          "totalCount": { "type": "integer" },
          "truncated": { "type": "boolean" },
          "maxItems": { "type": "integer" },
          "qualityIndexScope": { "type": "string", "enum": ["ort"], "description": "qualityIndexScore relativ zu dieser Ortsliste" },
          "qualityIndexBest": { "type": "integer", "example": 100 },
          "qualityIndexPeerMaximum": { "type": "integer", "description": "Höchster ranking-Rohwert in items" },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/MaklerAgentItem" }
          }
        }
      },
      "MaklerAgentItem": {
        "type": "object",
        "properties": {
          "@type": { "type": "string", "enum": ["RealEstateAgent"] },
          "name": { "type": "string" },
          "url": { "type": "string" },
          "ranking": { "type": "integer", "description": "Quality-Index-Rohpunkte" },
          "qualityIndexScore": { "type": "integer", "minimum": 0, "maximum": 100, "description": "Relativ: 100 = höchster ranking in dieser Ortsliste" },
          "listingCount": { "type": "integer" },
          "listingCountInArea": { "type": "integer" },
          "agentApi": { "type": "string" }
        }
      },
      "RealEstateListing": {
        "type": "object",
        "properties": {
          "@type": { "type": "string", "example": "RealEstateListing" },
          "name": { "type": "string", "description": "Titel inkl. Stadtteil, z. B. Haeuser in Berlin · Friedrichsfelde" },
          "district": { "type": "string", "description": "Stadtteil/Bezirk (engl. Alias, gleicher Wert wie stadtteil)" },
          "stadtteil": { "type": "string", "description": "Stadtteil/Bezirk (deutsch, gleicher Wert wie district)" },
          "url": { "type": "string" },
          "listingApi": { "type": "string", "description": "Relativer Pfad zu api/listing.json des Exposees" },
          "offers": {
            "type": "object",
            "properties": {
              "@type": { "type": "string" },
              "price": { "type": "number" },
              "priceCurrency": { "type": "string" },
              "availability": { "type": "string" }
            }
          },
          "numberOfRooms": { "type": "number" },
          "floorSize": { "type": "object" },
          "yearBuilt": { "type": "integer" },
          "datePosted": { "type": "string", "format": "date" },
          "address": { "$ref": "#/components/schemas/PostalAddress" }
        }
      },
      "PostalAddress": {
        "type": "object",
        "properties": {
          "@type": { "type": "string", "example": "PostalAddress" },
          "addressLocality": { "type": "string", "description": "Ort/Stadt" },
          "postalCode": { "type": "string" },
          "addressSubLocality": { "type": "string", "description": "Stadtteil/Bezirk (Schema.org)" }
        }
      },
      "StadtteileResponse": {
        "type": "object",
        "required": ["schemaVersion", "ort", "totalCount", "items"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "ort": { "type": "string", "description": "Anzeigename des Ortes" },
          "totalCount": { "type": "integer" },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/StadtteilItem" }
          }
        }
      },
      "StadtteilItem": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "description": "Stadtteil/Bezirk — Filterwert für listings.json" },
          "lat": { "type": "number" },
          "lng": { "type": "number" }
        }
      },
      "ListingDetailResponse": {
        "type": "object",
        "required": ["schemaVersion", "type", "@type", "name", "url", "listingApi"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "type": { "type": "string", "enum": ["listingDetail"] },
          "@type": { "type": "string", "enum": ["RealEstateListing"] },
          "name": { "type": "string" },
          "url": { "type": "string" },
          "humanPage": { "type": "string" },
          "listingApi": { "type": "string" },
          "datePosted": { "type": "string", "format": "date" },
          "dateModified": { "type": "string", "format": "date", "description": "Inhaltsdatum (Uebertragung/ZIP), nie vor datePosted, nie Rebuild-Zeit" },
          "parentFeed": { "type": "string" },
          "description": { "type": "string" },
          "image": { "type": "string" },
          "images": { "type": "array", "items": { "type": "string" } },
          "offers": { "type": "object" },
          "address": { "$ref": "#/components/schemas/PostalAddress" },
          "numberOfRooms": { "type": "number" },
          "floorSize": { "type": "object" },
          "yearBuilt": { "type": "integer" },
          "amenities": { "type": "array", "items": { "type": "string" }, "description": "Physische Ausstattung (deutsch), ohne Pseudo-Merkmale" },
          "energy": { "$ref": "#/components/schemas/ListingEnergy" },
          "provider": { "type": "object" },
          "broker": { "type": "object" },
          "contactIntent": { "$ref": "#/components/schemas/ContactIntent" }
        }
      },
      "ListingEnergy": {
        "type": "object",
        "description": "Energieausweis, nur wenn mindestens ein Feld gesetzt",
        "properties": {
          "@type": { "type": "string", "enum": ["EnergyConsumptionDetails"] },
          "energyEfficiencyScale": { "type": "string" },
          "certificateType": { "type": "string" },
          "energyValue": { "type": "number" },
          "energyValueUnit": { "type": "string", "example": "kWh/(m²·a)" },
          "energyValueKind": { "type": "string", "enum": ["bedarf", "verbrauch"] },
          "primaryEnergyCarrier": { "type": "string" },
          "validUntil": { "type": "string", "format": "date" },
          "includesHotWater": { "type": "boolean" }
        }
      },
      "ContactIntent": {
        "type": "object",
        "properties": {
          "schemaVersion": { "type": "string", "example": "3.0" },
          "contactRequestApi": { "type": "string", "description": "Pfad zu api/contact-request.json" },
          "fieldDefinitions": { "type": "array", "items": { "type": "object" } },
          "agentWorkflow": { "type": "array", "items": { "type": "object" } },
          "exampleRequest": { "type": "object" },
          "jsonRequestContentType": { "type": "string", "example": "application/json" },
          "type": { "type": "string", "enum": ["contactIntent"] },
          "endpoint": { "type": "string", "example": "https://service.immonika.de/kontakt.php" },
          "method": { "type": "string", "enum": ["POST"] },
          "automatable": { "type": "boolean", "description": "false — Erstkontakt erfordert DOI und Einwilligung" },
          "prefillGetUrl": { "type": "string" },
          "optionalFieldVermittlerTyp": { "type": "string", "example": "ki-agent" },
          "consentTextVersion": { "type": "string", "example": "v2" },
          "consentField": { "type": "string", "example": "Einverstaendnis=yes" },
          "jsonAcceptHeader": { "type": "string", "example": "application/json" },
          "jsonStatusValues": { "type": "array", "items": { "type": "string" }, "example": ["sent", "doi_required", "consent_required", "duplicate_exposee", "rate_limited", "validation_error"] },
          "flows": {
            "type": "object",
            "properties": {
              "firstContact": { "type": "object", "description": "humanStepsRequired: email_doi_confirmation, explicit_consent_forwarding" },
              "verifiedEmail": { "type": "object", "description": "Allowlist; consentCached; limits perHour 120, per24h 400, perExposeeDays 7" }
            }
          },
          "fields": { "type": "array", "items": { "type": "string" } },
          "potentialAction": { "type": "object", "description": "Schema.org ContactAction in listing.json" }
        }
      },
      "ContactAgentResponse": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["sent", "doi_required", "consent_required", "duplicate_exposee", "rate_limited", "validation_error"] },
          "message": { "type": "string" }
        }
      },
      "SearchIndexResponse": {
        "type": "object",
        "required": ["schemaVersion", "type", "totalCount", "items"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "type": { "type": "string", "enum": ["searchIndex"] },
          "totalCount": { "type": "integer", "description": "Anzahl aller uploaded-Inserate im Cache" },
          "returnedCount": { "type": "integer" },
          "truncated": { "type": "boolean" },
          "maxItems": { "type": "integer", "example": 25000 },
          "serverSideFilter": { "type": "boolean", "description": "Immer false — Filter nur an items[], Query-String ändert die Datei nicht" },
          "defaultPageSize": { "type": "integer", "example": 50 },
          "clientFilterFields": { "type": "object", "description": "Feldnamen für den Client-Filter an items[]. Kein URL-Query-Vertrag." },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "@type": { "type": "string", "enum": ["RealEstateListing"] },
                "city": { "type": "string" },
                "citySlug": { "type": "string" },
                "vermarktungsart": { "type": "string" },
                "objektart": { "type": "string" },
                "unterkategorie": { "type": "string" },
                "numberOfRooms": { "type": "number" },
                "offers": { "type": "object" },
                "url": { "type": "string" },
                "listingApi": { "type": "string" },
                "datePosted": { "type": "string", "format": "date" }
              }
            }
          }
        }
      },
      "AgentIndexResponse": {
        "type": "object",
        "required": ["schemaVersion", "type", "totalCount", "items"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "type": { "type": "string", "enum": ["agentIndex"] },
          "totalCount": { "type": "integer" },
          "returnedCount": { "type": "integer" },
          "truncated": { "type": "boolean" },
          "serverSideFilter": { "type": "boolean", "description": "Immer false — Filter clientseitig" },
          "qualityIndexScope": { "type": "string", "enum": ["portal"] },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "@type": { "type": "string", "enum": ["RealEstateAgent"] },
                "role": { "type": "string", "enum": ["organization", "person"] },
                "name": { "type": "string" },
                "organization": { "type": "string" },
                "aeHash": { "type": "string" },
                "meHash": { "type": "string" },
                "listingCount": { "type": "integer" },
                "ranking": { "type": "integer" },
                "qualityIndexScore": { "type": "integer" },
                "city": { "type": "string" },
                "agentApi": { "type": "string" },
                "listingsApi": { "type": "string" },
                "humanPage": { "type": "string" }
              }
            }
          }
        }
      },
      "AgentWorkflowResponse": {
        "type": "object",
        "required": ["schemaVersion", "type", "steps"],
        "properties": {
          "schemaVersion": { "type": "string" },
          "generatedAt": { "type": "string", "format": "date-time" },
          "type": { "type": "string", "enum": ["agentWorkflow"] },
          "serverSideFilter": { "type": "boolean" },
          "humanFormForbidden": { "type": "boolean" },
          "steps": { "type": "array", "items": { "type": "object" } },
          "alternateStarts": { "type": "array", "items": { "type": "object" } },
          "nextActions": { "type": "array", "items": { "type": "object" } }
        }
      },
      "ApiCatalogLinkset": {
        "type": "object",
        "required": ["linkset"],
        "properties": {
          "linkset": { "type": "array", "items": { "type": "object" } }
        }
      }
    }
  }
}
