← Back
v1Live

HalalAPI Docs

Complete reference for the Halal Locations API. Find halal restaurants by zip code or GPS coordinates, powered by Foursquare + OpenStreetMap.

01

Overview

What this API is and what it returns.

Base URL

halal-api.vercel.app

Protocol

HTTPS only

Format

JSON

HalalAPI is a REST API that searches for halal restaurants near a given location. It combines data from Foursquare Places and the OpenStreetMap community to give broader halal coverage than any single data source. Responses include halal certification status, alcohol policy, cuisine type, contact info, and distance.

Designed for:

  • Muslim restaurant finder and travel apps
  • Food delivery platforms serving halal-conscious users
  • AI agents and LLM tools needing halal food data
  • Maps and local discovery apps
  • Prayer time apps adding nearby halal food features

02

Quick Start

Make your first API call in under 2 minutes.

Step 1 — Get a free API key

Go to halal-api.vercel.app, enter your email address, and your key is generated instantly. No credit card required. Starts with 100 free requests/month.

Step 2 — Make your first request

curl "https://halal-api.vercel.app/api/v1/locations?zip=77024&radius=5" \
  -H "x-api-key: YOUR_API_KEY"

Step 3 — Parse the response

You'll receive a JSON object with a data array of restaurants and a meta object with totals and location info. See Response Format for full details.


03

Authentication

How to pass your API key.

Every request must be authenticated. There are two methods depending on how you access the API.

Method 1 — Direct access

Recommended

Pass your key in the x-api-key request header. Get your key at halal-api.vercel.app.

Request header
x-api-key: hk_your_api_key_here

Keys start with hk_ followed by a 48-character hex string.

Method 2 — Via RapidAPI

If accessing through RapidAPI marketplace, use your RapidAPI key and the RapidAPI gateway URL.

curl "https://halalapi.p.rapidapi.com/api/v1/locations?zip=77024" \
  -H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \
  -H "x-rapidapi-host: halalapi.p.rapidapi.com"

Security notes

  • Never expose your API key in client-side JavaScript or public repos
  • Store keys in environment variables (process.env.HALAL_API_KEY)
  • Each key is tied to an email address and a monthly request limit
  • If your key is compromised, contact baqirhzaidi5@gmail.com immediately

04

Base URL

Endpoints for direct and RapidAPI access.

Direct

Recommended
https://halal-api.vercel.app

No intermediary. Lower latency. You keep 100% of revenue.

RapidAPI Gateway

https://halalapi.p.rapidapi.com

Via RapidAPI marketplace. Requires RapidAPI subscription.


05

Data Sources

Where the halal data comes from.

Every request queries both sources in parallel and merges results. Duplicates are removed by name matching.

Foursquare Places

Primary

Searches Foursquare's 100M+ global places database using the keyword halal filtered by location and radius.

Returns up to 50 results per request. Places from this source appear with source: "foursquare" and a hex fsq_id.

Halal certification is unverified by default unless enriched by community data in our database.

OpenStreetMap (Overpass API)

Community Verified

Queries the OpenStreetMap Overpass API for nodes tagged with diet:halal=yes or diet:halal=only within the search radius.

These are community-contributed tags added by Muslim contributors worldwide. Places from this source appear with source: "openstreetmap" and an osm_ prefixed ID.

  • diet:halal=yeshalal_certification: "community-verified"
  • diet:halal=onlyhalal_certification: "halal-only"

Deduplication

Results from both sources are merged and deduplicated by restaurant name (case-insensitive). If a place exists in both Foursquare and OSM, the Foursquare version is kept and the OSM entry is discarded to avoid duplicates.

06

Endpoints

All available API endpoints.

GET/api/v1/locationsv1

Search for halal restaurants near a given location. Returns merged, deduplicated results from Foursquare and OpenStreetMap sorted by distance.

Requires authRate limitedJSON response

More endpoints coming soon: POST /api/v1/locations/submit for community submissions.


07

Parameters

All query parameters for GET /api/v1/locations.

ParameterTypeRequiredDefaultDescription
zipstringone of*US zip code. E.g. 77024, 10001, 60601
latnumberone of*Latitude. Float. Use with lng. E.g. 29.7604
lngnumberone of*Longitude. Float. Use with lat. E.g. -95.3698
radiusnumberno5Search radius in miles. Min: 1. Max: 31.
min_ratingnumberno0Minimum community rating filter (0–5 scale).
certified_onlybooleannofalseIf true, only return community-verified or halal-only places from OSM.

