Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bayut API Python Examples

Working Python examples for the Bayut Property Data API: search Dubai and UAE property listings for sale and rent, look up off-plan projects, pull agent and agency profiles, and read historical sale transactions. Everything comes back as clean JSON over a normal REST API, so there is no scraping, no headless browser, and no proxy rotation to maintain.

Built and maintained by Happy Endpoint. Full API reference at bayutapi.dev.


What is the Bayut API?

Bayut is the largest property portal in the UAE. This API gives you programmatic access to its data: listings for sale and rent across Dubai, Abu Dhabi, Sharjah and the rest of the UAE, off-plan development projects, real estate agents and agencies, and historical transaction records.

  • UAE-wide coverage
  • Clean JSON responses, no HTML parsing
  • Available on RapidAPI with a free tier

Getting started

1. Get an API key

Subscribe to the API on RapidAPI. There is a free plan: https://rapidapi.com/happyendpoint/api/uae-real-estate3/

2. Install

git clone https://github.com/happyendpointhq/bayut-api-python-examples.git
cd bayut-api-python-examples
python -m venv .venv && source .venv/bin/activate
pip install -e .

Installing with -e . puts the bayut package on your path, which is what lets the example scripts import it. Requires Python 3.9 or newer.

3. Add your key

cp .env.example .env
# then edit .env and paste your key

4. Run an example

python examples/02_location_autocomplete.py "dubai marina"
python examples/01_search_properties.py

Examples

Each script runs standalone. They share a small client in bayut/client.py that handles auth, retries, rate limiting, and error messages.

Script What it does
01_search_properties.py Search listings by area, price, type, and bedrooms
02_location_autocomplete.py Turn a place name into the location ID every other endpoint needs
03_property_details.py Full record for a single property, including amenities
04_offplan_projects.py Off-plan and new developments, filtered by payment plan
05_transactions.py Historical sale transactions with price per sqm
06_agents.py Search agents by area and pull their profiles
07_rental_yield.py Compare gross rental yield across Dubai areas
08_pagination.py Walk every page of a result set safely
09_export_csv.py Export search results to CSV for analysis

The short version

from bayut import BayutClient

client = BayutClient()          # reads RAPIDAPI_KEY from the environment

# Find the location ID for an area
locations = client.autocomplete("dubai marina")["locations"]
location_id = locations[0]["externalID"]

# Search it
result = client.search_properties(
    purpose="for-sale",
    location_id=location_id,
    property_type="apartments",
    rooms="1",
    price_max=1_500_000,
)

print(f"{result['total']:,} properties")
for prop in result["properties"][:5]:
    print(prop["title"]["en"], f"AED {prop['price']:,}")

Endpoint reference

Endpoint Returns
GET /autocomplete Location search. Returns the externalIDs other endpoints need
GET /search-property Listings for sale or rent
GET /property-details Full record for one property
GET /search-new-projects Off-plan and new development projects
GET /agent-search Agents by location
GET /agent-search-by-name Agents by name
GET /agent-details Full agent profile
GET /agent-properties All listings from one agent
GET /agency-search Agencies by location
GET /agency-search-by-name Agencies by name
GET /agency-details Full agency profile
GET /agency-agents Agents within an agency
GET /agency-properties All listings from one agency
GET /developer-search-by-name Developers by name
GET /transactions Historical transaction data
GET /amenities-search Amenity names available as search filters

Common location IDs

Every ID below was verified against /autocomplete. Listing counts are approximate and move over time.

Area externalID Listings
Dubai (whole emirate) 5002 ~295,000
Abu Dhabi (whole emirate) 6020 ~19,600
Jumeirah Village Circle (JVC) 5416 ~31,600
Business Bay 5093 ~23,900
Downtown Dubai 6901 ~11,400
Dubai Marina 5003 ~11,100
Dubai Hills Estate 8288 ~7,700
Jumeirah Lake Towers (JLT) 5152 ~7,300
Palm Jumeirah 5460 ~5,700

Use /autocomplete for anywhere else. A wrong location ID returns a different area rather than an error, so it is worth confirming rather than guessing.


Response shape notes

Worth knowing before you write parsing code, because the endpoints are not consistent with one another.

title has two shapes. /search-property returns {"title": {"en": "..."}}, while /property-details returns "title": "..." as a plain string with translations in title_l1 through title_l14. Use title_of() from this package to read either.

