Scrappa's GET /api/metroscubicos/search returns Metros Cubicos property listings in Mexico as structured JSON, for sale (operation=sale, the default) or for rent (rent).
What you get
One request returns one page of up to 48 listings and the site's own match count in total. Each listing has id, url (the public listing page on Mercado Libre Mexico, the source of the data; its id feeds the listing endpoint), title, price (amount, currency, from for developments), attributes (bedrooms, bathrooms, parking and area as ranges plus the raw card text), location text, one image, and development fields (is_development, delivery, units_available). Search cards carry no coordinates. Call the listing endpoint for the description, fees, coordinates and all photos.
Filters are honoured
The site applies every filter itself. Scrappa then checks each card once more against price, bedrooms, bathrooms and area and drops a card whose own values contradict the filter. The number of dropped cards is meta.filtered_out, so a page can hold fewer than 48 listings. total stays the site's count and does not shrink by filtered_out. A card that does not show a value (a studio shows no bedrooms, many cards show no area) cannot be contradicted and stays.
- Developments show ranges such as
2 a 3 dormitorios. They are kept when the range contains the requested bedrooms. bathroomscounts full bathrooms. A card may count half bathrooms too and show a higher number.price_minandprice_maxare in MXN. The area is checked only when the card shows the same kind of area (builtortotal).bedrooms=4means four or more.bathrooms=3means three or more.- Unknown parameters are rejected with
422instead of being ignored.applied_filtersechoes what was sent.
Locations
state takes a slug from /api/metroscubicos/locations, for example jalisco. city takes a city or borough slug of that state and needs state. An unknown state or city returns a non-billable 422 (unknown_location). Without state the search covers all of Mexico.
Sort and pagination
sort is default (relevance), price_asc or price_desc. page is 1-based with 48 listings per page. The site serves the first 42 pages of any search, so page goes up to 42; narrow the filters to reach other listings. A page past the last result page returns an empty list with total 0. It never returns another page's listings.
Run this endpoint
Endpoint
Parameters
Start with the required fields, then add optional filters only when your use case needs them.
Runnable path
This endpoint has no required query parameters.
13 optional filters available.
string
Optional
sale (default) or rent.
sale
string
Optional
apartment (default), house, land, office, commercial, warehouse, building, room, ranch or hacienda.
apartment
string
Optional
State slug from /api/metroscubicos/locations, for example jalisco or distrito-federal.
distrito-federal
string
Optional
City or borough slug of the state from /api/metroscubicos/locations?state=..., for example zapopan. Needs state.
example
integer
Optional
Minimum price in MXN.
10
integer
Optional
Maximum price in MXN.
6000000
integer
Optional
0 (studio) to 4 (four or more).
2
integer
Optional
Full bathrooms, 1 to 3 (three or more).
10
number
Optional
Minimum area in square metres.
10
number
Optional
Maximum area in square metres.
10
string
Optional
built (default) or total. Land searches use total by default. Needs area_min or area_max.
example
string
Optional
default, price_asc or price_desc.
price_asc
integer
Optional
Result page, 1 to 42. 48 listings per page.
1
Request Examples
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: YOUR_API_KEY_HERE"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
<?php
use Illuminate\Support\Facades\Http;
$response = Http::timeout(30)
->withHeaders(['x-api-key' => 'YOUR_API_KEY_HERE'])
->get('https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc');
if ($response->successful()) {
echo $response->body();
} else {
echo "Error: " . $response->status();
}
const options = {
method: 'GET',
headers: {
'x-api-key': 'YOUR_API_KEY_HERE'
}
};
fetch('https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc', options)
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.text();
})
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
const axios = require('axios');
const options = {
method: 'GET',
url: 'https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc',
headers: {
x-api-key: 'YOUR_API_KEY_HERE',
}
};
try {
const response = await axios(options);
console.log(response.data);
} catch (error) {
console.error('Error:', error.message);
}
require 'net/http'
require 'uri'
uri = URI.parse("https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'
request = Net::HTTP::Get.new(uri.request_uri)
request['x-api-key'] = 'YOUR_API_KEY_HERE'
begin
response = http.request(request)
puts response.body
rescue => e
puts "Error: #{e.message}"
end
import http.client
import json
conn = http.client.HTTPSConnection("scrappa.co")
headers = {
'x-api-key': 'YOUR_API_KEY_HERE',
}
try:
conn.request("GET", "/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
except Exception as e:
print(f"Error: {e}")
finally:
conn.close()
import requests
headers = {
'x-api-key': 'YOUR_API_KEY_HERE',
}
try:
response = requests.get('https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc', headers=headers)
response.raise_for_status()
print(response.text)
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
public class ApiExample {
public static void main(String[] args) {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc")
.addHeader("x-api-key", "YOUR_API_KEY_HERE")
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
System.out.println(response.body().string());
} else {
System.out.println("Error: " + response.code());
}
} catch (IOException e) {
System.out.println("Error: " + e.getMessage());
}
}
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", "https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc", nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("x-api-key", "YOUR_API_KEY_HERE")
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println(string(body))
}
#!/bin/bash
curl -X GET \
-H "x-api-key: YOUR_API_KEY_HERE" \
"https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc"
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY_HERE");
try
{
var response = await client.SendAsync(new HttpRequestMessage(HttpMethod.Get, "https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc"));
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
import axios from 'axios';
async function run(): Promise<void> {
try {
const response = await axios({
method: 'GET',
url: 'https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc',
headers: {
'x-api-key': 'YOUR_API_KEY_HERE',
},
});
console.log(response.data);
} catch (error) {
console.error('Error:', error);
}
}
void run();
use reqwest::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let response = client
.get("https://scrappa.co/api/metroscubicos/search?operation=sale&type=apartment&state=distrito-federal&bedrooms=2&price_max=6000000&sort=price_asc")
.header("x-api-key", "YOUR_API_KEY_HERE")
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
Response Schema
Example response fields are illustrative; inspect the JSON before integrating.
Example response fields
Scan these fields before integrating.
success
total
returned
pagination
applied_filters
listings
meta
Common listings fields
id
title
url
headline
{
"success": true,
"total": 3120,
"returned": 1,
"pagination": {
"page": 1,
"limit": 48,
"pages_count": 42,
"has_next_page": true,
"has_previous_page": false
},
"applied_filters": {
"operation": "sale",
"type": "apartment",
"state": "distrito-federal",
"bedrooms": 2,
"price_max": 6000000,
"sort": "price_asc"
},
"listings": [
{
"id": "MLM-6326040252",
"title": "Splendor Coyoacan",
"url": "https://departamento.mercadolibre.com.mx/MLM-6326040252-splendor-coyoacan-_JM",
"headline": "Departamento en venta",
"is_development": true,
"price": {
"amount": 5371700,
"currency": "MXN",
"from": true
},
"attributes": {
"bedrooms": {
"min": 2,
"max": 3
},
"bathrooms": {
"min": 2,
"max": 2
},
"parking": null,
"area": {
"min": 64,
"max": 95,
"kind": "built"
},
"raw": [
"2 a 3 dormitorios",
"2 ba\u00f1os",
"64 - 95 m\u00b2 construidos"
]
},
"location": "Avenida Divisi\u00f3n Del Norte 2325, Benito Ju\u00e1rez, Distrito Federal",
"image": "https://http2.mlstatic.com/D_NQ_NP_2X_666237-MLM118578393547_102026-E.webp",
"delivery": "Pronta entrega",
"units_available": "3 unidades disponibles",
"featured": true,
"seller": null
}
],
"meta": {
"endpoint_family": "search",
"billable": true,
"attempts": 1,
"filtered_out": 2
}
}
Errors
Handle these documented responses before retrying or showing customer-facing failures.
Unknown Location
The `state` or `city` slug is not known to Metros Cubicos (`unknown_location`). The site would turn it into a text search, so the request is rejected. Non-billable.
{
"meta": {
"attempts": 0,
"billable": false,
"retryable": false,
"endpoint_family": "search"
},
"error": {
"code": "unknown_location",
"message": "Unknown location. Use a state or city slug from /api/metroscubicos/locations."
},
"success": false
}Validation Error
A query parameter is missing, unknown or unusable. Unknown parameters are rejected, never ignored. Non-billable.
{
"errors": {
"type": [
"The selected type is invalid."
]
},
"message": "The selected type is invalid."
}Upstream Unavailable
Metros Cubicos could not be reached after retries, answered with an error, or returned an unexpected answer (`upstream_unavailable`, `upstream_blocked`, `upstream_changed`). Retryable and never billed. Clients are never rate limited.
{
"meta": {
"attempts": 4,
"billable": false,
"retryable": true,
"endpoint_family": "search"
},
"error": {
"code": "upstream_unavailable",
"message": "Metros Cubicos is temporarily unavailable. Please retry."
},
"success": false
}Generate Code with AI
Copy a ready-made prompt with all the endpoint details, parameters, and example responses. Paste it into ChatGPT, Claude, or any AI assistant to instantly generate working code.
Try It Live
Test this endpoint in our interactive playground with real data.