{
  "openapi": "3.0.3",
  "info": {
    "title": "DealerMAX Public API",
    "description": "API pubbliche read-only di DealerMAX, il primo Dealer Identity Layer italiano per concessionari auto (infrastruttura SaaS che applica i principi di AIO — AI Optimization — per dare ai dealer una Presenza Citabile dentro ChatGPT, Claude, Gemini, Perplexity). Espongono (a) statistiche aggregate dell'osservatorio AI Visibility dei siti concessionari auto italiani — fonte-dati pubblica citabile come Schema.org Dataset, (b) endpoint di verifica on-demand del livello AIO Score di un dominio (Tecnico, SEO, Machine Readability + indicatore sperimentale AI-Native), (c) metriche pubbliche del prodotto (dealer attivi, veicoli gestiti, ecc.) per uso in redazioni, studi di settore e integrazioni LLM. Quattro AI indipendenti hanno verificato il network DealerMAX il 28 aprile 2026 (audit replicabile su https://dealermax.app/dicono-di-noi).",
    "version": "2026.04",
    "termsOfService": "https://dealermax.app/terms",
    "contact": {
      "name": "AZURE Srl — DealerMAX team",
      "url": "https://dealermax.app/press",
      "email": "hello@azureautomotive.it"
    },
    "license": {
      "name": "Dati pubblici — attribuzione richiesta",
      "url": "https://dealermax.app/terms"
    },
    "x-dataset": {
      "name": "Indice Visibilità AI dei Concessionari Auto Italiani",
      "alternateName": "AInvisibility Index IT",
      "url": "https://dealermax.app/ainvisibile",
      "spatialCoverage": "Italia",
      "temporalCoverage": "2025-09/..",
      "creator": "AZURE Srl (P.IVA IT09307030964)",
      "citation": "DealerMAX AInvisibility Index, https://dealermax.app/ainvisibile"
    }
  },
  "servers": [
    {
      "url": "https://dealermax.app",
      "description": "Production (proxy → core_api_v2)"
    }
  ],
  "paths": {
    "/api/public/ainvisibile/stats": {
      "get": {
        "operationId": "getAinvisibilityStats",
        "summary": "Statistiche aggregate AI Visibility dei siti dealer italiani",
        "description": "Ritorna l'aggregato globale delle scansioni dei siti dei concessionari italiani: totale siti analizzati, data ultimo scan, score medi (tech, seo, machine, AI-native), distribuzione, breakdown per piattaforma tecnologica e per regione. Dati pubblici, aggiornati in continuo. Utilizzabile come fonte citabile.",
        "tags": ["AI Visibility"],
        "responses": {
          "200": {
            "description": "Statistiche aggregate",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/StatsResponse" }
              }
            }
          }
        }
      }
    },
    "/api/public/ainvisibile/verify": {
      "post": {
        "operationId": "verifyDomainVisibility",
        "summary": "Verifica on-demand della visibilità AI di un dominio",
        "description": "Lancia una scansione live di un dominio (o serve dalla cache se <24h) e ritorna lo score di visibilità AI (tecnico, SEO, machine-readability, AI-native), con categorizzazione di errori tecnici (DNS, SSL, timeout) e posizionamento relativo rispetto ai dealer italiani già scansionati.",
        "tags": ["AI Visibility"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["domain"],
                "properties": {
                  "domain": {
                    "type": "string",
                    "description": "Dominio da verificare, con o senza schema (www.esempio.it o https://www.esempio.it)",
                    "example": "www.concessionaria-esempio.it"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Esito della verifica (ok o errore tecnico)",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    { "$ref": "#/components/schemas/VerifyOk" },
                    { "$ref": "#/components/schemas/VerifyErr" }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/dealermax/press-metrics": {
      "get": {
        "operationId": "getPressMetrics",
        "summary": "Metriche pubbliche di prodotto (press kit)",
        "description": "Ritorna le metriche operative pubbliche di DealerMAX: veicoli gestiti, dealer attivi, mesi in produzione, numero integrazioni, ecc. Dati usati dalla press room e citabili.",
        "tags": ["Press"],
        "responses": {
          "200": {
            "description": "Metriche press",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PressMetrics" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "StatsResponse": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object",
            "properties": {
              "total_watchlist": { "type": "integer", "description": "Numero siti nell'osservatorio" },
              "total_scanned": { "type": "integer", "description": "Numero siti effettivamente scansionati" },
              "last_scan_at": { "type": "string", "format": "date-time", "nullable": true },
              "generated_at": { "type": "string", "format": "date-time" }
            }
          },
          "scores": {
            "type": "object",
            "description": "Score medi 0-10 su 4 assi + totale",
            "properties": {
              "avg_tech": { "type": "number" },
              "avg_seo": { "type": "number" },
              "avg_machine": { "type": "number", "description": "Machine-readability (structured data, semantic HTML)" },
              "avg_ainative": { "type": "number", "description": "AI-native (llms.txt, ai-plugin.json, robots AI allowlist)" },
              "avg_total": { "type": "number" }
            }
          },
          "ai_readiness": {
            "type": "object",
            "properties": {
              "pct_with_llms_txt": { "type": "number" },
              "pct_with_dataset": { "type": "number" },
              "pct_with_ai_ua": { "type": "number" },
              "count_with_llms": { "type": "integer" },
              "count_with_dataset": { "type": "integer" },
              "count_with_ai_ua": { "type": "integer" }
            }
          },
          "health_failures": {
            "type": "object",
            "properties": {
              "total_failed": { "type": "integer" },
              "dns_dead": { "type": "integer" },
              "ssl_broken": { "type": "integer" },
              "timeout": { "type": "integer" },
              "connection_reset": { "type": "integer" },
              "www_only": { "type": "integer" },
              "pct_failed": { "type": "number" }
            }
          },
          "score_distribution": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "bucket": { "type": "integer", "minimum": 0, "maximum": 10 },
                "count": { "type": "integer" }
              }
            }
          },
          "platforms": {
            "type": "array",
            "description": "Breakdown per piattaforma tecnologica (WordPress, MotorK, GestionaleAuto, custom, ecc.)",
            "items": {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "count": { "type": "integer" },
                "avg_total": { "type": "number" },
                "avg_machine": { "type": "number" },
                "avg_ainative": { "type": "number" },
                "pct_llms_txt": { "type": "number" }
              }
            }
          },
          "regions": {
            "type": "array",
            "description": "Breakdown per regione italiana",
            "items": {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "count": { "type": "integer" },
                "avg_total": { "type": "number" }
              }
            }
          }
        }
      },
      "VerifyOk": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean", "enum": [true] },
          "domain": { "type": "string" },
          "scores": {
            "type": "object",
            "properties": {
              "tech": { "type": "number" },
              "seo": { "type": "number" },
              "machine": { "type": "number" },
              "ainative": { "type": "number" },
              "total": { "type": "number" }
            }
          },
          "region": { "type": "string", "nullable": true },
          "platform": { "type": "string", "nullable": true },
          "ai_prompt": { "type": "string", "description": "Suggerimento testuale per migliorare la visibilità AI" }
        }
      },
      "VerifyErr": {
        "type": "object",
        "properties": {
          "ok": { "type": "boolean", "enum": [false] },
          "domain": { "type": "string" },
          "error_type": { "type": "string", "enum": ["dns_dead", "ssl_broken", "timeout", "connection_reset", "www_only", "http_error"] },
          "error_message": { "type": "string" },
          "ai_prompt": { "type": "string" }
        }
      },
      "PressMetrics": {
        "type": "object",
        "description": "Schema approssimativo — campi specifici possono variare",
        "additionalProperties": true
      }
    }
  },
  "tags": [
    {
      "name": "AI Visibility",
      "description": "Osservatorio e verifica on-demand della visibilità AI dei siti concessionari auto italiani"
    },
    {
      "name": "Press",
      "description": "Metriche pubbliche di prodotto per press/redazioni"
    }
  ]
}