Agent endpoints use different casing. The property endpoints use camelCase (externalID, completionStatus). The agent endpoints use snake_case (agent_name_en, agency_name_en) and return a plain list rather than an object with a total.

Transactions are Algolia-shaped. /transactions returns hits, nbHits, and nbPages rather than the properties and totalPages the search endpoints use.

Amenities are nested two levels deep. /property-details returns amenity groups such as "Health and Fitness", each holding an amenities list with the actual entries such as "Gym or Health Club". Reading only the group's text gives you category names, not amenities. Use amenity_names().

/property-details is slow. It routinely takes over 30 seconds, unlike the search endpoints which return in well under a second. The client raises its timeout automatically for that call.


Using the API from Claude, Cursor, or another MCP client

RapidAPI exposes a hosted MCP server, so you can query this API from an AI assistant without writing any code. Add this to your MCP client configuration and replace the placeholder with your RapidAPI key:

{
  "mcpServers": {
    "Bayut UAE Real Estate": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://mcp.rapidapi.com",
        "--header",
        "x-api-host: uae-real-estate3.p.rapidapi.com",
        "--header",
        "x-api-key: YOUR_RAPIDAPI_KEY"
      ]
    }
  }
}

Config file locations:

Client Path
Claude Desktop (macOS) ~/Library/Application Support/Claude/claude_desktop_config.json
Claude Desktop (Windows) %APPDATA%\Claude\claude_desktop_config.json
Cursor ~/.cursor/mcp.json
Claude Code .mcp.json in your project root

Once connected you can ask questions in plain language, such as "what is the median asking price for a 1-bed in Dubai Marina" or "list off-plan projects in JVC under 1 million AED", and the assistant will call the endpoints itself.


FAQ

Do I need to scrape Bayut to get this data?

No. That is the point of the API. Scraping property portals means maintaining selectors that break, rotating proxies, and handling bot detection, and it puts you on the wrong side of most portals' terms. This is a REST API that returns JSON.

Is there a free tier?

Yes. RapidAPI hosts a free plan with a monthly request quota, which is enough to run every example in this repo and build a prototype.

How do I find the location ID for an area?

Call /autocomplete with the area name. It returns matching locations with their externalID, which is what /search-property and the other endpoints expect. See 02_location_autocomplete.py.

What is the difference between listings and transactions?

Listings are asking prices, what sellers currently want. Transactions are what property actually sold for. If you are doing valuation or investment analysis, transactions are the more honest number. See 05_transactions.py.

Can I get bulk historical data instead of calling the API?

Yes. Happy Endpoint sells bulk Bayut datasets of 100K+ records as a one-off file. Email happyendpointhq@gmail.com, or see happyendpoint.com/datasets.

Why am I getting a 403?

Usually your RapidAPI plan does not cover that endpoint, or the monthly quota is used up. The client raises a BayutAPIError with that explanation rather than a bare stack trace.

Can I use this API without writing code?

Yes, two ways. Import the Postman collection and click through the endpoints, or connect the RapidAPI MCP server to Claude or Cursor and ask questions in plain language. See the MCP section above.

Why do my search results look like a different area?

Almost always a wrong location ID. The API returns results for whatever ID you sent rather than rejecting an unexpected one, so a mistyped ID silently gives you another neighbourhood. Confirm with /autocomplete first. The table above lists verified IDs for the common Dubai areas.

Does this cover other UAE property portals?

PropertyFinder has its own API. See propertyfinder-api.


Related repos


Disclaimer

Happy Endpoint is an independent provider. This project is not affiliated with, endorsed by, sponsored by, or connected to any of the websites, platforms, retailers, or marketplaces referenced here or reachable through the underlying APIs.

All product names, brands, trademarks, and registered trademarks are the property of their respective owners. Any reference to them is descriptive only, to identify the subject matter of the data, and does not imply any association or endorsement.

Users are responsible for ensuring their use of any data complies with applicable laws and the terms of service of the relevant source.


About Happy Endpoint

Happy Endpoint builds and maintains real-time data APIs for property portals, retailers, and marketplaces. All APIs are available on RapidAPI with a free tier.

Licence

MIT. See LICENSE.

About

Python examples for the Bayut API: search Dubai and UAE property listings, agents, agencies, and transactions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages