> ## Documentation Index
> Fetch the complete documentation index at: https://help.pelion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add filters

> Filter API results using comparison, logical, and grouping operators in the Pelion Portal API query language.

Filter the results the API returns using its query language.

> [!NOTE]
>
> To check whether a specific endpoint accepts filters, see the [API Reference](https://connectivity-eu.pelion.com/api-reference/) documentation.

## Supported filter operators

The API query language supports comparison, logical, and grouping operators. For example, rather than requesting a list of every user in your company, you can use a comparison operator to request only users with a particular name.

The following tables show the different types of operators you can use to filter results.

### Comparison operators

| Operator | Description | Example |
| - | - | - |
| `eq` | Returns results that are equal to the specified value. | `name eq "Alan"` |
| `ne` | Returns results that are not equal to the specified value. | `name ne "Nicole"` |
| `like` | Returns results that include the specified value as a sub-string. | `name like "Al"` |
| `gt` | Returns results that are greater than the specified value. | `cost gt 100` |
| `ge` | Returns results that are greater than or equal to the specified value. | `cost ge 100` |
| `lt` | Returns results that are less than the specified value. | `cost lt 150` |
| `le` | Returns results that are less than or equal to the specified value. | `cost le 150` |

### Logical operators

| Operator | Description | Example |
| - | - | - |
| `and` | Returns results that match both specified conditions. | `name eq "Alan" and age gt 10` |
| `or` | Returns results that match either specified condition. | `name eq "Alan" or age eq 10` |
| `not` | Negates whatever comparison follows directly after it. | `not cost le 10` |

### Grouping operators

| Operator | Description | Example |
| - | - | - |
| `()` | Gives precedence to the statement inside the brackets. | `(city eq "Glasgow" or city eq "Edinburgh") and color eq "red"` |

## Filter query formatting

Depending on the data type you are filtering by, you may need to wrap your query in quotation marks. The following table outlines when quotation marks are required.

| Data type | Quotation marks required? | Example |
| - | - | - |
| String | Yes | `tariffName eq "My Operator Global"` |
| Dates and times | Yes | `expiryDateTime eq "2018-02-11T10:33:30.000Z"` |
| Integers | No | `lineRental eq 1000` |
| Boolean | No | `isActive eq true` |

## Example API calls

The following examples show how to add filter operators to API calls. Filters contain spaces and quotation marks, so they must be URL-encoded. The `-G` and `--data-urlencode` options tell cURL to encode the filter and append it to the URL as a query parameter.

This example returns all SIMs with a line rental fee of 1,000:

```bash theme={null}
curl -G "https://connectivity-eu-api.pelion.com/subscribers" \
  -H "Authorization: Bearer YOUR_ACCESS_KEY" \
  --data-urlencode 'filter=(lineRental eq 1000)'
```

This example returns all SIMs with a line rental fee greater than 1,000:

```bash theme={null}
curl -G "https://connectivity-eu-api.pelion.com/subscribers" \
  -H "Authorization: Bearer YOUR_ACCESS_KEY" \
  --data-urlencode 'filter=(lineRental gt 1000)'
```

This example returns all SIMs on the My Operator Global rate plan, or the My Operator Europe rate plan:

```bash theme={null}
curl -G "https://connectivity-eu-api.pelion.com/subscribers" \
  -H "Authorization: Bearer YOUR_ACCESS_KEY" \
  --data-urlencode 'filter=(tariffName eq "My Operator Global" or tariffName eq "My Operator Europe")'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.