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

# Read Data

> Using the GET method, you can retrieve rows.

## Horizontal Filtering

You can filter result rows by adding conditions on columns. For instance, to lookup contacts that did not receive any campaign messages this month:

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?campaign_messages_this_month=eq.0"
```

You can evaluate multiple conditions on columns by adding more query string parameters. For instance, to return contacts that did not receive any campaign messages this month and opted in for WhatsApp marketing:

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?campaign_messages_this_month=eq.0&whatsapp_marketing_opt_in=eq.true"
```

### Operators

These operators are available:

| Abbreviation | Meaning                                                                                                                                                      |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| eq           | equals                                                                                                                                                       |
| gt           | greater than                                                                                                                                                 |
| gte          | greater than or equal                                                                                                                                        |
| lt           | less than                                                                                                                                                    |
| lte          | less than or equal                                                                                                                                           |
| neq          | not equal                                                                                                                                                    |
| like         | LIKE operator (to avoid [URL encoding](https://en.wikipedia.org/wiki/Percent-encoding) you can use `*` as an alias of the percent sign `%` for the pattern)  |
| ilike        | ILIKE operator (to avoid [URL encoding](https://en.wikipedia.org/wiki/Percent-encoding) you can use `*` as an alias of the percent sign `%` for the pattern) |
| in           | one of a list of values, e.g. `?a=in.(1,2,3)` -- also supports commas in quoted strings like `?a=in.("hi,there","yes,you")`                                  |
| is           | checking for exact equality (null,true,false,unknown)                                                                                                        |
| isdistinct   | not equal, treating `NULL` as a comparable value                                                                                                             |
| cs           | contains e.g. `?tags=cs.{example, new}`                                                                                                                      |
| cd           | contained in e.g. `?values=cd.{1,2,3}`                                                                                                                       |
| not          | negates another operator, see [Logical Operators](#logical-operators)                                                                                        |
| or           | logical `OR`, see [Logical Operators](#logical-operators)                                                                                                    |
| and          | logical `AND`, see [Logical Operators](#logical-operators)                                                                                                   |

### Logical Operators

Multiple conditions on columns are evaluated using `AND` by default, but you can combine them using `OR` with the `or` operator. For example, to return contacts with either a SMS or a WhatsApp marketing opt in:

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?or=(whatsapp_marketing_opt_in.eq.true,email_marketing_opt_in.eq.true)"
```

To negate any operator, you can prefix it with `not` like `?a=not.eq.2` or `?not.and=(a.gte.0,a.lte.100)`.

## Vertical Filtering

To be more effiecient, it is always wise to retrieve only the columns you need. You can do this by specifying the columns in the `select` query string parameter. For example, to retrieve only the `id` and `name` columns:

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?select=id,name"
```

## Ordering

The reserved word `order` reorders the response rows. It uses a comma-separated list of columns and directions:

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?order=full_name.desc,email.asc"
```

If no direction is specified it defaults to ascending order:

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?order=full_name"
```

If you care where nulls are sorted, add `nullsfirst` or `nullslast`:

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?order=full_name.nullsfirst"
```

```bash theme={null}
curl "https://integration.getmateo.com/api/v1/contact?order=full_name.nullslast"
```
