# Search users

Searches users by criteria. Returns results with pagination and ordering.
 

{% html name="div" attrs={"class": "notice"} %}
Notice

Rate limits for server-side methods are applied to this method.
{% /html %}

Endpoint: GET /projects/{project_id}/users/search
Version: v1
Security: Server

## Path parameters:

  - `project_id` (string, required)
    Login project ID from Publisher Account.

## Query parameters:

  - `limit` (integer, required)
    Maximum number of users that are returned at a time.

  - `offset` (integer)
    Number of the elements from which the list is generated.

  - `order_column` (string)
    Enum: "username", "contact", "group", "activity", "nickname", "custom_id"

  - `order_dir` (string)
    Condition for sorting the list of users.
    Enum: "asc", "desc"

  - `user_groups` (array)
    An array with user group IDs.

  - `status` (boolean)
    Shows whether the user is active or not.

  - `search_query` (string)
    A search query. Can be contact, phone, id, social-id, username, nickname, ot custom_id.

  - `search_by` (string)
    A search criteria.
    Enum: "contact", "phone", "id", "social-id", "username", "nickname", "custom_id"

  - `activity_from` (string)
    Starting date for user activity in the YYYY-MM-DD format.

  - `activity_to` (string)
    Starting date for user activity in the YYYY-MM-DD format.

## Response 200 fields (application/json):

  - `count` (integer, required)
    Count all user by criteria without pagination

  - `next_after` (integer, required)
    Offset for next page of search

  - `users` (array)
    List of found users

  - `users.ban` (object, required)
    User ban definition

  - `users.ban.date_from` (string, required)

  - `users.ban.date_to` (string, required)

  - `users.ban.reason` (string, required)

  - `users.email` (string)
    User email address.

  - `users.external_id` (string, required)
    ID of the user in your game.

  - `users.first_name` (string)
    User first name.

  - `users.groups` (array, required)
    List of groups the user belongs to.

  - `users.groups.id` (integer)
    User group ID

  - `users.groups.is_default` (boolean)
    Flag whether the group is the default group

  - `users.groups.is_deletable` (boolean)
    Flag whether the group can be deleted

  - `users.groups.name` (string)
    User group name

  - `users.id` (string, required)
    User ID.

  - `users.is_anonymous` (boolean)
    Shows whether the user is anonymous or not. The anonymous user is a user created via device ID or custom ID and doesn’t have an alternative authentication method added (e.g., username/email and password).

  - `users.is_last_email_confirmed` (boolean, required)
    Whether a user comfirmed their email address. If true, the email address is confirmed.

  - `users.is_user_active` (boolean, required)
    Shows whether the user is active or not.

  - `users.last_login` (string, required)
    Date of the last user login in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.

  - `users.last_name` (string)
    User last name.

  - `users.login_type` (string, required)
    Last used type of authorization. Can be xsolla_login/social/server_custom_id and etc

  - `users.name` (string)
    User name.

  - `users.nickname` (string)
    User nickname.

  - `users.phone_auth` (any, required)
    User phone number according to [national conventions](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers). This phone number is used to authenticate the user. Returned only if the phone_auth field is specified.

  - `users.picture` (any, required)
    Link to the user profile picture.

  - `users.project_id` (string)
    ID of the project associated with a user.

  - `users.registered` (string, required)
    Date of user registration in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.

  - `users.server_custom_id` (string, required)
    User server_custom_id.

  - `users.username` (string, required)
    User username.

## Response 401 fields (application/json):

  - `error` (object, required)

  - `error.code` (string, required)
    Error code.
    Example: "003-061"

  - `error.description` (string, required)
    Error description.
    Example: "Object not found."

  - `error.details` (object)
    Additional information.

## Response 404 fields (application/json):

  - `error` (object, required)

  - `error.code` (string, required)
    Error code.
    Example: "003-061"

  - `error.description` (string, required)
    Error description.
    Example: "Object not found."

  - `error.details` (object)
    Additional information.

## Response 429 fields (application/json):

  - `error` (object, required)

  - `error.code` (string, required)
    Error code.
    Example: "003-061"

  - `error.description` (string, required)
    Error description.
    Example: "Object not found."

  - `error.details` (object)
    Additional information.


