# Get Users API does not handle falsy values for "blocked" query param

**URL:** <https://community.auth0.com/t/get-users-api-does-not-handle-falsy-values-for-blocked-query-param/75547>\
**Category:** Get Help\
**Tags:** user-search, users, search\
**Created:** [December 28, 2021, 3:09pm UTC](https://community.auth0.com/t/get-users-api-does-not-handle-falsy-values-for-blocked-query-param/75547 "2021-12-28T15:09:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidhouseknechtdev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/davidhouseknechtdev/32/12778_2.png) [@davidhouseknechtdev](https://community.auth0.com/u/davidhouseknechtdev)\
**Post date:** [December 28, 2021, 3:09pm UTC](https://community.auth0.com/t/get-users-api-does-not-handle-falsy-values-for-blocked-query-param/75547/1 "2021-12-28T15:09:52Z")

</div>

I am using [api/v2/users](https://auth0.com/docs/api/management/v2#!/Users/get_users) to search for all _non-blocked_ users (among some other search criteria). Looking over the [searchable-fields](https://auth0.com/docs/users/user-search/user-search-query-syntax#searchable-fields) documentation, I am passing in `blocked:false` to my query, like so:

```plaintext
curl https://{tenant}.us.auth0.com/api/v2/users?include_totals=true&q=blocked%3Afalse

```

But I am noticing a strict comparison when checking the `blocked` field on the RAW JSON of the user. (Something like this psuedo code: `if (user.blocked === false) { /* add to results */ }`

For example, I have hundreds of non-blocked users in my `Username-Password-Authentication` database, but only _one_ of those users has a `"blocked": false` and the rest do _not have_ the `"blocked"` field.

**Response from API**

```json
{
    "start": 0,
    "limit": 1,
    "length": 1,
    "users": [/* only 1 record */],
    "total": 1
}

```

**Raw JSON for user _with_ “blocked” field**

```json
{
    "created_at": "2021-06-13T19:07:14.966Z",
    "email": "REDACTED",
    "blocked": false,
    /* lots of other fields */
}

```

**Raw JSON for one user _without_ “blocked” field**

```json
{
    "created_at": "2021-08-13T19:14:18.114Z",
    "email": "REDACTED",
    // No "blocked" field
    /* lots of other fields */
}

```

I guess my question and/or request could be fixed one of two ways:

1. Update the search function to include _all **`falsy`** _ values for the `"blocked"` field.
2. _OR_ document the current behavior so others don’t have to find out the same way I did.

Option #1 is preferred, but I realize that will probably take more dev time.

Thank you,

David

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [January 18, 2022, 12:56pm UTC](https://community.auth0.com/t/get-users-api-does-not-handle-falsy-values-for-blocked-query-param/75547/2 "2022-01-18T12:56:17Z")

</div>

The following query should do what you want:

```auto
blocked:false OR -blocked

```

The auth0 docs could use a lot more detail and examples of common and advanced queries.

---

<div class="post-metadata">

**Author:** ![davidhouseknechtdev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/davidhouseknechtdev/32/12778_2.png) [@davidhouseknechtdev](https://community.auth0.com/u/davidhouseknechtdev)\
**Post date:** [August 16, 2022, 1:20pm UTC](https://community.auth0.com/t/get-users-api-does-not-handle-falsy-values-for-blocked-query-param/75547/3 "2022-08-16T13:20:30Z")

</div>

Awesome. Thanks @markd. It works perfectly.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 4, 2022, 1:23pm UTC](https://community.auth0.com/t/get-users-api-does-not-handle-falsy-values-for-blocked-query-param/75547/4 "2022-11-04T13:23:15Z")

</div>


