Skip to main content

Querying user data

Privy allows you to query your users' data from your backend.

Getting a single user

You can get the data for a single user by calling Privy's getUser method with their Privy DID:

const user = await privy.getUser('did:privy:XXXXXX');

The result will be of type User and will include the user's linked accounts, their DID, and the timestamp of when they first logged into your app.

If no user exists with the supplied DID, this method will return null.

Getting all your users

You can get the data for all of your users by calling Privy's getUsers method:

const users = await privy.getUsers();

The result will be an array of type User[].