Add Shariah Status to Your App with the Sharlife API
If you build a portfolio tracker, a trading app or a research tool for Muslim investors, your users will ask one question about every asset: is it Shariah compliant? The Sharlife API answers that with one request. Sharlife is a Shariah adviser registered with the Securities Commission Malaysia, and the API returns the same statuses shown on sharlife.my.
This guide uses the free plan, which covers the status of the top 50 coins.
1. Create an account and an API key
- Create an account at dev.sharlife.my.
- Open the developer dashboard and create an API key. Keys start with
shl_api_. - Keep the key on your server. Don't put it in a mobile app, in browser code or in a public repository.
2. Make your first request
Every request goes to https://api.sharlife.my and carries your key in the x-api-key header.
curl --request GET \
--url 'https://api.sharlife.my/crypto/v1/status?name_id=ethereum' \
--header 'x-api-key: shl_api_...'
The response:
{
"success": true,
"data": {
"name_id": "ethereum",
"ticker": "ETH",
"shariah_status": "shariah"
}
}
name_id is the coin's identifier on Sharlife. It's the last part of the coin's page address, for example bitcoin in sharlife.my/crypto-shariah/crypto/bitcoin.
3. Use it in Python
import os
import requests
API_KEY = os.environ["SHARLIFE_API_KEY"]
def shariah_status(name_id):
response = requests.get(
"https://api.sharlife.my/crypto/v1/status",
headers={"x-api-key": API_KEY},
params={"name_id": name_id},
timeout=10,
)
response.raise_for_status()
return response.json()["data"]["shariah_status"]
print(shariah_status("bitcoin"))
4. Use it in JavaScript
Run this on your server (Node.js 18 or later), not in the browser, so your key stays private.
const API_KEY = process.env.SHARLIFE_API_KEY;
async function shariahStatus(nameId) {
const url = new URL("https://api.sharlife.my/crypto/v1/status");
url.searchParams.set("name_id", nameId);
const response = await fetch(url, { headers: { "x-api-key": API_KEY } });
if (!response.ok) throw new Error(`Sharlife API returned ${response.status}`);
const { data } = await response.json();
return data.shariah_status;
}
console.log(await shariahStatus("bitcoin"));
5. Show the status to your users
Map each status to a label and a colour, and show it beside the asset. For coins, shariah_status is one of three values:
| Status | Suggested label | Colour |
|---|---|---|
shariah | Shariah | Green |
non-shariah | Non-Shariah | Red |
grey | Grey | Grey |
Statuses can change when an asset is reviewed again, so fetch them regularly instead of storing them forever.
Each plan has its own request limits. Every response carries X-RateLimit-Limit and X-RateLimit-Remaining headers, so you can see how much you have left. If you go over, the API answers 429 with a Retry-After header that says how many seconds to wait.
6. Go further
| You want | Endpoint | Plan |
|---|---|---|
| A stock's status | GET /stock/v1/status?stock_id=apple-inc | Builder and above |
| The list of supported coins | GET /crypto/v1/list | Builder and above |
| A coin's full screening record | GET /crypto/v1/info?name_id=ethereum | Scale and above |
| A stock's full screening record | GET /stock/v1/info?stock_id=apple-inc | Scale and above |
Plans and prices are on the API pricing page. The full reference is in the API docs.
7. Credit the data
If you show Sharlife statuses in a commercial product on the Scale plan, add the "Shariah data by Sharlife" badge. The code is on the badge page.
Screening statuses are educational information and are not a personal fatwa or financial advice.