Skip to main content

Overview

Fetch a stock’s compliance result with one request to GET /instruments/{symbol}/compliance, and render it as a badge in your UI.
To show compliance results to the users of your product, you need the Developer plan and the credit Screening by halal.sh beside them. The component in step 2 renders the credit beside the badge.
Never call the halal.sh API directly from the browser: that would expose your API key. Proxy the request through your own backend, which holds the key, and have your frontend talk to the proxy.

Step 1: Proxy the request through your backend

Your server holds the API key and forwards the call to halal.sh.
The compliance payload looks like this:

Step 2: Render the badge and the credit

Base the badge on determination.status, which is compliant, non-compliant or pending.
Keep the credit beside the badge wherever the badge appears. The rules for it are in Licensing.

Step 3: Show the screen details

To show why a stock passes or fails, list the three financial screens. Each one has a result of "pass" or "fail", or "not_applicable" with a null value when the screen doesn’t apply. There is no boolean passes field, so check result === "pass".
Ratio value and threshold are decimals: 0.30 means 30%, so multiply by 100 before display. The three financial screen keys are always debt_to_market_cap, cash_to_market_cap, and prohibited_revenue.