* You must provide either zip OR both lat and lng. Providing neither returns a 400 error.

Parameter examples

GET /api/v1/locations?zip=77024

08

Response Format

Structure of a successful JSON response.

{
  "data": [
    {
      // --- Identity ---
      "fsq_id": "4be444f4cf200f47d3b2113c",   // Foursquare hex ID
      "name": "Empire Turkish Grill",
      "source": "foursquare",                  // "foursquare" | "openstreetmap"

      // --- Location ---
      "address": "12448 Memorial Dr, Houston, TX 77024",
      "city": "Houston",
      "state": "TX",
      "postcode": "77024",
      "latitude": 29.771,
      "longitude": -95.513,
      "distance_meters": 3561,                 // distance from search point

      // --- Category ---
      "cuisine_type": "Turkish Restaurant",    // from Foursquare or OSM amenity tag
      "chain": null,                           // chain name if part of a chain

      // --- Contact ---
      "phone": "(713) 827-7475",
      "website": "http://www.empiretrgrill.com",
      "instagram": null,

      // --- Halal data ---
      "halal_certification": "unverified",     // see Halal Fields section
      "serves_alcohol": null,                  // true | false | null
      "community_rating": null,                // 0–5 float | null
      "verified": false                        // true if enriched with community data
    },
    {
      // OSM example — community-verified
      "fsq_id": "osm_987654321",               // OSM node ID prefixed with osm_
      "name": "Bismillah Restaurant & Cafe",
      "source": "openstreetmap",
      "address": "1234 Hillcroft Ave, Houston, TX",
      "city": "Houston",
      "state": "TX",
      "postcode": null,
      "latitude": 29.714,
      "longitude": -95.498,
      "distance_meters": 4200,
      "cuisine_type": "restaurant",
      "chain": null,
      "phone": null,
      "website": null,
      "instagram": null,
      "halal_certification": "community-verified",
      "serves_alcohol": false,
      "community_rating": null,
      "verified": true
    }
  ],
  "meta": {
    "total": 23,                               // total results returned
    "location": {
      "lat": 29.7724614,                       // resolved lat (from zip or input)
      "lng": -95.5119247
    },
    "radius_miles": 5
  }
}

Response Fields

FieldTypeNullableDescription
fsq_idstringnoUnique place ID. Foursquare: hex string. OSM: osm_{nodeId}
namestringnoRestaurant name
sourcestringnofoursquare or openstreetmap
addressstringyesFull formatted address string
citystringyesCity name
statestringyesState abbreviation e.g. TX, NY
postcodestringyesZip/postal code
latitudenumberyesLatitude coordinate
longitudenumberyesLongitude coordinate
distance_metersnumberyesDistance from search point in meters
cuisine_typestringyesCategory e.g. Turkish Restaurant, fast_food
chainstringyesChain name if part of a chain, null otherwise
phonestringyesPhone number
websitestringyesWebsite URL
instagramstringyesInstagram handle (Foursquare only)
halal_certificationstringnounverified · community-verified · halal-only
serves_alcoholbooleanyesfalse if confirmed no alcohol, null if unknown
community_ratingnumberyesCommunity rating 0–5, null if not yet rated
verifiedbooleannotrue if enriched with community data from our database

09

Halal Fields

Understanding halal_certification, serves_alcohol, and verified.

halal_certification — possible values

ValueSourceMeaning
unverifiedFoursquareRestaurant appears halal by name/category but has not been verified by the community.
community-verifiedOpenStreetMapTagged diet:halal=yes by community contributors. Serves halal food among other options.
halal-onlyOpenStreetMapTagged diet:halal=only. The restaurant exclusively serves halal food.

serves_alcohol — possible values

ValueMeaning
falseConfirmed alcohol-free. Tagged drink:alcohol=no in OSM or verified by community.
trueConfirmed serves alcohol.
nullUnknown. No data available from either source.

verified

true if the place has been enriched with data from our community database (halal certification, alcohol policy, or community rating). All OSM places are verified: true. Foursquare places are verified: false unless manually enriched.

