DEV Community

xidioda xidioda
xidioda xidioda

Posted on • Originally published at khaleejiapi.dev

Islamic Finance APIs for Developers: Hijri Calendar, Prayer Times & More

Building Islamic-Aware Applications

If you're building apps for Muslim users — whether that's a banking app, a productivity tool, or an e-commerce platform — you need Islamic calendar and prayer time support. Here's how KhaleejiAPI makes it easy.

Hijri Calendar Conversion

The Hijri (Islamic) calendar is used across the Muslim world for religious observances, government documents, and financial contracts. Converting between Gregorian and Hijri dates is surprisingly complex — the Islamic calendar is lunar-based with months of 29 or 30 days.

Quick Start

# Convert today to Hijri
curl "https://khaleejiapi.dev/api/v1/hijri/convert?today=true" \
  -H "X-API-Key: YOUR_KEY"

# Convert specific date
curl "https://khaleejiapi.dev/api/v1/hijri/convert?date=2026-03-01" \
  -H "X-API-Key: YOUR_KEY"

# Convert Hijri to Gregorian
curl "https://khaleejiapi.dev/api/v1/hijri/convert?hijri=1447-09-01" \
  -H "X-API-Key: YOUR_KEY"
Enter fullscreen mode Exit fullscreen mode

Response

{
  "gregorian": {
    "date": "2026-02-22",
    "year": 2026,
    "month": 2,
    "day": 22,
    "monthName": "February",
    "dayOfWeek": "Sunday",
    "dayOfWeekAr": "الأحد"
  },
  "hijri": {
    "date": "1447-08-04",
    "year": 1447,
    "month": 8,
    "day": 4,
    "monthName": "Sha'ban",
    "monthNameAr": "شعبان"
  },
  "direction": "gregorian_to_hijri"
}
Enter fullscreen mode Exit fullscreen mode

SDK Usage

const hijri = await client.islamic.convertHijri({
  date: '2026-03-01',
  direction: 'to_hijri'
});

// Check if it's Ramadan
if (hijri.hijri.month === 9) {
  console.log("It's Ramadan! 🌙");
}
Enter fullscreen mode Exit fullscreen mode

Prayer Times

Our prayer times API uses astronomical calculations — not a database lookup. This means accurate times for any location on Earth, not just predefined cities.

5 Calculation Methods

Method Used By
MWL (Muslim World League) Most of the world
ISNA North America
Egypt Africa, Middle East
Makkah (Umm al-Qura) Saudi Arabia
Karachi Pakistan, South Asia

2 Juristic Schools

  • Shafi — Asr when shadow equals object length (most madhabs)
  • Hanafi — Asr when shadow equals twice object length

Quick Start

# By city name
curl "https://khaleejiapi.dev/api/v1/prayer-times?city=dubai" \
  -H "X-API-Key: YOUR_KEY"

# By coordinates with Hanafi school
curl "https://khaleejiapi.dev/api/v1/prayer-times?lat=21.4225&lng=39.8262&school=hanafi" \
  -H "X-API-Key: YOUR_KEY"
Enter fullscreen mode Exit fullscreen mode

Response includes Qibla direction

{
  "prayers": {
    "fajr": "05:23",
    "sunrise": "06:42",
    "dhuhr": "12:30",
    "asr": "15:47",
    "maghrib": "18:15",
    "isha": "19:33"
  },
  "qibla": {
    "direction": 255.42,
    "compass": "WSW"
  }
}
Enter fullscreen mode Exit fullscreen mode

Arabic Text Processing

Our Arabic NLP API supports 7 operations:

1. Remove Diacritics

Strip tashkeel from Arabic text:

curl -X POST "https://khaleejiapi.dev/api/v1/arabic/process" \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "مَرْحَبًا بِالْعَالَمِ", "operation": "remove_diacritics"}'
# Result: "مرحبا بالعالم"
Enter fullscreen mode Exit fullscreen mode

2. Transliterate

Convert Arabic to Latin script:

curl -X POST "https://khaleejiapi.dev/api/v1/arabic/process" \
  -d '{"text": "مرحبا بالعالم", "operation": "transliterate"}'
# Result: "mrhba bal'aalm"
Enter fullscreen mode Exit fullscreen mode

3. Sentiment Analysis

Basic sentiment detection for Arabic text:

curl -X POST "https://khaleejiapi.dev/api/v1/arabic/process" \
  -d '{"text": "هذا المنتج ممتاز وجميل", "operation": "sentiment"}'
# Result: { "score": 0.8, "label": "positive" }
Enter fullscreen mode Exit fullscreen mode

Use Cases

  1. Banking apps — Show Hijri dates on statements, calculate Islamic finance terms
  2. Prayer apps — Accurate times + Qibla for any location
  3. E-commerce — Translate product descriptions, detect Arabic text
  4. HR systems — Business day calculations for GCC countries
  5. Government — Saudi ID validation, Emirates ID validation

Get Started

All Islamic APIs are included in the free tier (1,000 requests/month):

npm install @khaleejiapi/sdk
# or
pip install khaleejiapi
Enter fullscreen mode Exit fullscreen mode

Sign up at khaleejiapi.dev/signup.


Originally published on KhaleejiAPI Blog. Sign up for a free API key at khaleejiapi.dev/signup — 1,000 requests/month, no credit card required.

Top comments (0)