All guides All docs

Hijri calendar API: convert Gregorian and Hijri dates

GET /v1/calendars/hijri?date=2026-11-28 converts a Gregorian date to the Hijri calendar, and hijri=1448-09-01 converts the other way. The response names the method used: Umm al-Qura for Saudi Arabia and the Gulf states, an official government calendar where we hold one, and the tabular Islamic calendar elsewhere; 1 credit per call.

Last checked . Service: Hijri calendar converter API. Reference: endpoint docs.

Which Hijri calendar you get

There is more than one Hijri calendar, and that is why two converters can disagree by a day. APIFor picks one per country and tells you which in method:

umm-al-qura is the default for SA, AE, QA, KW, BH and OM, from the Umm al-Qura table in ICU, for years 1300 to 1600 AH. official is used where we hold a government calendar, which today is Indonesia's Ministry of Religious Affairs calendar. tabular, the arithmetic Islamic calendar, is the default everywhere else. Override with calendar=umm-al-qura or calendar=tabular.

Ramadan, Shawwal and Dhu al-Hijjah often start after a moon sighting, so the real date can move by a day from any table. Treat converted dates for those months as provisional until the authority announces them.

Request

Send your key in the x-api-key header. New accounts get 1,000 free requests after email verification; the quickstart takes about a minute.

GETcurl
curl 'https://api.apifor.dev/v1/calendars/hijri?date=2026-11-28&country=ID' \
  -H 'x-api-key: YOUR_API_KEY'
Python
import os
import requests

r = requests.get(
    "https://api.apifor.dev/v1/calendars/hijri",
    params={
        "date": "2026-11-28",
        "country": "ID",
    },
    headers={"x-api-key": os.environ["APIFOR_API_KEY"]},
    timeout=30,
)
r.raise_for_status()
print(r.json()["data"])
JavaScript
const res = await fetch("https://api.apifor.dev/v1/calendars/hijri?date=2026-11-28&country=ID", {
  headers: { "x-api-key": process.env.APIFOR_API_KEY },
});
const { data } = await res.json();
console.log(data);

Response

This is the example recorded from the live API and published in our OpenAPI spec. Long lists and strings are shortened here. The full spec is at api.apifor.dev/v1/openapi.json.

200 OK
{
  "success": true,
  "data": {
    "country": "ID",
    "official_coverage": [
      "ID"
    ],
    "gregorian_date": "2026-11-28",
    "hijri": {
      "year": 1448,
      "month": 6,
      "day": 18,
      "month_name": "Jumada al-Akhirah",
      "formatted": "18 Jumada al-Akhirah 1448 AH",
      "local_month_name": "Jumadil Akhir"
    },
    "method": "official",
    "method_note": "Official government calendar for ID."
  },
  "meta": {
    "attribution": {
      "source": "Kalender Hijriah Indonesia, Kementerian Agama Republik Indonesia (Ministry of Religious Affairs)",
      "license": "Public domain (government calendar)",
      "license_url": "https://kemenag.go.id",
      "source_url": "https://bimasislam.kemenag.go.id",
      "attribution_page": "https://apifor.dev/sources",
      "notice": "Dates follow the published government calendar (MABIMS criteria). Final dates for Ramadan, Shawwal and Dhu al-Hijjah are set by the gover..."
    }
  }
}

Three ways to call it

date=YYYY-MM-DD converts Gregorian to Hijri (today if you leave it out). hijri=YYYY-MM-DD converts Hijri to Gregorian. year=1448 lists every month of that Hijri year with its Gregorian start, which is handy for a calendar view or for planning around Ramadan.

The response has month_name in transliterated English, a formatted string such as "18 Jumada al-Akhirah 1448 AH" and, where it applies, local_month_name.

Errors, limits and cost

A missing or wrong key returns 401, bad parameters return 400 with an error.code, and an unknown id returns 404. Rate limits are per key: a limited request gets 429 with a Retry-After header in seconds, so wait that long and retry. Calls that fail before any work starts are refunded. Details are in errors and rate limits.

This request costs 1 credit. Pricing is prepaid: 1,000 free requests once after email verification, then packs from $5 for 5,000 requests to $149 for 400,000. Credits never expire and there is no subscription. See pricing.

From an AI assistant

The same data is available as a tool on the APIFor MCP server at https://mcp.apifor.dev/mcp. Add it as a remote server in any client that supports remote MCP, sign in with OAuth or send your API key as a Bearer token, and ask in plain language. MCP calls use the same key and credits as REST. Setup steps are on the MCP page.

Alternatives

  • AlAdhan Islamic calendar API: Free and keyless. On 1 Dec 2026, /v1/gToH/28-11-2026 returned 18-06-1448, the same day as APIFor, with its own method code HJCoSA.
  • JavaScript Intl: Browsers and Node support the islamic-umalqura calendar in Intl.DateTimeFormat, so you can format Umm al-Qura dates with no API at all.

Facts about other services come from their own pages or a test call on 1 Dec 2026. Prices and limits change, so confirm them there.

Source and licence

Umm al-Qura table from ICU, Unicode License v3, Copyright © 2016-2025 Unicode, Inc. Indonesian dates: Ministry of Religious Affairs calendar, public domain. Tabular dates are computed.

Every APIFor response carries the same attribution in meta.attribution. All sources are listed on sources and licences.

FAQ

Why do Hijri converters disagree by one day?

They use different calendars: Umm al-Qura, tabular, or a national calendar based on moon sighting criteria. APIFor returns the method with every answer so you know which one you got.

Can I convert a Hijri date to Gregorian?

Yes. Pass hijri=YYYY-MM-DD, for example hijri=1448-09-01 for 1 Ramadan 1448.

Does it know when Ramadan starts?

It gives the table date. Authorities can confirm a different day after the moon sighting, so check the announcement before you rely on it.