zakat
Calculate Zakat
Calculate zakat owed on a portfolio of stock holdings.
Determines whether the total market value of the provided holdings exceeds the nisab threshold (85 grams of gold at the given price per gram). If above nisab, calculates 2.5% zakat on each holding. Returns per-holding zakat amounts and aggregate totals.
Key response fields:
- nisab_threshold: 85 * gold_price_per_gram
- is_above_nisab: whether zakat is due
- total_zakat: total amount to pay (0 if below nisab)
curl example:
curl -X POST "http://localhost:8000/api/zakat/calculate" \
-H "Content-Type: application/json" \
-d '{"holdings": [{"symbol": "AAPL", "market_value": 25000}, {"symbol": "MSFT", "market_value": 18000}], "gold_price_per_gram": 65.0}'
Python requests example:
import requests
resp = requests.post(
"http://localhost:8000/api/zakat/calculate",
json={
"holdings": [
{"symbol": "AAPL", "market_value": 25000},
{"symbol": "MSFT", "market_value": 18000},
],
"gold_price_per_gram": 65.0,
},
)
data = resp.json()
if data["is_above_nisab"]:
print(f"Zakat due: ${data['total_zakat']:.2f}")
else:
print("Below nisab — no zakat due")
post/api/zakat/calculate
Request
- Base URL: https://api.halalterminal.com
- URL: https://api.halalterminal.com/api/zakat/calculate
- Auth: API key in header X-API-Key
Request body
Example request
{
"gold_price_per_gram": 65,
"holdings": [
{
"market_value": 25000,
"symbol": "AAPL"
},
{
"market_value": 18000,
"symbol": "MSFT"
},
{
"market_value": 12000,
"symbol": "GOOGL"
}
]
}Response
Zakat calculation with nisab check and per-holding breakdown.
Example response
{
"gold_price_per_gram": 65,
"holdings": [
{
"market_value": 25000,
"symbol": "AAPL",
"zakat_amount": 625
},
{
"market_value": 18000,
"symbol": "MSFT",
"zakat_amount": 450
},
{
"market_value": 12000,
"symbol": "GOOGL",
"zakat_amount": 300
}
],
"is_above_nisab": true,
"nisab_threshold": 5525,
"total_market_value": 55000,
"total_zakat": 1375,
"zakat_rate": 0.025
}Changes
No recorded changes to this operation across all 1 revision of this API.