# Prayer Times & Islamic Calendar API
> Islamic prayer times, the Hijri calendar and the Qibla direction as an API. Get the five daily prayer times — Fajr, Dhuhr, Asr, Maghrib and Isha, plus sunrise, sunset, Imsak and midnight — for any coordinate and date, calculated with your choice of method (Muslim World League, ISNA, Umm al-Qura, Egyptian, and many more), alongside the matching Hijri date; convert any date between the Gregorian and Hijri (Islamic lunar) calendars in either direction; and get the exact Qibla direction — the compass bearing and great-circle distance from any location to the Kaaba in Mecca. Prayer times and calendar conversion are powered by the Aladhan service; the Qibla is computed directly. Ideal for Muslim prayer and lifestyle apps, mosque and community sites, Ramadan tools and calendars, and any app that needs accurate prayer times or Hijri dates. Open data.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/prayer-api/..."
```

## Pricing
- **Free** (Free) — 3,640 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 49,200 calls/Mo, 8 req/s
- **Pro** ($13/Mo) — 244,000 calls/Mo, 20 req/s
- **Mega** ($34/Mo) — 1,200,000 calls/Mo, 50 req/s

## Endpoints

### Prayer Times

#### `GET /v1/timings` — Daily prayer times

**Parameters:**
- `lat` (query, required, string) — Latitude (-90..90) Example: `21.42`
- `lon` (query, required, string) — Longitude (-180..180) Example: `39.83`
- `date` (query, optional, string) — Date (YYYY-MM-DD or DD-MM-YYYY), default today
- `method` (query, optional, string) — Calculation method 0-23 (default 3 = Muslim World League)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/prayer-api/v1/timings?lat=21.42&lon=39.83"
```

**Response:**
```json
{
    "data": {
        "timings": {
            "date": {
                "hijri": {
                    "day": "14",
                    "date": "14-12-1447",
                    "year": "1447",
                    "month": "Dhū al-Ḥijjah",
                    "weekday": "Al Ahad",
                    "month_ar": "ذوالحجة",
                    "designation": "AH",
                    "month_number": 12
                },
                "gregorian": "31-05-2026"
            },
            "method": "Muslim World League",
            "location": {
                "lat": 21.42,
                "lon": 39.83,
                "timezone": "Asia/Riyadh"
            },
            "prayer_times": {
                "Asr": "15:34",
                "Fajr": "04:14",
                "Isha": "20:18",
                "Dhuhr": "12:18",
                "Imsak": "04:04",
                "Sunset": "18:59",
                "Maghrib": "18:59",
                "Sunrise": "05:38",
                "Midnight": "00:18"
            }
        }
    },
    "meta": {
        "timestamp": "2026-05-31T15:30:51.041Z",
        "request_id": "97cd5433-4f7c-4ee0-9c61-77955c771ec9"
    },
    "status": "ok",
    "message": "Timings retrieved",
    "success": true
}
```

### Calendar

#### `GET /v1/convert` — Convert Gregorian ⇄ Hijri date

**Parameters:**
- `date` (query, required, string) — Date (YYYY-MM-DD or DD-MM-YYYY) Example: `2026-06-01`
- `from` (query, optional, string) — gregorian | hijri (default gregorian)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/prayer-api/v1/convert?date=2026-06-01"
```

**Response:**
```json
{
    "data": {
        "conversion": {
            "from": "gregorian",
            "hijri": {
                "day": "15",
                "date": "15-12-1447",
                "year": "1447",
                "month": "Dhū al-Ḥijjah",
                "weekday": "Al Athnayn",
                "month_ar": "ذوالحجة",
                "designation": "AH",
                "month_number": 12
            },
            "input": "01-06-2026",
            "gregorian": {
                "day": "01",
                "date": "01-06-2026",
                "year": "2026",
                "month": "June",
                "weekday": "Monday",
                "month_number": 6
            }
        }
    },
    "meta": {
        "timestamp": "2026-05-31T15:30:51.136Z",
        "request_id": "fdc25ac3-a7a6-4742-ae29-7139b751f775"
    },
    "status": "ok",
    "message": "Date converted",
    "success": true
}
```

### Qibla

#### `GET /v1/qibla` — Qibla direction & distance

**Parameters:**
- `lat` (query, required, string) — Latitude (-90..90) Example: `48.2`
- `lon` (query, required, string) — Longitude (-180..180) Example: `16.4`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/prayer-api/v1/qibla?lat=48.2&lon=16.4"
```

**Response:**
```json
{
    "data": {
        "qibla": {
            "note": "Direction (true-north bearing) and great-circle distance from your location to the Kaaba in Mecca.",
            "kaaba": {
                "lat": 21.4225,
                "lon": 39.8262
            },
            "compass": "SE",
            "location": {
                "lat": 48.2,
                "lon": 16.4
            },
            "distance_km": 3635,
            "direction_deg": 136.74
        }
    },
    "meta": {
        "timestamp": "2026-05-31T15:30:51.219Z",
        "request_id": "32310257-b15b-4daa-b7d5-9e892d30c78d"
    },
    "status": "ok",
    "message": "Qibla retrieved",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Calculation methods & options

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/prayer-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "Islamic prayer times, Hijri ⇄ Gregorian date conversion and Qibla direction. /v1/timings = the five daily prayers (+ sunrise, imsak, midnight) for a coordinate and date (default today), with the Hijri date and a calculation method; /v1/convert = convert a date between the Gregorian and Hijri calendars (from=gregorian|hijri); /v1/qibla = the compass direction & distance to the Kaaba. Dates accept YYYY-MM-DD or DD-MM-YYYY.",
        "source": "Aladhan API (prayer times & Islamic calendar) + local Qibla calculation",
        "endpoints": [
            "/v1/timings",
            "/v1/convert",
            "/v1/qibla",
            "/v1/meta"
        ],
        "calculation_methods": {
            "0": "Shia Ithna-Ansari",
            "1": "University of Islamic Sciences, Karachi",
            "2": "ISNA",
            "3": "Muslim World League (default)",
            "4": "Umm al-Qura, Makkah",
            "5": "Egyptian General Authority",
            "7": "Institute of Geophysics, Tehran",
            "8": "Gulf Region",
            "9": "Kuwait",
            "10": "Qatar",
            "11": "Singapore",
            "12": "France",
            "13": "Turkey",
            "99": "Custom"
        }
    },
    "meta": {
        "timestamp": "2026-05-31T15:30:51.295Z",
        "request_id": "a0c88eae-4fc2-435a-98fb-278b6dab816a"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/prayer-api
OpenAPI spec: https://www.oanor.com/api/prayer-api/openapi.json
