Share Your Feedback

Considering your experience with Sharlife so far, how likely are you to recommend us to a friend or colleague?
Not at all likely Extremely likely
(Optional)

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

  1. Create an account at dev.sharlife.my.
  2. Open the developer dashboard and create an API key. Keys start with shl_api_.
  3. 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:

StatusSuggested labelColour
shariahShariahGreen
non-shariahNon-ShariahRed
greyGreyGrey

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 wantEndpointPlan
A stock's statusGET /stock/v1/status?stock_id=apple-incBuilder and above
The list of supported coinsGET /crypto/v1/listBuilder and above
A coin's full screening recordGET /crypto/v1/info?name_id=ethereumScale and above
A stock's full screening recordGET /stock/v1/info?stock_id=apple-incScale 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.