{
  "openapi": "3.1.0",
  "info": {
    "title": "WalletFit Canadian Credit Card Optimizer API",
    "description": "API for recommending the mathematically optimal Canadian credit card for any merchant or category, respecting payment network rules (e.g. Amex not accepted at No Frills/Costco) and point valuations.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://walletfit.app",
      "description": "Production Server"
    }
  ],
  "paths": {
    "/api/recommend": {
      "get": {
        "operationId": "getCardRecommendation",
        "summary": "Get optimal Canadian credit card for a merchant or category",
        "description": "Returns the highest-yielding accepted credit card in Canada for a given merchant or spending category, along with net return calculation and store acceptance validation.",
        "parameters": [
          {
            "name": "merchant",
            "in": "query",
            "required": false,
            "description": "Name of the Canadian merchant (e.g. 'No Frills', 'Costco', 'Sobeys', 'Metro', 'Loblaws', 'Walmart', 'Uber Eats', 'Tim Hortons', 'Chexy').",
            "schema": {
              "type": "string",
              "example": "No Frills"
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Spending category if merchant is not specified (e.g. 'grocery', 'dining', 'gas', 'travel', 'transit', 'recurring', 'streaming').",
            "schema": {
              "type": "string",
              "example": "grocery"
            }
          },
          {
            "name": "spend",
            "in": "query",
            "required": false,
            "description": "Transaction amount in Canadian Dollars (CAD). Default is 100.",
            "schema": {
              "type": "number",
              "example": 250
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Optimal card recommendation successfully computed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string" },
                    "query": { "type": "object" },
                    "recommendation": {
                      "type": "object",
                      "properties": {
                        "topCard": { "type": "string" },
                        "issuer": { "type": "string" },
                        "network": { "type": "string" },
                        "multiplier": { "type": "string" },
                        "effectiveYieldPercent": { "type": "string" },
                        "estimatedReturnCAD": { "type": "string" },
                        "annualFeeCAD": { "type": "string" }
                      }
                    },
                    "fallbackOption": { "type": "object" },
                    "networkConstraints": { "type": "object" },
                    "topRankedCards": {
                      "type": "array",
                      "items": { "type": "object" }
                    },
                    "source": { "type": "object" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
