---
title: "Hijri calendar API: convert Gregorian and Hijri dates | APIFor"
description: "Convert a Gregorian date to Hijri and back, or list the months of a Hijri year, with Umm al-Qura, official government or tabular calendars. Real request and response."
canonical: "https://apifor.dev/guides/hijri-calendar-api/"
---

**All guides All docs**

- [Guides](https://apifor.dev/guides/)
- Hijri calendar API

# 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 1 Dec 2026. Service: [Hijri calendar converter API](https://apifor.dev/services/calendars/). Reference: [endpoint docs](https://apifor.dev/docs/reference/calendars/).

## 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](https://apifor.dev/docs/quickstart/) takes about a minute.

GET curl

```bash
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](https://api.apifor.dev/v1/openapi.json).

200 OK

```json
{
  "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](https://apifor.dev/docs/errors/) and [rate limits](https://apifor.dev/docs/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](https://apifor.dev/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](https://apifor.dev/docs/mcp/).

## Alternatives

- [AlAdhan Islamic calendar API](https://aladhan.com/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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf): 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](https://apifor.dev/sources/).

## 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.

## Related

- [Hijri calendar converter API](https://apifor.dev/services/calendars/)
- [Endpoint reference](https://apifor.dev/docs/reference/calendars/)
- [Prayer times API](https://apifor.dev/services/prayer-times/)
- [Public holidays API](https://apifor.dev/services/holidays/)
- [Sunrise and sunset API](https://apifor.dev/services/sun/)
- [All guides](https://apifor.dev/guides/)

[Get a free API key](https://app.apifor.dev/register) [Use it from an AI client (MCP)](https://apifor.dev/docs/mcp/)
