# Adding non-visible user custom fields to the API

**URL:** https://meta.discourse.org/t/adding-non-visible-user-custom-fields-to-the-api/276618
**Category:** Site Management
**Tags:** rest-api, how-to, user-custom-fields, users
**Created:** [August 25, 2023, 2:46pm UTC](https://meta.discourse.org/t/adding-non-visible-user-custom-fields-to-the-api/276618 "2023-08-25T14:46:39Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [October 18, 2023, 10:06pm UTC](https://meta.discourse.org/t/adding-non-visible-user-custom-fields-to-the-api/276618/3 "2023-10-18T22:06:18Z")

</div>

Yes, using query parameters:

For example,  
[https://unicyclist.com/directory\_items.json?period=weekly&order=likes\_received&name=Flansberrium+G29&user\_field\_ids=1|2](https://unicyclist.com/directory_items.json?period=weekly&order=likes_received&name=Flansberrium+G29&user_field_ids=1%7C2)

Restrict the user custom fields to search by modifying the last parameter `user_field_ids=1|2`.  
For example, `user_field_ids=5` to search only in the custom field ID 5.

There are also a couple of other available parameters you can find in [the API documentation](https://docs.discourse.org/#tag/Users/operation/listUsersPublic) (docs that don’t mention the user fields, but you can easily [reverse-engineer the API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576).

The custom field(s) must have the searchable option checked for the query to work:

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/f/a/0fae82138df105e865c2ce611dd93b8f87f639c9.png)

Also, note that the query will not search _only_ in custom fields, but also in usernames and maybe full names. I think there’s no built-in feature to filter only by custom fields.

---

_[View the full topic](https://meta.discourse.org/t/adding-non-visible-user-custom-fields-to-the-api/276618)._
