<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How can I get all users for an application using the API?]]></title><description><![CDATA[<p dir="auto">I want to retrieve all the users for an application configured in FusionAuth. How can I do so?</p>
]]></description><link>https://fusionauth.io/community/forum/topic/110/how-can-i-get-all-users-for-an-application-using-the-api</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 04:57:01 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/110.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 22 May 2020 16:54:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How can I get all users for an application using the API? on Wed, 07 Apr 2021 22:07:39 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">How would I do this kind of search for users within a Postgresql database, I'm not using ElasticSearch.</p>
</blockquote>
<p dir="auto">Sorry, you cannot.</p>
<p dir="auto">Unfortunately you can't search beyond fuzzy matching on the parameters listed in the database search documentation. If you have advanced search needs, we recommend running elasticsearch, which is extremely powerful and flexible.</p>
<p dir="auto">Here's a tutorial on switching search engines: <a href="https://fusionauth.io/docs/v1/tech/tutorials/switch-search-engines/" rel="nofollow ugc">https://fusionauth.io/docs/v1/tech/tutorials/switch-search-engines/</a></p>
]]></description><link>https://fusionauth.io/community/forum/post/2761</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/2761</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Wed, 07 Apr 2021 22:07:39 GMT</pubDate></item><item><title><![CDATA[Reply to How can I get all users for an application using the API? on Tue, 06 Apr 2021 08:02:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/20">@dan</a> yes correct, what is the appropriate syntax for the database search?</p>
<p dir="auto">How would I do this kind of search for users within a Postgresql database, I'm not using ElasticSearch.</p>
]]></description><link>https://fusionauth.io/community/forum/post/2744</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/2744</guid><dc:creator><![CDATA[Pyroseza]]></dc:creator><pubDate>Tue, 06 Apr 2021 08:02:20 GMT</pubDate></item><item><title><![CDATA[Reply to How can I get all users for an application using the API? on Mon, 05 Apr 2021 17:56:57 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">but using a python client against a database,</p>
</blockquote>
<p dir="auto">Do you mean using the database search, @jarpri08 ? I'm not sure I understand. Can you please explain more?</p>
]]></description><link>https://fusionauth.io/community/forum/post/2734</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/2734</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Mon, 05 Apr 2021 17:56:57 GMT</pubDate></item><item><title><![CDATA[Reply to How can I get all users for an application using the API? on Sat, 27 Mar 2021 09:20:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fusionauth.io/community/forum/uid/20">@dan</a> said in <a href="/community/forum/post/239">How can I get all users for an application using the API?</a>:</p>
<blockquote>
<p dir="auto">Note you won't be able to search for users based on their application registration when using the database engine. See the API docs for more details.</p>
</blockquote>
<p dir="auto">Regarding your note above, I'd like to know what is the correct way to perform the exact same search above but using a python client against a database, unfortunately the documentation does not explain how the API works from the view of the official python client</p>
]]></description><link>https://fusionauth.io/community/forum/post/2682</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/2682</guid><dc:creator><![CDATA[Pyroseza]]></dc:creator><pubDate>Sat, 27 Mar 2021 09:20:44 GMT</pubDate></item><item><title><![CDATA[Reply to How can I get all users for an application using the API? on Fri, 22 May 2020 17:02:11 GMT]]></title><description><![CDATA[<p dir="auto">You can use the Search API to find all users that have a registration for a particular Application. You can search for users in a variety of ways. More info here: <a href="https://fusionauth.io/docs/v1/tech/apis/users#search-for-users" rel="nofollow ugc">https://fusionauth.io/docs/v1/tech/apis/users#search-for-users</a></p>
<p dir="auto">You'll want to use the <code>queryString</code> parameter. To generate it, the easiest way is to start in the admin UI. (If you know ElasticSearch querying by heart, feel free to just write the query <img src="https://fusionauth.io/community/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=rcgg4tg866g" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /> ). Open up the advanced search controls on the Users page. Once you use the select boxes to query by registration, you can expand the "show search query" to see the query and use that on the API.</p>
<p dir="auto">The API search query would be something like this, where c53a95bc-c082-4243-b5df-d4408d5dd92b is the Id of the application you're looking for.</p>
<pre><code>{
  "bool" : {
    "must" : [ [ {
      "nested" : {
        "path" : "registrations",
        "query" : {
          "bool" : {
            "must" : [ {
              "match" : {
                "registrations.applicationId" : "c53a95bc-c082-4243-b5df-d4408d5dd92b"
              }
            } ]
          }
        }
      }
    } ] ]
  }
}
</code></pre>
<p dir="auto">If you are using the API directly, you need to make sure you urlencode the query string. So a curl command might look like this:</p>
<pre><code>API_KEY=...
QUERY='{ "bool" : { "must" : [ [ { "nested" : { "path" : "registrations", "query" : { "bool" : { "must" : [ { "match" : { "registrations.applicationId" : "c53a95bc-c082-4243-b5df-d4408d5dd92b" } } ] } } } } ] ] } }'
ENC_QUERY=$(python -c "import urllib; print urllib.quote('''$QUERY''')")

curl -H "Authorization: $API_KEY" "http://localhost:9011/api/user/search?query=$ENC_QUERY"
</code></pre>
<p dir="auto">Note you won't be able to search for users based on their application registration when using the database engine. See the API docs for more details.</p>
]]></description><link>https://fusionauth.io/community/forum/post/239</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/239</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Fri, 22 May 2020 17:02:11 GMT</pubDate></item></channel></rss>