This is a quick walkthrough on how to use the public user custom fields or staff user custom fields admin setting to expose User Custom Field data through the API without displaying it on a user card.
Once you have that set up and saved, you can now visit the user fields json at /admin/customize/user_fields.json to find out the ID number:
This can now be entered into either the public user custom fields or staff user custom fields admin setting. The first would be accessible to all, and the second only to a staff API key. The format you need is user_field_X - in my case user_field_7:
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.
The custom field(s) must have the searchable option checked for the query to work:
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.