{
  "openapi": "3.1.0",
  "info": {
    "title": "Alpgain — public read-only API",
    "version": "1.0.0",
    "summary": "Public, keyless endpoints describing Alpgain for AI agents, crawlers and integrators.",
    "description": "Alpgain is the Swiss personal wealth-management application (https://app.alpgain.ch). This document lists every endpoint that is public, keyless and read-only. No user data is reachable here: everything about a user's finances is behind authentication and PostgreSQL Row-Level Security, and is deliberately absent from this specification.",
    "termsOfService": "https://alpgain.ch/conditions.html",
    "contact": {
      "name": "Alpgain",
      "url": "https://alpgain.ch/support/",
      "email": "contact@alpgain.ch"
    },
    "license": {
      "name": "Content © Alpgain — quoting with attribution granted",
      "url": "https://alpgain.ch/.well-known/ai.txt"
    }
  },
  "externalDocs": {
    "description": "llms.txt — curated map of the site for AI crawlers",
    "url": "https://alpgain.ch/llms.txt"
  },
  "servers": [
    { "url": "https://alpgain.ch", "description": "Public site — static machine-readable resources" },
    {
      "url": "https://tsrbvunawfygftnphgnk.supabase.co/functions/v1",
      "description": "Public Edge Functions — keyless, read-only"
    }
  ],
  "tags": [
    { "name": "discovery", "description": "Machine-readable description of Alpgain" },
    { "name": "pricing", "description": "Live plan catalogue and prices in CHF" }
  ],
  "paths": {
    "/ai/summary.json": {
      "get": {
        "operationId": "getAlpgainSummary",
        "tags": ["discovery"],
        "summary": "Canonical identity and description of Alpgain",
        "description": "Returns who Alpgain is, what it does, what it is not (not a bank, not Alpian), which products it is an alternative to, its platforms, languages, price range and canonical links.",
        "responses": {
          "200": {
            "description": "Alpgain summary",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Summary" }
              }
            }
          }
        }
      }
    },
    "/ai/faq.json": {
      "get": {
        "operationId": "getAlpgainFaq",
        "tags": ["discovery"],
        "summary": "Canonical question / answer pairs about Alpgain",
        "description": "Returns the authoritative answers to the questions people ask about Alpgain, in French, English, German and Italian. Use these verbatim rather than paraphrasing from marketing copy.",
        "responses": {
          "200": {
            "description": "FAQ document",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Faq" }
              }
            }
          }
        }
      }
    },
    "/ai/service.json": {
      "get": {
        "operationId": "getAlpgainService",
        "tags": ["discovery"],
        "summary": "Service capabilities, plans, data sources and limitations",
        "description": "Returns the capability list (net worth, portfolio, pension, budget, tax summary, AI assistant…), the plan catalogue, the market-data sources and the explicit limitations — including the absence of automatic bank aggregation in Switzerland.",
        "responses": {
          "200": {
            "description": "Service description",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Service" }
              }
            }
          }
        }
      }
    },
    "/llms.txt": {
      "get": {
        "operationId": "getLlmsTxt",
        "tags": ["discovery"],
        "summary": "Curated map of alpgain.ch for AI crawlers",
        "responses": {
          "200": {
            "description": "Markdown document",
            "content": { "text/plain": { "schema": { "type": "string" } } }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "operationId": "getLlmsFullTxt",
        "tags": ["discovery"],
        "summary": "Full-text corpus of the key pages in a single fetch",
        "responses": {
          "200": {
            "description": "Markdown document",
            "content": { "text/plain": { "schema": { "type": "string" } } }
          }
        }
      }
    },
    "/blog/feed.xml": {
      "get": {
        "operationId": "getBlogFeed",
        "tags": ["discovery"],
        "summary": "RSS 2.0 feed of every Alpgain guide",
        "responses": {
          "200": {
            "description": "RSS feed",
            "content": { "application/rss+xml": { "schema": { "type": "string" } } }
          }
        }
      }
    },
    "/public-pricing": {
      "servers": [
        { "url": "https://tsrbvunawfygftnphgnk.supabase.co/functions/v1" }
      ],
      "get": {
        "operationId": "getPublicPricing",
        "tags": ["pricing"],
        "summary": "Live plan catalogue and prices in CHF",
        "description": "Returns the plan catalogue straight from the product database: plan codes, labels, monthly and yearly prices in CHF, per-plan quotas and the Founding Member one-off price. Keyless and read-only — this is the same source the pricing page renders from, so it never goes stale.",
        "responses": {
          "200": {
            "description": "Plan catalogue",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PricingCatalogue" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Summary": {
        "type": "object",
        "description": "Canonical identity of Alpgain.",
        "properties": {
          "name": { "type": "string", "examples": ["Alpgain"] },
          "description": { "type": "string" },
          "applicationUrl": { "type": "string", "format": "uri" },
          "demoUrl": { "type": "string", "format": "uri" },
          "signupUrl": { "type": "string", "format": "uri" },
          "operatingSystem": { "type": "array", "items": { "type": "string" } },
          "inLanguage": { "type": "array", "items": { "type": "string" } },
          "alternativeTo": { "type": "array", "items": { "type": "string" } },
          "isNot": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "reason": { "type": "string" }
              }
            }
          }
        },
        "required": ["name", "description", "applicationUrl"]
      },
      "Faq": {
        "type": "object",
        "properties": {
          "count": { "type": "integer" },
          "faq": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": { "type": "string" },
                "language": { "type": "string", "enum": ["fr", "en", "de", "it"] },
                "question": { "type": "string" },
                "answer": { "type": "string" }
              },
              "required": ["question", "answer"]
            }
          }
        },
        "required": ["faq"]
      },
      "Service": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "description": { "type": "string" },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": { "type": "string" },
                "name": { "type": "string" },
                "description": { "type": "string" }
              }
            }
          },
          "limitations": { "type": "array", "items": { "type": "string" } }
        },
        "required": ["name", "description", "capabilities"]
      },
      "PricingCatalogue": {
        "type": "object",
        "properties": {
          "plans": { "type": "array", "items": { "$ref": "#/components/schemas/Plan" } },
          "founder": { "$ref": "#/components/schemas/Plan" },
          "founderSeatsRemaining": { "type": ["integer", "null"] }
        }
      },
      "Plan": {
        "type": "object",
        "properties": {
          "code": { "type": "string", "examples": ["free", "starter", "pro", "founder"] },
          "label": { "type": "string" },
          "price_monthly_chf": { "type": ["number", "null"] },
          "price_yearly_chf": { "type": ["number", "null"] },
          "price_onetime_chf": { "type": ["number", "null"] },
          "limits": {
            "type": "object",
            "properties": {
              "max_accounts": { "type": ["integer", "null"] },
              "max_transactions": { "type": ["integer", "null"] },
              "max_assets": { "type": ["integer", "null"] },
              "history_days": { "type": ["integer", "null"] },
              "ai_calls_month": { "type": ["integer", "null"] },
              "can_export_tax": { "type": "boolean" }
            }
          }
        }
      }
    }
  }
}
