> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streambird.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Users (beta)

> Search users within an App.
## Returns

A successful response returns a list of `User` objects in `users` property and also pagination related properties.



## OpenAPI

````yaml post /v1/auth/users/search
openapi: 3.1.0
info:
  title: MoonKey Auth API
  description: >-
    Explore all the details of MoonKey Auth API. All of our APIs are RESTful and
    accept and return JSON.
  version: v1
servers:
  - url: https://api.moonkey.fun
    description: Production
    variables: {}
security:
  - Authorization: []
tags:
  - name: Users
    description: User management API
  - name: Magic Links
    description: ''
  - name: OTPs
    description: >-
      Send OTP (One-time passcodes) by all the supported delivery methods such
      as SMS, email.
  - name: OAuth
    description: ''
  - name: Wallets Login
    description: ''
  - name: Managed Wallets
    description: ''
  - name: Wallet Import
    description: >-
      Import existing wallets into the platform using secure HPKE encryption.
      This flow ensures raw entropy (seed phrases or private keys) never touches
      the server in plaintext.
externalDocs:
  url: ''
  description: ''
paths:
  /v1/auth/users/search:
    parameters: []
    post:
      tags:
        - Users
      summary: Search Users (beta)
      description: >-
        Search users within an App.

        ## Returns


        A successful response returns a list of `User` objects in `users`
        property and also pagination related properties.
      operationId: SearchUsers
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchUsersRequest'
            examples:
              SearchUsersReq:
                value:
                  limit: 100
                  filters:
                    operator: OR
                    fields:
                      - field: phone_number_match
                        operator: eq
                        value: '2222222'
      responses:
        '200':
          description: Search Users (beta) response
          content:
            application/json:
              schema:
                description: ''
                type: object
                properties:
                  users:
                    type: array
                    items:
                      $ref: '#/components/schemas/User'
                  total_count:
                    type: number
                  has_more:
                    type: boolean
                required:
                  - users
                  - total_count
                  - has_more
              examples:
                SearchUsersResp:
                  value:
                    users:
                      - user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
                        app_id: app_24ydphdixx2ydhF0E5WUFUKWNqi
                        first_name: John
                        middle_name: ''
                        last_name: Smith
                        active: true
                        updated_at: 1639873806
                        created_at: 1639873806
                        emails:
                          - id: email_24oXBL3PufzHkH1Jzyjc2EXYeo7
                            verified: false
                            email: sandbox@moonkey.fun
                            updated_at: 1639873806
                            created_at: 1639873806
                        phone_numbers:
                          - id: pn_24oXBLRv6BoHXbNZoTAZkAFlRsy
                            verified: true
                            phone_number: '+14152222222'
                            updated_at: 1643004687
                            created_at: 1639873806
                        wallets:
                          - id: wallet_24tdfcVDSJQpK5huDnZaqPP2aiI
                            app_id: app_24ydphdixx2ydhF0E5WUFUKWNqi
                            user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
                            public_address: '0xd3EfC42956c546Cf27B5f18062c63B4BF6d72D7c'
                            wallet_type: ethereum
                            is_default: true
                            updated_at: 1640133104
                            created_at: 1640133104
                        totps:
                          - id: totp_284EPXPYI5zZoh4pp2mpAQ2PnuY
                            user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
                            verified: false
                            updated_at: 1650467433
                            created_at: 1650467433
                    total_count: 10
                    has_more: false
