{
  "openapi": "3.1.0",
  "info": {
    "title": "The Direct Index API",
    "version": "0.2",
    "description": "Agent-Direct Scores: whether AI agents can find, read and act on a business's own website. Free, open data, no authentication for reads.",
    "contact": {
      "url": "https://directindex.org/"
    }
  },
  "servers": [
    {
      "url": "https://directindex.org"
    }
  ],
  "paths": {
    "/api/scan": {
      "post": {
        "summary": "Start a scan, or return the cached result if under 24 hours old",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "example": "tasca.pt"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cached summary"
          },
          "202": {
            "description": "Scan started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobId": {
                      "type": "string"
                    },
                    "page": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limited: 30 new scans per hour per address"
          }
        }
      }
    },
    "/api/scan/{jobId}": {
      "get": {
        "summary": "Status and summary of a scan job",
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "status is queued, running, complete or errored; result holds the summary when complete"
          }
        }
      }
    },
    "/api/site/{domain}": {
      "get": {
        "summary": "Latest full report for a domain: score, findings, fixes, agent-discoverability checks",
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "belcanto.pt"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SiteReport"
          },
          "404": {
            "description": "Not scanned yet"
          }
        }
      }
    },
    "/api/city/{slug}": {
      "get": {
        "summary": "A city index: stats and every business ranked",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "lisbon"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "City index"
          },
          "404": {
            "description": "No index for this city"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "MCP server (Streamable HTTP, stateless). Tools: scan_website, get_site_report, city_leaderboard, list_cities",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    }
  }
}