{
  "openapi": "3.1.0",
  "info": {
    "title": "Mutual Rupee Open Mutual Fund API",
    "version": "1.0.0",
    "description": "Free, open-source Indian Mutual Fund REST API aggregating official AMFI daily NAVs, MFAPI.in historical series, and Kuvera/Captnemo ISIN metadata, with reserved slots for institutional enterprise data providers.",
    "license": {
      "name": "MIT / Public Open Data"
    }
  },
  "servers": [
    {
      "url": "https://mutualrupee.org",
      "description": "Mutual Rupee Open API"
    }
  ],
  "paths": {
    "/api/funds": {
      "get": {
        "operationId": "searchMutualFunds",
        "summary": "Search and filter Indian mutual fund schemes",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Search by fund name, AMC, scheme code, or ISIN"
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by SEBI category (e.g., Flexi Cap, Mid Cap, ELSS, Index, Liquid)"
          },
          {
            "name": "amc",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by Asset Management Company"
          },
          {
            "name": "plan",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "Direct",
                "Regular"
              ]
            },
            "description": "Direct or Regular plan"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "featured",
                "cagr_5y",
                "cagr_3y",
                "ter_asc",
                "aum_desc",
                "nav_desc"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 24,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of mutual fund schemes"
          }
        }
      }
    },
    "/api/funds/{scheme_code}": {
      "get": {
        "operationId": "getMutualFundDetail",
        "summary": "Get detailed NAV history, trailing CAGR, TER, and AUM for a scheme code",
        "parameters": [
          {
            "name": "scheme_code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "122639"
          }
        ],
        "responses": {
          "200": {
            "description": "Full mutual fund detail with historical NAVs and trailing returns"
          },
          "404": {
            "description": "Scheme not found"
          }
        }
      }
    },
    "/api/amcs": {
      "get": {
        "operationId": "listAMCs",
        "summary": "List all Asset Management Companies with scheme counts",
        "responses": {
          "200": {
            "description": "Array of AMCs"
          }
        }
      }
    },
    "/api/categories": {
      "get": {
        "operationId": "listCategories",
        "summary": "List all SEBI mutual fund categories with scheme counts",
        "responses": {
          "200": {
            "description": "Array of SEBI categories"
          }
        }
      }
    },
    "/api/providers": {
      "get": {
        "operationId": "listDataProviders",
        "summary": "List active free open-source providers and reserved paid enterprise slots",
        "responses": {
          "200": {
            "description": "Provider architecture status"
          }
        }
      }
    },
    "/api/stats": {
      "get": {
        "operationId": "getPortalStats",
        "summary": "Get live dataset statistics and AMFI sync status",
        "responses": {
          "200": {
            "description": "Portal statistics"
          }
        }
      }
    }
  }
}