{
  "openapi": "3.1.0",
  "info": {
    "title": "Leadspin API",
    "version": "1.0.0",
    "description": "Extract local businesses worldwide with verified contact details."
  },
  "servers": [{ "url": "https://leadspin.app" }],
  "paths": {
    "/api/discover": {
      "get": {
        "operationId": "discoverLeads",
        "summary": "Check how many leads Leadspin has for a niche in a city.",
        "parameters": [
          { "name": "niche", "in": "query", "required": true, "schema": { "type": "string" } },
          { "name": "city", "in": "query", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "Lead availability summary and a URL to preview and export.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": { "type": "integer" },
                    "validLeads": { "type": "integer" },
                    "url": { "type": "string" },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/search": {
      "post": {
        "operationId": "searchLeads",
        "summary": "Run a lead search and get a preview.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["niche", "city"],
                "properties": {
                  "niche": { "type": "string" },
                  "city": { "type": "string" },
                  "country": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Search preview with lead counts." }
        }
      }
    }
  }
}
