A user interface showing a complex set of filters and sorting options for a property search, demonstrating the power of granular API queries.

Unlocking Granular Insights: Advanced Filtering and Sorting with the AirROI API

by Jun ZhouFounder at AirROI
Published: July 28, 2025
Updated: July 29, 2025

In the world of real estate data, the quality of your insights is determined by the quality of your queries. Anyone can search for 2-bedroom properties in a city. But can you find all 3+ bedroom, non-owner-occupied, waterfront properties with a hot tub and a TTM revenue over $100k, sorted by highest occupancy first? With AirROI's API, you can.

This guide provides a deep dive into the advanced filtering and sorting capabilities of our API, empowering you to build highly specific, granular queries that uncover the niche investment opportunities others miss.

The Power of Compound Filters

The AirROI API allows you to combine multiple filter conditions in a single query, using a simple and intuitive JSON object. All filters are ANDed together, allowing you to progressively narrow your search to the most relevant properties.

Example: Finding High-Performing, Family-Friendly Luxury Homes

Let's construct a query to find properties that meet a very specific investment thesis: luxury homes suitable for families, with proven high performance.

// This query hones in on a very specific, high-value market segment
const advancedQuery = {
  market: {
    country: "US",
    region: "Florida",
    locality: "Orlando",
  },
  filter: {
    // Property Type & Size
    room_type: { eq: "entire_home" },
    bedrooms: { gte: 4 },
    guests: { gte: 10 },

    // Luxury & Family-Friendly Amenities
    amenities: { all: ["pool", "kitchen", "wifi"] },
    amenities: { any: ["game_console", "pool_table", "crib"] },

    // Proven Performance
    ttm_revenue: { gte: 120000 },
    ttm_occupancy: { gte: 0.75 },
    rating_overall: { gte: 4.9 },
    num_reviews: { gte: 50 },

    // Host Quality
    superhost: { eq: true },
  },
  sort: {
    ttm_revenue: "desc",
    rating_overall: "desc",
  },
  pagination: {
    page_size: 25,
  },
};

async function runAdvancedSearch(apiKey, query) {
  const response = await fetch(
    "https://api.airroi.com/listings/search/market",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "X-API-KEY": apiKey,
      },
      body: JSON.stringify(query),
    },
  );
  const data = await response.json();

  console.log(
    `Found ${data.pagination.total_count} properties matching your niche criteria.`,
  );
  return data.data;
}

This single API call replaces hours of manual searching and spreadsheet filtering, allowing you to instantly identify properties that fit even the most specific investment profiles.

Multi-Level Sorting: Prioritizing What Matters Most

Finding the right properties is only half the battle. You also need to rank them effectively. The AirROI API allows you to sort by up to five different fields, each with its own direction (asc or desc). This enables you to create a nuanced ranking system that reflects your unique priorities.

Example: Sorting for a Balance of Revenue, Ratings, and Value

Imagine you want to find properties that are high-earning and well-regarded, but you also want to favor those with a lower cleaning fee, which might indicate a better value for guests and potentially higher occupancy.

# This query finds top properties, with a tie-breaker for lower cleaning fees
multi_level_sort_query = {
    "market": {
        "country": "US",
        "region": "California",
        "locality": "Lake Tahoe"
    },
    "filter": {
        "bedrooms": {"gte": 3},
        "amenities": {"any": ["hot_tub", "fireplace", "ski_in_ski_out"]}
    },
    "sort": {
        "ttm_revenue": "desc",       # Primary sort: Highest revenue
        "rating_overall": "desc",  # Secondary sort: Best reviews
        "ttm_occupancy": "desc",     # Tertiary sort: Highest occupancy
        "cleaning_fee": "asc"       # Tie-breaker: Lowest cleaning fee
    }
}

# You would then send this query to the /listings/search/market endpoint
# The results will be perfectly ordered according to your priorities.
This ability to create a custom sorting hierarchy is a game-changer for building sophisticated analysis tools, property recommendation engines, and even the basis for a dynamic pricing model.

Practical Applications for Advanced Queries

  • Niche Strategy Identification: Discover underserved market segments (e.g., "pet-friendly homes with EV chargers").
  • Competitor Set Analysis: Create a hyper-specific list of your true competitors by filtering for properties with the same amenities, size, and performance level.
  • Automated Deal Sourcing: Run a script that continuously queries for new listings that meet your exact investment criteria.
  • Building Recommendation Engines: Use multi-level sorting to create a "For You" page for investors, ranking properties based on their stated preferences.

Conclusion: Ask Better Questions, Get Better Answers

The depth and flexibility of the AirROI API's filtering and sorting capabilities are designed for one purpose: to allow you to ask better, more specific questions of the data. The more granular your queries, the more unique and valuable your insights will be.

Stop skimming the surface with generic searches. Dive deep, get specific, and start uncovering the hidden opportunities that others are missing. The power to build a truly intelligent property search engine is in your hands.