> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.repliers.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Using contains: and notContains: Prefixes in API Filters

## Overview

The Repliers API supports powerful `contains:` and `notContains:` operators that allow you to filter properties based on specific values within. These operators work with any string and array feilds, making it easy to find properties that include or exclude particular amenities, basement types, features, or other multi-value attributes.

Unlike exact value matching, these operators perform partial matching within composite fields, giving you fine-grained control over your search results.

## Basic Usage

To find properties that contain a specific value within a field, use the `contains:` prefix. To exclude properties containing a specific value, use the `notContains:` prefix.

### Syntax

```
field_name=contains:value_to_match
field_name=notContains:value_to_exclude
```

### Example

To find all properties with a "Finished" basement type:

```
https://api.repliers.io/listings?details.basement=contains:Finished
```

To find all properties that do not have a "Finished" basement type:

```
https://api.repliers.io/listings?details.basement=notContains:Finished
```

## Working with Values

Many MLS fields store multiple values as comma-separated strings. The `contains:` and `notContains:` operators search for exact matches of individual comma-separated components within these composite values.

### How It Works

Consider the `details.basement` field, which can contain values like

```
 "None"
 "Finished"
 "Unfinished"
 "Full"
 "Full, Finished"
 "Apartment, Separate Entrance",
 "Finished With Walk-Out, Separate Entrance"
 "Walk-Up, Finished"
 "Finished, Apartment"
```


When you use `details.basement=contains:Finished`, the API searches for any basement value that contains "Finished". This matches:

* "Finished"
* "Unfinished"
* "Full, Finished"
* "Finished With Walk-Out, Separate Entrance"
* "Walk-Up, Finished"
* "Finished, Apartment"

Conversely, `details.basement=notContains:Finished` returns only basement values that do not have "Finished" as a substring, such as:

* "None"
* "Full"
* "Apartment, Separate Entrance"

### Example Query

To find properties with a finished basement:

```
https://api.repliers.io/listings?details.basement=contains:Finished
```

To find properties without a "Walk-Out" basement feature:

```
https://api.repliers.io/listings?details.basement=notContains:Walk-Out
```

## Working with Array Fields

Some fields store multiple values as arrays. The `contains:` and `notContains:` operators work seamlessly with these array fields as well.

### How It Works
Consider the `condominium.amenities` field, which is an array that might contain values like:
```
["Concierge", "Gym", "Community BBQ", "Party Room/Meeting Room", "Visitor Parking"]
```

When you use `condominium.amenities=contains:Gym`, the API returns all condominiums where "Gym" appears anywhere in the amenities array.

When you use `condominium.amenities=notContains:Concierge`, the API returns only condominiums that do not have "Concierge" in their amenities array.

### Example Query

To find condominium units with a gym:

```
https://api.repliers.io/listings?condominium.amenities=contains:Gym
```
To find properties that do not have visitor parking:

```
https://api.repliers.io/listings?condominium.amenities=notContains:Visitor Parking
```

## Multiple Filters

You can use multiple `contains:` and `notContains:` filters on the same field or different fields to refine your search results further.

### Multiple Values on the Same Field

To find properties that contain one value AND do not contain another:

```
https://api.repliers.io/listings?details.basement=contains:Full&details.basement=notContains:Apartment
```

This returns properties with "Full" basement but without "Apartment" in the basement type.

### Different Fields

You can combine filters across multiple fields:

```
https://api.repliers.io/listings?details.basement=contains:Finished&condominium.amenities=contains:Gym
```

This returns condominiums with a finished basement that also have a gym.

## Common Use Cases

**Property Feature Searches**

* Find properties with a specific basement type: `details.basement=contains:Finished`
* Exclude properties with certain basement characteristics: `details.basement=notContains:Crawl Space`

**Amenity Filtering**

* Find condos with specific amenities: `condominium.amenities=contains:Concierge`
* Exclude properties without desired amenities: `condominium.amenities=notContains:Gym`

**Multi-Criteria Searches**

* Find finished basements with a walk-out: `details.basement=contains:Finished&details.basement=contains:Walk-Out`
* Find properties with multiple amenities but exclude undesired ones: `condominium.amenities=contains:Pool&condominium.amenities=notContains:Outdoor`

## Important Notes

* The `contains:` and `notContains:` operators are designed for fields with string values or array fields.
* For array fields, the operators searches containment 
* Multiple filters on the same field are applied with **OR** logic [by default](https://help.repliers.com/en/article/understanding-operators-in-the-repliers-api-1h2or2x/#2-default-behavior-and-between-parameters-or-within-parameters) (all listings containing any of the values will be returned).
* These operators are case-insensitive
* Use these operators in combination with other filters for more targeted searches.

## Support
If you encounter any issues with the `contains:` or `notContains:` operators or need help with complex filtering scenarios, please contact our support team with specific examples of the queries you're trying to run.
