← 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 500 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*Zip or postal code. Works globally. E.g. 77024, EC1A 1BB, 75008
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,

      // --- Category ---
      "cuisine_type": "Turkish Restaurant",
      "chain": null,

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

      // --- Halal classification ---
      "halal_certification": "unverified",
      "halal_status": "UNVERIFIED",            // FULL | PARTIAL | VERBALLY_CONFIRMED | UNVERIFIED
      "alcohol_served": null,                  // true | false | null
      "cross_contamination_protocols": null,   // true | false | null

      // --- Official certification ---
      "certification": {
        "is_certified": false,
        "certified_by": null,                  // e.g. "HFSAA", "HMC", "IFANCA", "MUI"
        "certificate_id": null,
        "expiry_date": null,
        "last_verified_timestamp": null
      },

      "community_rating": null,
      "verified": false
    },
    {
      // Fully certified example
      "fsq_id": "4be555abc",
      "name": "Al-Baik Restaurant",
      "source": "foursquare",
      "halal_status": "FULL",
      "alcohol_served": false,
      "cross_contamination_protocols": true,
      "certification": {
        "is_certified": true,
        "certified_by": "HFSAA",
        "certificate_id": "102938",
        "expiry_date": "2027-01-01",
        "last_verified_timestamp": "2026-06-01T12:00:00Z"
      },
      "verified": true
    },
    {
      // OSM example
      "fsq_id": "osm_987654321",
      "name": "Bismillah Restaurant & Cafe",
      "source": "openstreetmap",
      "halal_status": "FULL",
      "halal_certification": "community-verified",
      "alcohol_served": false,
      "cross_contamination_protocols": null,
      "certification": {
        "is_certified": false,
        "certified_by": null,
        "certificate_id": null,
        "expiry_date": null,
        "last_verified_timestamp": null
      },
      "verified": true
    }
  ],
  "meta": {
    "total": 23,
    "location": { "lat": 29.7724614, "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 (legacy)
halal_statusstringnoFULL · PARTIAL · VERBALLY_CONFIRMED · UNVERIFIED
alcohol_servedbooleanyestrue/false if known, null if unknown
cross_contamination_protocolsbooleanyestrue if separate grills/fryers for halal meat, null if unknown
certification.is_certifiedbooleannotrue if officially certified by a halal body
certification.certified_bystringyesCertifying body e.g. HFSAA, HMC, IFANCA, MUI
certification.certificate_idstringyesOfficial certificate number
certification.expiry_datestringyesCertificate expiry (YYYY-MM-DD)
certification.last_verified_timestampstringyesISO 8601 timestamp of last verification
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_status — nuanced halal classification

ValueMeaning
FULLEntire menu is halal. No pork or alcohol on premises. Highest trust level.
PARTIALSome halal items available (e.g. only the chicken), but non-halal items or pork are also served in the same kitchen.
VERBALLY_CONFIRMEDStaff claims food is halal but no official certificate is posted or verifiable.
UNVERIFIEDNo halal status data available. Restaurant appears halal by name/category only.

alcohol_served

ValueMeaning
falseConfirmed alcohol-free. Safe for users who avoid restaurants that serve alcohol.
trueAlcohol is served on premises. Some users will avoid even if the food is halal.
nullUnknown. No data available.

cross_contamination_protocols

true means the kitchen uses separate grills, fryers, and utensils for halal meat versus non-halal meat or pork. Critical for users with strict halal standards. null if unknown.

certification object

FieldDescription
is_certifiedtrue if an official halal certificate exists
certified_byName of certifying body: HFSAA, HMC, IFANCA, MUI, JAKIM, etc.
certificate_idOfficial certificate number for verification
expiry_dateCertificate expiry date in YYYY-MM-DD format
last_verified_timestampWhen we last verified this certificate (ISO 8601)

Common certifying bodies: HFSAA (US), HMC (UK), IFANCA (US/Global), MUI (Indonesia), JAKIM (Malaysia), HFA (UK)

verified

true if the place has been enriched with data from our community database. 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
Free500$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?

The API works globally. Pass any postal code (US zip, UK postcode, etc.) or lat/lng coordinates anywhere in the world. OSM community coverage is strongest in North America and Europe, but growing worldwide. Foursquare covers 100M+ places globally.

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.