Mubawab APImubawab.ma ↗
Search and retrieve apartment-for-sale listings across Moroccan cities via the Mubawab.ma API. Get prices, rooms, bathrooms, seller info, and more.
What is the Mubawab API?
The Mubawab.ma API provides 2 endpoints to search and inspect apartment-for-sale listings across major Moroccan cities. The search_apartments_for_sale endpoint returns paginated results with listing IDs, titles, prices, and URLs, while get_listing_details exposes up to 9 structured fields per property including room counts, surface data, seller name, currency, and location. Both regular listings and promoted project entries are covered.
curl -X GET 'https://api.parse.bot/scraper/56aec35b-5e3a-491d-8543-287613d93fd9/search_apartments_for_sale?city=casablanca&page=1' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace mubawab-ma-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Mubawab Real Estate API — search apartments and get details."""
from parse_apis.mubawab_real_estate_api import Mubawab, City_, ListingNotFound
client = Mubawab()
# Search apartments in Casablanca — limit caps total items fetched.
for listing in client.city(City_.CASABLANCA).search_apartments(limit=5):
print(listing.title, listing.price)
# Drill-down: take one listing and fetch its full details.
summary = client.city(City_.RABAT).search_apartments(limit=1).first()
if summary:
detail = summary.details()
print(detail.title, detail.price, detail.currency)
print(detail.bedrooms, detail.surface_area, detail.location)
# Typed error handling: catch ListingNotFound for invalid URLs.
try:
bad_summary = client.city("marrakech").search_apartments(limit=1).first()
if bad_summary:
info = bad_summary.details()
print(info.seller, info.rooms)
except ListingNotFound as exc:
print(f"Listing gone: {exc.url}")
print("exercised: city / search_apartments / details / ListingNotFound")
Search for apartments for sale in a specific Moroccan city. Returns paginated listings with title, price, URL, and listing ID. Results include both individual listings and promoted project listings (projects may have null listing_id). Paginate by incrementing the page parameter.
| Param | Type | Description |
|---|---|---|
| city | string | City slug to search in (e.g. casablanca, rabat, marrakech, tanger, agadir) |
| page | integer | Page number for pagination, must be a positive integer |
{
"type": "object",
"fields": {
"city": "string, city slug used in the search",
"page": "integer, current page number",
"listings": "array of listing objects with id, url, title, and price"
},
"sample": {
"data": {
"city": "casablanca",
"page": 1,
"listings": [
{
"id": "8148178",
"url": "https://www.mubawab.ma/fr/pa/8148178/appartement-neuf",
"price": "1 021 270 DH",
"title": "Appartement neuf à vendre à Nozha"
},
{
"id": "8345081",
"url": "https://www.mubawab.ma/fr/a/8345081/appartement-2-chambres",
"price": "1 390 000 DH",
"title": "Appartement 2 Chambres Haut Standing"
}
]
},
"status": "success"
}
}About the Mubawab API
Search Apartments by City
The search_apartments_for_sale endpoint accepts a city slug — such as casablanca, rabat, marrakech, tanger, or agadir — and an integer page parameter for pagination. Each result in the listings array includes the listing id, url, title, and price. Note that promoted project listings may return a null listing_id; your code should handle this case before passing IDs downstream.
Retrieve Full Listing Details
Pass any url value from a search result into get_listing_details to retrieve the complete property record. The response includes price (numeric, in currency such as MAD), rooms, bedrooms, bathrooms, location (city or neighborhood string), seller name or agency, and a listing_id string. Fields that the listing does not publish — such as bathrooms or seller — will return null rather than being omitted, so response shapes are consistent.
Coverage and Pagination
The API covers apartment-for-sale listings. Pagination is controlled entirely by the page integer; increment it to retrieve subsequent pages until the listings array returns fewer results than a full page. There is no separate endpoint for total result counts, so termination logic should be based on response length.
The Mubawab API is a managed, monitored endpoint for mubawab.ma — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when mubawab.ma changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official mubawab.ma API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a price-comparison tool for apartments across Casablanca, Rabat, and Marrakech using the
priceandlocationfields. - Track listing inventory changes over time by polling
search_apartments_for_salefor a given city slug and storing returnedlisting_idvalues. - Enrich a CRM with seller or agency names by feeding listing URLs into
get_listing_detailsand extracting thesellerfield. - Filter properties by bedroom count for a buyer-facing search UI using the
bedroomsfield fromget_listing_details. - Aggregate median apartment prices by neighborhood using the
locationandpricefields across paginated search results. - Identify promoted project listings in search results by detecting entries where
listing_idis null. - Feed listing URLs and phone availability into a lead-qualification pipeline for real estate agents operating in Morocco.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Mubawab.ma have an official developer API?+
What does `get_listing_details` return that the search endpoint does not?+
id, url, title, and price per listing. get_listing_details adds rooms, bedrooms, bathrooms, seller, currency, location, and listing_id — fields that are only available on the individual listing page.Are rental listings or property types other than apartments for sale covered?+
How does pagination work, and is there a total result count returned?+
page integer parameter in search_apartments_for_sale. The response does not include a total result count or page count field. To paginate fully, increment page until a response returns an empty or undersized listings array.Is nationwide coverage across all Moroccan cities supported, or only the listed slugs?+
casablanca, rabat, marrakech, tanger, and agadir. Listings from other Moroccan cities are not guaranteed to be accessible through the current city parameter. You can fork the API on Parse and revise it to test or add additional city slugs.