Get User's Info
    • Dark
      Light
    • PDF

    Get User's Info

    • Dark
      Light
    • PDF

    Article summary

    Get
    /api/v1/users.info
    • Retrieves information about a user. The result is only limited to what the callee has access to view.
    • This endpoint supports the field query parameter with userRooms that returns the rooms that the user is part of.
    • The rooms field returns the unread property based on the Unread Count setting.

    Changelog

    VersionDescription
    3.4.0Added unread property inside rooms object
    0.70.0Added rooms property to response if the user request it and has the view-other-user-channels permission
    0.49.0Updated to support userId or username
    0.48.0Renamed to users.info
    0.35.0Added
    Header parameters
    X-Auth-Token
    stringRequired

    The authenticated user token.

    ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
    X-User-Id
    stringRequired

    The authenticated user ID.

    ExamplerbAXPnMktTFbNpwtJ
    Query parameters
    userId
    stringRequired

    The userId of the user. Alternatively, you can use the username parameter and value.

    ExampleW7NHuX5ri2e3mu2Fc
    fields

    This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: fields={ "username": 1 }

    Responses
    200

    OK

    Success Example
    {
      "user": {
        "_id": "5fRTXMt7DMJbpPJfh",
        "createdAt": "2023-07-10T16:44:58.548Z",
        "services": {
          "password": true,
          "email2fa": {
            "enabled": true,
            "changedAt": "2023-07-10T04:44:58Z"
          },
          "resume": {
            "loginTokens": [
              {
                "when": "2023-10-05T06:55:02Z",
                "hashedToken": "..."
              },
              {
                "when": "2023-10-05T07:09:30Z",
                "hashedToken": "...."
              },
              {
                "when": "2023-10-10T11:40:46Z",
                "hashedToken": "...."
              }
            ]
          }
        },
        "username": "test.john",
        "emails": [
          {
            "address": "[email protected]",
            "verified": true
          }
        ],
        "type": "user",
        "status": "offline",
        "active": true,
        "roles": [
          "user",
          "admin"
        ],
        "name": "Test John",
        "requirePasswordChange": false,
        "lastLogin": "2023-10-10T23:40:46.093Z",
        "statusConnection": "offline",
        "utcOffset": 1,
        "statusText": "",
        "avatarETag": "GFoEi6wv3uAxnzDcD",
        "nickname": "tesuser2",
        "canViewAllInfo": true,
        "rooms": [
          {
            "_id": "651667dda2f73c7460e18cce",
            "unread": 1,
            "rid": "JKa7R9zu2DinBhBN9",
            "name": "Livestream",
            "t": "c"
          },
          {
            "_id": "64ac358a79f5c6e276cfe718",
            "unread": 0,
            "rid": "GENERAL",
            "name": "general",
            "t": "c"
          },
          {
            "_id": "64aca0e5aa5ad4273bfbfdb8",
            "unread": 0,
            "rid": "6GFJ3tbmHiyHbahmC",
            "name": "test-audit",
            "t": "c"
          },
          {
            "_id": "64adb09baa5ad4273bfc0cc0",
            "unread": 0,
            "rid": "64adb09baa5ad4273bfc0cbf",
            "name": "test-room",
            "t": "c",
            "roles": [
              "owner"
            ]
          },
          {
            "_id": "64fd791c2c26843a68c1f7e5",
            "unread": 0,
            "rid": "siyr2oWQJBjQjhLwr",
            "name": "try",
            "t": "c",
            "roles": []
          },
          {
            "_id": "g5xHGWAGLA7vZXwW8",
            "rid": "5fRTXMt7DMJbpPJfhrbAXPnMktTFbNpwtJ",
            "name": "roxie",
            "t": "d",
            "unread": 2
          },
          {
            "_id": "64ef8a982c26843a68c1f7ae",
            "unread": 0,
            "rid": "WDuJLFkjwk6L7LdFC",
            "name": "new",
            "t": "p",
            "roles": [
              "leader"
            ]
          }
        ]
      },
      "success": true
    }
    Expand All
    object
    user
    object
    _id
    string
    createdAt
    string
    username
    string
    emails
    Array of object
    object
    address
    string
    verified
    boolean
    type
    string
    status
    string
    active
    boolean
    roles
    Array of string
    string
    name
    string
    requirePasswordChange
    boolean
    lastLogin
    string
    statusConnection
    string
    utcOffset
    integer
    canViewAllInfo
    boolean
    success
    boolean
    400

    Bad Request

    Example 1
    {
      "success": false,
      "error": "must have required property 'userId'\n must have required property 'username'\n must have required property 'importId'\n must match a schema in anyOf [invalid-params]",
      "errorType": "invalid-params"
    }
    Example 2
    {
      "success": false,
      "error": "User not found."
    }
    object
    success
    boolean
    error
    string
    errorType
    string
    401

    Unauthorized

    Authorization Error
    {
      "status": "error",
      "message": "You must be logged in to do this."
    }
    object
    status
    string
    message
    string

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.