Free & Accurate

Free Qibla API

Get the precise compass bearing to the Kaaba from anywhere on Earth. Calculated with great-circle (spherical) trigonometry, returned in degrees from true north with the distance to Makkah in km. No API key required.

Read the Docs Try it Live

Quick Start

Get the Qibla direction for New York:

JavaScript const res = await fetch('https://ummahapi.com/api/qibla?lat=40.71&lng=-74.01'); const data = await res.json(); // Returns the Qibla direction for New York console.log(data.data.qibla_direction); // 58.48 (degrees from true north) console.log(data.data.compass_bearing); // "ENE" console.log(data.data.distance_km); // 10318 console.log(data.data.kaaba_coordinates); // { lat: 21.4225, lng: 39.8262 }

What You Get

Any Location

Pass any latitude and longitude on Earth. The API returns the exact direction to face for prayer from that point.

Compass Bearing

The Qibla direction is returned in degrees from true north, measured clockwise, ready to plot on a compass.

16-point Direction

A human-friendly compass label such as ENE, so you can show the general direction without doing any math.

Distance to Makkah

The great-circle distance in kilometers from your coordinates to the Kaaba, useful for maps and context.

Spherical Accuracy

Direction is computed with great-circle trigonometry on a spherical Earth, not a flat map, so it stays correct worldwide.

No Key Required

Completely free with no signup and no API key. Just call the endpoint and read the JSON response.

Endpoints

GET /api/qibla?lat=&lng= Qibla direction, bearing & distance to the Kaaba

Frequently Asked Questions

Is the Qibla API free?

Yes. UmmahAPI's Qibla API is completely free. No API key or signup required. You can make up to 100 requests per minute.

How does it calculate the Qibla direction?

The API uses great-circle (spherical) trigonometry to compute the initial compass bearing from your coordinates to the Kaaba in Makkah (21.4225 N, 39.8262 E). This is the shortest path across the surface of the Earth, so the direction is measured in degrees clockwise from true north.

What does the response include?

Each response includes the qibla_direction in degrees from true north, a 16-point compass_bearing label such as ENE, the great-circle distance_km to Makkah, and the kaaba_coordinates used for the calculation.

How accurate is it?

Very accurate. The direction is computed with great-circle trigonometry on a spherical Earth model, not a flat map. The Qibla direction is returned to two decimal places, which is well within the precision needed to align a prayer mat or build a compass app.

Related Resources

More Free Islamic APIs

Start building with the Qibla API

Free, accurate, and works for any location on Earth.

View Full Documentation