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.
Get the Qibla direction for New York:
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 }
Pass any latitude and longitude on Earth. The API returns the exact direction to face for prayer from that point.
The Qibla direction is returned in degrees from true north, measured clockwise, ready to plot on a compass.
A human-friendly compass label such as ENE, so you can show the general direction without doing any math.
The great-circle distance in kilometers from your coordinates to the Kaaba, useful for maps and context.
Direction is computed with great-circle trigonometry on a spherical Earth, not a flat map, so it stays correct worldwide.
Completely free with no signup and no API key. Just call the endpoint and read the JSON response.
Yes. UmmahAPI's Qibla API is completely free. No API key or signup required. You can make up to 100 requests per minute.
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.
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.
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.
Free, accurate, and works for any location on Earth.
View Full Documentation