{
  "openapi": "3.0.3",
  "info": {
    "title": "GREENPOW public agent-facing API",
    "version": "0.1.0",
    "description": "Minimal OpenAPI description of the public endpoints an autonomous agent or LLM can call on greenpow.com. The marketing site is intentionally read-mostly; only the contact endpoint accepts writes today, and it accepts HTML form submissions and replies with a 303 redirect to a localized confirmation page."
  },
  "servers": [
    { "url": "/", "description": "Same-origin" }
  ],
  "paths": {
    "/api/contact": {
      "post": {
        "summary": "Submit a lead or platform-access request",
        "description": "Server handler that accepts an HTML form submission and forwards leads to Pipedrive when credentials are configured, otherwise logs the submission. Responds with a 303 redirect to /{preferred_language}/contact?status=queued|sent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": { "$ref": "#/components/schemas/ContactRequest" }
            },
            "multipart/form-data": {
              "schema": { "$ref": "#/components/schemas/ContactRequest" }
            }
          }
        },
        "responses": {
          "303": {
            "description": "Redirect to /{preferred_language}/contact?status=queued (Pipedrive not configured) or ?status=sent (Pipedrive call attempted).",
            "headers": {
              "Location": {
                "schema": { "type": "string" },
                "description": "Localized confirmation URL, e.g. /en/contact?status=sent."
              }
            }
          }
        }
      }
    },
    "/{locale}/agents": {
      "get": {
        "summary": "AI Discovery hub (HTML)",
        "description": "Human- and machine-friendly entry point for agents and LLMs. Renders the primary answer, structured facts, files for agents, entities, actions, and citation rules.",
        "parameters": [
          {
            "name": "locale",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "enum": ["en", "es"] }
          }
        ],
        "responses": {
          "200": {
            "description": "HTML page.",
            "content": { "text/html": {} }
          }
        }
      }
    },
    "/.well-known/greenpow-agent.json": {
      "get": {
        "summary": "Structured facts about GREENPOW for agents",
        "responses": {
          "200": {
            "description": "Agent facts document.",
            "content": { "application/json": {} }
          }
        }
      }
    },
    "/.well-known/agent-action-manifest.json": {
      "get": {
        "summary": "Catalog of public actions available to agents",
        "responses": {
          "200": {
            "description": "Action manifest.",
            "content": { "application/json": {} }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "summary": "Short llms.txt summary",
        "responses": {
          "200": {
            "description": "Plain-text summary.",
            "content": { "text/plain": {} }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "summary": "Extended llms-full.txt summary",
        "responses": {
          "200": {
            "description": "Plain-text long-form summary.",
            "content": { "text/plain": {} }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContactRequest": {
        "type": "object",
        "required": ["name", "email"],
        "properties": {
          "name": { "type": "string" },
          "email": { "type": "string", "format": "email" },
          "company": { "type": "string" },
          "interest_type": {
            "type": "string",
            "description": "Product slug, vertical slug, or 'platform'."
          },
          "stakeholder": { "type": "string" },
          "message": { "type": "string" },
          "preferred_language": { "type": "string", "enum": ["en", "es"] },
          "agent_type": {
            "type": "string",
            "description": "Set when the submitter is an autonomous agent."
          },
          "intended_use": { "type": "string" },
          "system_context": { "type": "string" }
        }
      }
    }
  }
}
