Understand an area · Use case
How do I analyse a zip code or postcode area with Casafari?
To analyse a postcode with Casafari, turn it into places or a boundary. Location Lookup's GET /v1/locations/search with postcode returns the location ids it covers (Spain, France partly, parts of Lisbon) for Area Insights and Property Sourcing. For an exact polygon, the Legacy API's POST /api/v1/references/zipcode-boundary returns the boundary, which comparables_get_comparables accepts.
Products: References, Comparables & Valuation, Property Sourcing, New Market Leads
Short answer
Two routes lead from a postcode to an analysis:
- Location ids, on the platform. Location Lookup's
GET /v1/locations/searchtakes apostcodeand returns the places it covers, smallest area first. Theirlocation_idvalues go into Area Insights and Property Sourcing'sPOST /v1/property-sourcing/searches. Postcodes are covered in Spain, partly in France and in parts of Lisbon. - A polygon, on the Legacy API.
POST /api/v1/references/zipcode-boundaryreturns the boundary of a zip code; the platform has no route for it yet.comparables_get_comparablestakes that boundary aslocation_boundary.polygon. On the Legacy API, property search takes it ascustom_location_boundaryand alert search ascustom_location.
Area Insights over MCP is different: it takes location ids or a circle, not polygons.
Steps
Look up the postcode: GET /v1/locations/search with postcode
Send
GET https://platform.casafari.com/v1/locations/searchwith a platform API key (platform API keys) and:postcode, for example28019.postcode_match:exact(the default) orprefixto match the start of a code.country:ES,FRorPT, when you know it.
Over MCP,
locations_searchdoes the same. The parameters are on the operation page.Use the returned
location_idvalues in Area Insights (custom_location_boundary.location_ids, up to 10) or inPOST /v1/property-sourcing/searches(location_ids, 1 to 100).
Legacy API: POST /api/v1/references/zipcode-boundary with zip_code and country_code
For the exact polygon, existing clients on the Legacy API (api.casafari.com, contract clients, its own sign-in: how to sign in) send
POST /api/v1/references/zipcode-boundarywith:zip_code.country_code(ISO 3166-1 alpha-2).
The platform has no route for zip-code boundaries yet. The response format is documented on the operation page.
Pass the polygon: comparables_get_comparables location_boundary.polygon (first and last points match, at least 4)
Call
comparables_get_comparables, orPOST /v1/comparables/searchover REST, withlocation_boundary.polygon. The polygon must meet these rules:- It is a list of
latitudeandlongitudeobjects. - It has at least 4 points.
- The first and last points are the same.
Also send the required
comparables_count(1 to 50),operationandcomparables_types.- It is a list of
Search inside the postcode: POST /v1/property-sourcing/searches by location ids; polygons on the Legacy API
- On the platform, search the postcode's places with
POST /v1/property-sourcing/searchesand thelocation_idsfrom step 1. The platform search takes no custom polygon. - On the Legacy API,
POST /api/v2/properties/searchtakes the polygon ascustom_location_boundary, and alert search,POST /api/v1/listing-alerts/search, takes it ascustom_location. Alert search also acceptscustom_locations, a list of polygons, for several postcodes at once. The platform has no route for alerts yet.
Reverse lookup: GET /v1/locations/by-coordinates
- To find which locations in Casafari's location tree contain a point, call Location Lookup's
GET /v1/locations/by-coordinates. Its parameters are on the operation page.
Example: a Lisbon postcode
Goal: "What are 2-bedroom apartments for sale in postcode 1200, Lisbon, worth?"
First, look the postcode up on the platform with GET /v1/locations/search, postcode 1200, postcode_match prefix and country PT. Portuguese postcodes are covered only in parts of Lisbon, so the answer may be empty; when it returns places, their ids feed Area Insights and Property Sourcing.
For the exact boundary, an existing client requests it from the Legacy API:
{"zip_code": "1200", "country_code": "PT"}Then the boundary's points go into comparables_get_comparables, over MCP, or POST /v1/comparables/search over REST:
{
"comparables_count": 20,
"location_boundary": {"polygon": [
{"latitude": LAT_1, "longitude": LON_1},
{"latitude": LAT_2, "longitude": LON_2},
{"latitude": LAT_3, "longitude": LON_3},
{"latitude": LAT_1, "longitude": LON_1}
]},
"operation": "sale",
"comparables_types": ["apartment"],
"bedrooms": 2
}In practice, the polygon carries every boundary point, closed on the first one. Read the result in this order:
estimated_pricesfor a value range:fast_sell_price,fair_market_priceandout_of_market_price.statisticsforaverage_price_per_sqmandaverage_time_on_the_market.resultsfor the comparable properties, each with asimilarity_scorebetween 0 and 1.
The figures come from the live calls; these docs publish none.
How to read the result
distance is not calculated for polygon searches
In polygon searches, distance in each comparable is not calculated. Rank comparables by similarity_score, which shows how close each property's parameters are to the ones you requested.
Location breadcrumbs for the containing district
Each comparable carries location and locations_structure. locations_structure lists every parent location up to the country, and both include zip_codes where known. Use them to name the district that contains the postcode. Over MCP, locations_search returns the same kind of parent chain as breadcrumbs.
Limits
Availability on the self-serve Casafari API and MCP Platform, with a platform API key:
- Location Lookup:
GET /v1/locations/searchby name or postcode,GET /v1/locations/by-coordinates, get by id and children (the MCP toolslocations_searchandlocations_get). It returns no zip-code boundary. comparables_get_comparablesandPOST /v1/comparables/search, which accept the polygon.- Property Sourcing's
POST /v1/property-sourcing/searches, by location ids.
Legacy API only, for contract clients; the platform has no route for these yet:
- The zip-code boundary,
POST /api/v1/references/zipcode-boundary. - Polygon search in
POST /api/v2/properties/search. - Alert search,
POST /api/v1/listing-alerts/search.
Coverage:
- Spanish cadastral references are an alternative target point in
comparables_get_comparables; that input is Spain only. - See per-tool coverage.
Postcode lookup covers Spain, part of France and parts of Lisbon
GET /v1/locations/search finds places by postcode in Spain, partly in France and in parts of Lisbon; other countries have no postcodes, and asking one of them for a postcode answers 400. One postcode can match several places, smallest area first. Two-digit Spanish province prefixes are not postcodes.
Area Insights MCP boundaries are location ids or a circle, not polygons
The Area Insights MCP tools take location_ids (up to 10) or a circle of 50 to 50,000 metres. A zip-code polygon cannot be passed to them directly.
Questions
Can I get a price trend for a single postcode?
Approximately. Where postcodes are covered, find the places with GET /v1/locations/search and postcode, or locations_search over MCP, and pass their ids to area-insights_get_time_series_data. Area Insights tools take location ids or a circle, not polygons, so elsewhere pass a circle of 50 to 50,000 metres centred inside the postcode. Neither follows the postcode's exact boundary.
Which countries does the zip-code boundary operation support?
The hub publishes no country list for the Legacy API's POST /api/v1/references/zipcode-boundary. The operation takes a zip_code and an ISO 3166-1 alpha-2 country_code. The API's permissions cover 16 markets, but support for a given country's postcodes is not stated. Check the operation page or ask Casafari at https://www.casafari.com/ before you rely on a specific country.
Can I search several postcodes at once?
It depends on the operation. POST /v1/property-sourcing/searches takes up to 100 location_ids, so the places of several postcodes fit in one search. On the Legacy API, alert search accepts custom_locations, a list of closed polygons. comparables_get_comparables takes one polygon or one circle per request, so for comparables run one request per postcode.
How do I find the location id for a postcode?
Send GET /v1/locations/search with postcode (postcode_match exact or prefix), or call Location Lookup's locations_search over MCP. It returns the places the postcode covers, smallest area first: Spain is covered fully, France partly and Portugal in parts of Lisbon. Comparables results also show zip_codes inside each location.