{
  "openapi": "3.1.0",
  "info": {
    "title": "Mizan Shariah equity screening",
    "version": "1.1.0",
    "description": "Screens a US-listed company against four published Shariah equity standards (AAOIFI, Dow Jones Islamic Market, S&P Shariah, MSCI Islamic), first on its business (prohibited industries each standard excludes) and then on its debt, using live market data and the company's own SEC filings. Also screens a whole portfolio, finds halal alternatives, calculates dividend purification and zakat. Every answer carries a 'say' field: one or two plain sentences to read aloud. Research output, not investment advice.",
    "contact": {
      "name": "Mizan",
      "email": "hello@askmizan.com",
      "url": "https://askmizan.com"
    },
    "license": {
      "name": "Free to use, attribution appreciated"
    }
  },
  "servers": [
    {
      "url": "https://askmizan.com/api/v1"
    }
  ],
  "paths": {
    "/screen/{ticker}": {
      "get": {
        "operationId": "screenCompany",
        "summary": "Screen one company against all four standards",
        "description": "Returns a 'say' sentence, the live price, the consolidated share count, the filing figures used, the business screen per standard ('business': main_business, by_standard pass/fail/review, excluded_under), and each standard's ratio, threshold and verdict. In each screens entry, 'compliant' is the overall verdict (false when that standard excludes the company's business, null when the business needs a closer look) and 'debt_compliant' is the debt test alone. Verdicts within one percent of a threshold are flagged borderline. A company name (for example nvidia) also works.",
        "parameters": [
          {
            "name": "ticker",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z][A-Za-z.\\-]{0,9}$"
            },
            "example": "AAPL",
            "description": "US listing symbol (a common company name also works)."
          }
        ],
        "responses": {
          "200": {
            "description": "Screening result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed ticker"
          },
          "404": {
            "description": "Company is outside the 424-company panel; the answer still gives the business screen when the company is known"
          },
          "503": {
            "description": "Live price or share count unavailable, so no verdict is given"
          },
          "422": {
            "description": "Filing figures too old for a debt verdict, and the business screen does not decide it either"
          }
        }
      }
    },
    "/standards": {
      "get": {
        "operationId": "listStandards",
        "summary": "The four standards, their denominators and thresholds",
        "responses": {
          "200": {
            "description": "Standards"
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status and panel provenance",
        "responses": {
          "200": {
            "description": "Status"
          }
        }
      }
    },
    "/purify/{ticker}": {
      "get": {
        "operationId": "purifyDividend",
        "summary": "How much of a dividend to give to charity",
        "description": "Returns the company's purification ratio (interest income over total revenue, from its latest 10-K that reports interest income; 'latest_annual_filing' and 'note' say when that is older than the latest 10-K) and, if a dividend amount is given, the amount to give to charity. For a company whose main business every standard excludes, 'business_screen' explains that purification does not make it permissible.",
        "parameters": [
          {
            "name": "ticker",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "NVDA",
            "description": "US listing symbol."
          },
          {
            "name": "dividend",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            },
            "example": 200,
            "description": "The dividend received, in any currency."
          }
        ],
        "responses": {
          "200": {
            "description": "Purification ratio and amount"
          },
          "404": {
            "description": "Company not covered"
          }
        }
      }
    },
    "/alternatives/{ticker}": {
      "get": {
        "operationId": "findHalalAlternatives",
        "summary": "Halal alternatives to a holding",
        "description": "Companies Mizan covers in the same industry (or the nearest related one) whose business is permitted and whose debt passes all four standards at the last quarter-end, largest first, plus Shariah index funds for US and UK investors. Screen a pick live with /screen/{ticker} before buying.",
        "parameters": [
          {
            "name": "ticker",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "PM",
            "description": "The holding to replace: a US listing symbol or company name."
          }
        ],
        "responses": {
          "200": {
            "description": "Alternatives, with a say sentence",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Company not covered"
          }
        }
      }
    },
    "/portfolio": {
      "get": {
        "operationId": "screenPortfolio",
        "summary": "Screen a whole portfolio",
        "description": "Screens up to 15 holdings under all four standards and returns the share of the portfolio that is compliant under each, the holdings that fail, and a combined dividend purification ratio.",
        "parameters": [
          {
            "name": "holdings",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "AAPL:5000,MSFT:3000,NVDA:2000",
            "description": "Comma-separated tickers, each optionally followed by a colon and the value held, for weighting."
          }
        ],
        "responses": {
          "200": {
            "description": "Portfolio screen"
          },
          "400": {
            "description": "Missing or malformed holdings"
          }
        }
      }
    },
    "/zakat": {
      "get": {
        "operationId": "calculateZakat",
        "summary": "Zakat owed on cash, gold, silver, shares and business stock, using live gold and silver prices",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "USD",
                "GBP",
                "EUR",
                "CAD",
                "AUD"
              ]
            },
            "description": "Defaults to USD."
          },
          {
            "name": "cash",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Cash and bank balances"
          },
          {
            "name": "gold_grams",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Gold held, in grams"
          },
          {
            "name": "gold_value",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Or the value of gold held"
          },
          {
            "name": "silver_grams",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Silver held, in grams"
          },
          {
            "name": "silver_value",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Or the value of silver held"
          },
          {
            "name": "shares_trading",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Market value of shares held for trading (counted in full)"
          },
          {
            "name": "shares_longterm",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Market value of shares held long term"
          },
          {
            "name": "share_zakatable_pct",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Share of long-term holdings treated as zakatable, default 25"
          },
          {
            "name": "business_stock",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Value of business stock for sale"
          },
          {
            "name": "owed_to_you",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Money owed to you that you expect to be repaid"
          },
          {
            "name": "debts_due_now",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            },
            "description": "Debts due now, deducted"
          },
          {
            "name": "nisab",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "silver",
                "gold"
              ]
            },
            "description": "Which nisab to use. Defaults to silver."
          }
        ],
        "responses": {
          "200": {
            "description": "Zakat due, amount, breakdown, nisab and prices used"
          },
          "400": {
            "description": "Invalid input"
          },
          "503": {
            "description": "Prices unavailable"
          }
        }
      }
    }
  }
}