components:
  schemas:
    SearchUsersRequest:
      description: ''
      type: object
      properties:
        limit:
          type: number
          description: >-
            Number of objects to return per response, must be between 10 to 100,
            defaults to 50.
        starting_after:
          type: string
          minLength: 1
          description: >-
            A cursor for use in pagination. starting_after is an object ID that
            defines your place in the search result when there are more results
            to fit into a single response. For instance, if you make a search
            request with limit of 100 objects, ending with user_123, your
            subsequent call can include `starting_after: user_123` in order to
            fetch the next page of the search result.
        filters:
          type: object
          description: Filters object to apply to the search.
          properties:
            operator:
              type: string
              minLength: 1
              description: >-
                `Required if filters property is present` Logical operator to
                apply on the fields. Possible values: AND, OR.
            fields:
              type: array
              uniqueItems: true
              minItems: 1
              description: '`Optional` List of field filter objects.'
              items:
                type: object
                description: >-
                  Filter field object that contains the field name and operator
                  and value(s) to apply against the field.
                properties:
                  field:
                    type: string
                    minLength: 1
                    enum:
                      - user_id
                      - status
                      - full_name_match
                      - phone_number
                      - phone_number_id
                      - phone_number_match
                      - phone_number_verified
                      - email
                      - email_id
                      - email_verified
                      - email_match
                      - wallet_public_address
                      - wallet_id
                      - totp_id
                      - totp_verified
                      - idp_provider
                    description: |-
                      Field to filter the search by. Possible values:
                        * `user_id` - Filter by the unique ID(s) of the user. Compatible with `eq` and `in` operators.
                        * `status` - Filter by the status of the user, accepted values: active, pending. Compatible with `eq` and `in` operators.
                        * `full_name_match` - Filter by the fuzzy match of the user's full name (`{first_name} {last_name}`). Compatible with `eq` operator.
                        * `phone_number` - Filter by associated the phone number(s) of the user. Compatible with `eq` and `in` operators.
                        * `phone_number_id` - Filter by the associated phone number ID(s) of the user. Compatible with `eq` and `in` operators.
                        * `phone_number_match` - Filter by the fuzzy match of the user's phone number(s). Compatible with `eq` operator.
                        * `phone_number_verified` - Filter by the verified flag of the user's associated phone number(s). Compatible with `eq` operator.
                        * `email` - Filter by the email of the user. Compatible with `eq` and `in` operators.
                        * `email_id` - Filter by the associated email ID(s) of the user. Compatible with `eq` and `in` operators.
                        * `email_verified` - Filter by the verified flag of the user's associated email(s). Compatible with `eq` operator.
                        * `email_match` - Filter by the fuzzy match of the user's email(s). Compatible with `eq` operator.
                        * `wallet_public_address` - Filter by the wallet public address of the user. Compatible with `eq` and `in` operators.
                        * `wallet_id` - Filter by the associated wallet ID(s) of the user. Compatible with `eq` and `in` operators.
                        * `totp_id` - Filter by the associated totp instance ID(s) of the user. Compatible with `eq` and `in` operators.
                        * `totp_verified` - Filter by the verified flag of the TOTP instance(s). Compatible with `eq` operator.
                        * `idp_provider` - Filter by the associated IdP/OAuth provider(s) of the user. Compatible with `eq` and `in` operators.
                  operator:
                    type: string
                    minLength: 1
                    description: >-
                      `Required` Filter operator to apply for the field.
                      Possible values: eq (translates to equals or `=` in SQL),
                      between (translates to `>= value AND <= second_value` in
                      SQL) , lt (translates to less than or `<` in SQL), gt
                      (translates to greater than or `>` in SQL), in (translates
                      to `IN (value1, value2, ...)` in SQL.)
                  value:
                    type:
                      - string
                      - number
                      - integer
                      - boolean
                    minLength: 1
                    description: >-
                      `Optional` Value to filter by and to be used with
                      operators `eq`, `between`, `lt`, and `gt`.
                  second_value:
                    type:
                      - string
                      - number
                      - integer
                      - boolean
                    minLength: 1
                    description: >-
                      `Optional` Value to filter by and to be used with
                      `between` operator.
                  values:
                    description: >-
                      `Optional` Values to filter by and to be used with `in`
                      operator.
                    type: array
                    items:
                      type:
                        - string
                        - number
                required:
                  - field
                  - operator
          required:
            - operator
    User:
      description: ''
      type: object
      x-examples:
        User:
          user_id: user_24wFP9pDa9YiMJLun94iKykoZs2
          first_name: John
          middle_name: ''
          last_name: Smith
          active: true
          updated_at: 1639873806
          created_at: 1639873806
          emails:
            - id: email_24oXBL3PufzHkH1Jzyjc2EXYeo7
              verified: false
              email: sandbox@moonkey.fun
              updated_at: 1639873806
              created_at: 1639873806
          phone_numbers:
            - id: pn_24oXBLRv6BoHXbNZoTAZkAFlRsy
              verified: true
              phone_number: '+14152222222'
              updated_at: 1643004687
              created_at: 1639873806
          wallets:
            - id: wallet_24tdfcVDSJQpK5huDnZaqPP2aiI
              public_address: '0xd3EfC42956c546Cf27B5f18062c63B4BF6d72D7c'
              wallet_type: ethereum
              is_default: true
              updated_at: 1640133104
              created_at: 1640133104
          idp_providers:
            - id: idpuser_28SRho5nbD045LGq2btZWXhkdjN
              provider: google
              provider_subject: '100157402424066154830'
              idp_type: oauth
              method_id: email_26AjWpEcss2YyqFh1san6Wjjs7o
              method_type: email
              updated_at: 1651208121
              created_at: 1651208121
          totps:
            - id: totp_284EPXPYI5zZoh4pp2mpAQ2PnuY
              verified: false
              updated_at: 1650467433
              created_at: 1650467433
          webauthn_credentials: []
          metadata:
            custom_field: custom_value
            user_tier: premium
      title: User
      properties:
        user_id:
          type: string
          minLength: 1
        first_name:
          type: string
          minLength: 0
        middle_name:
          type: string
        last_name:
          type: string
          minLength: 0
        active:
          type: boolean
        updated_at:
          type: number
        created_at:
          type: number
        emails:
          type: array
          uniqueItems: true
          minItems: 0
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              verified:
                type: boolean
              email:
                type: string
                minLength: 1
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - verified
              - email
              - updated_at
              - created_at
        phone_numbers:
          type: array
          uniqueItems: true
          minItems: 10
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              verified:
                type: boolean
              phone_number:
                type: string
                minLength: 1
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - verified
              - phone_number
              - updated_at
              - created_at
        wallets:
          type: array
          uniqueItems: true
          minItems: 0
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              app_id:
                type: string
                minLength: 1
              user_id:
                type: string
                minLength: 1
              public_address:
                type: string
                minLength: 1
              wallet_type:
                type: string
                minLength: 1
              is_default:
                type: boolean
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - app_id
              - user_id
              - public_address
              - wallet_type
              - is_default
              - updated_at
              - created_at
        idp_providers:
          type: array
          uniqueItems: true
          minItems: 10
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              provider:
                type: string
                minLength: 1
              provider_subject:
                type: string
                minLength: 1
              idp_type:
                type: string
                minLength: 1
              method_id:
                type: string
                minLength: 1
              method_type:
                type: string
                minLength: 1
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - provider
              - provider_subject
              - idp_type
              - method_id
              - method_type
              - updated_at
              - created_at
        totps:
          type: array
          uniqueItems: true
          minItems: 0
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              verified:
                type: boolean
              updated_at:
                type: number
              created_at:
                type: number
            required:
              - id
              - verified
              - updated_at
              - created_at
        metadata:
          $ref: '#/components/schemas/Metadata'
      required:
        - user_id
        - first_name
        - middle_name
        - last_name
        - active
        - updated_at
        - created_at
        - emails
        - phone_numbers
        - wallets
    Metadata:
      type: object
      additionalProperties: true
      description: >
        A flexible JSON object for storing custom data about a user. 

        You can store any arbitrary data as key-value pairs.


        **Update Behavior:**

        - By default, metadata updates are merged at the top level only

        - Send `null` values for specific fields to delete those fields (merge
        mode only)

        - Send `{}` (empty object) to clear all metadata

        - Send `null` for the metadata field itself will be ignored (as if
        metadata was not sent)

        - Deeply nested objects and arrays are NOT merged - they replace the
        entire top-level key

        - Set `replace_metadata: true` to replace all metadata without merging
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: >-
        Auth Platform API includes all the Auth related features. All Users,
        Phone Numbers, Emails, and OTPs are associated with an `App` as the
        container.


        Endpoints only accept App's `Secret API keys` other than certain
        endpoints that are used client side or via SDK that accept the
        `public_token`.


        ## Authentication using App Api Key


        ## Header:


        ```

        Authorization: Bearer {api_key}

        ```


        ## Authenticated Request


        ```curl

        curl \
          -X GET https://api.moonkey.fun/v1/auth/users/user_24wFP9pDa9YiMJLun94iKykoZs2 \
          -H "Authorization: Bearer sk_test_pRqweh3wvWmJAAVYv7Z0T5iPLzFM4ql0muoyQcjOxGeN3p1r"
        ```

````