10

Filtering

How to filter results for specific use cases.

Only show community-verified halal spots

Use certified_only=true to filter out unverified Foursquare results and only return OSM-tagged places.

GET /api/v1/locations?zip=77024&certified_only=true

Filter by rating

Use min_rating to only return places with a community rating at or above the threshold.

GET /api/v1/locations?zip=77024&min_rating=4

Identify alcohol-free restaurants in code

const alcoholFree = data.data.filter(r => r.serves_alcohol === false);

Sort by distance in code

const sorted = data.data.sort((a, b) => a.distance_meters - b.distance_meters);

11

Error Codes

All possible error responses and how to handle them.

StatusError messageCauseFix
400Missing x-api-key headerNo API key in requestAdd x-api-key header
400Provide either ?zip= or ?lat=&lng=No location paramAdd zip or lat+lng
400Invalid zip codeZip couldn't be geocodedCheck the zip code is valid US
401Invalid API keyKey not found in databaseCheck your key is correct
429Rate limit exceededMonthly limit reachedUpgrade your plan
500Internal server errorServer-side failureRetry or contact support

Error response shape

{ "error": "Error message here" }

12

Rate Limits

Usage limits per plan, resets, and warnings.

PlanRequests/monthPriceAvailable on
Free100$0/moDirect + RapidAPI
Starter2,000$9/moDirect + RapidAPI
Pro10,000$25/moDirect + RapidAPI
Business100,000$59/moDirect + RapidAPI

Monthly reset

Usage resets to 0 on the 1st of every month automatically.

Warning emails

You get an email at 80% and 90% usage so you're never surprised.

Hard limit

At 100% usage all requests return 429 until the next reset or upgrade.

Upgrade your plan →


13

Code Examples

Full working examples in popular languages.

Search by zip code and print names

import requests

API_KEY = "YOUR_API_KEY"

res = requests.get(
    "https://halal-api.vercel.app/api/v1/locations",
    params={"zip": "77024", "radius": 5},
    headers={"x-api-key": API_KEY}
)

data = res.json()
for place in data["data"]:
    print(f"{place['name']} — {place['halal_certification']} ({place['distance_meters']}m)")

Get only alcohol-free, community-verified places near coordinates

import requests

res = requests.get(
    "https://halal-api.vercel.app/api/v1/locations",
    params={
        "lat": 29.7604,
        "lng": -95.3698,
        "radius": 3,
        "certified_only": "true"
    },
    headers={"x-api-key": "YOUR_API_KEY"}
)

data = res.json()
# Further filter for confirmed alcohol-free
clean = [p for p in data["data"] if p["serves_alcohol"] == False]
print(f"Found {len(clean)} alcohol-free verified halal spots")

14

FAQ

Common questions from developers and AI agents.

What countries does the API support?

Currently the API supports the United States only. The zip code geocoder uses US postal codes. Coordinates anywhere in the world will work for Foursquare results, but OSM coverage outside the US may be limited.

How accurate is the halal data?

Foursquare results are based on restaurant name and category keywords — they are unverified and may include non-halal places. OpenStreetMap results are tagged by community contributors and are generally more reliable, but are not official certifications.

Why might the same restaurant appear twice?

Deduplication is done by name match. If a restaurant has slightly different names across Foursquare and OpenStreetMap (e.g. 'Halal Guys' vs 'The Halal Guys'), both may appear. We're improving this over time.

What does fsq_id starting with osm_ mean?

It means the result came from OpenStreetMap, not Foursquare. The ID format is osm_ followed by the OSM node ID. These IDs are stable as long as the OSM node exists.

How do I use this with an AI agent or LLM?

Pass your API key as an environment variable and call the endpoint with a zip or coordinates. The JSON response is structured to be easily parsed. Filter with certified_only=true for higher-confidence results when recommending food to users.

Does the radius parameter affect both data sources?

Yes. Both Foursquare and OpenStreetMap queries use the same radius in meters (converted from your miles input). The maximum is capped at 50,000 meters (~31 miles) for both sources.

Why is my response slow sometimes?

The API queries Foursquare and OpenStreetMap in parallel. OpenStreetMap's Overpass API can occasionally be slow (2–5 seconds). If OSM times out, the response still returns Foursquare results — OSM failures are handled gracefully.