Skip to content

User Session

The user session object contains information about the user, their current session, and their current roles and permissions.

Example User Session Object

{
"id": 3,
"email": "zach@example.com",
"active": true,
"createdBy": "test@test.com",
"updatedBy": "test@test.com",
"createdAt": "2025-02-11T03:45:04.853Z",
"updatedAt": "2025-02-11T05:50:37.935Z",
"impersonating": null,
"primaryAccount": {
"accountName": "zach@example.com",
"accountId": "6591739253089529",
"repcode": "3",
"usersPrimaryAccount": true,
"accountAdmin": true
},
"accounts": [
{
"accountName": "zach@example.com",
"accountId": "6591739253089529",
"repcode": "3",
"usersPrimaryAccount": true,
"accountAdmin": true
}
],
"flatRolesList": ["superAdmin"],
"flatPermissionsList": ["readApplications", "writeApplications"],
"permissionsFromRoles": ["readApplications", "writeApplications"],
"permissionsFromRolesDetails": {
"readApplications": [
{
"role": "superAdmin",
"accountId": null
}
],
"writeApplications": [
{
"role": "superAdmin",
"accountId": null
}
]
},
"token": "51dabe439fce50dd171ca5a95eec45b49989071a3d27e4e5514cd5d1bae75e77",
"expiresAt": "2025-02-19T04:26:37.448Z"
}

Properties

id

  • Type: integer
  • Description: Contains the database index identifier of the user.

email

  • Type: string
  • Description: The email address of the user.

active

  • Type: boolean
  • Description: Indicates whether the user’s account is active.

createdBy

  • Type: string
  • Description: The email address of the user who created this user.

updatedBy

  • Type: string
  • Description: The email address of the user who last updated this user.

createdAt

  • Type: string (ISO 8601 datetime)
  • Description: The timestamp of when the session was created.

updatedAt

  • Type: string (ISO 8601 datetime)
  • Description: The timestamp of the last update to the session.

impersonating

  • Type: string | null
  • Description: If the session is impersonating another user, this will contain the email of the impersonated user; otherwise, it will be null.

primaryAccount

  • Type: object
  • Description: Information about the user’s primary account.
    • accountName: string - The name of the account.
    • accountId: string - The unique identifier of the account.
    • repcode: string - The repcode associated with the account, if any (Agents only).
    • usersPrimaryAccount: boolean - Indicates if this is the user’s primary account.
    • accountAdmin: boolean - Indicates if the user is an admin of this account.

accounts

  • Type: array of objects
  • Description: A list of accounts associated with the user.
    • accountName: string - The name of the account.
    • accountId: string - The unique identifier of the account.
    • repcode: string - The repcode associated with the account.
    • usersPrimaryAccount: boolean - Indicates if this is the user’s primary account.
    • accountAdmin: boolean - Indicates if the user is an admin of this account.

flatRolesList

  • Type: array of string
  • Description: A flat list of ALL roles assigned to the user.

flatPermissionsList

  • Type: array of string
  • Description: A flat list of ALL permissions assigned to the user.

permissionsFromRoles

  • Type: array of string
  • Description: A list of permissions derived from the user’s roles.

permissionsFromRolesDetails

  • Type: object
  • Description: Detailed information about permissions derived from roles.
    • Each key is a permission name, and the value is an array of objects containing:
      • role: string - The role granting the permission.
      • accountId: string | null - The account ID associated with the permission, if any.

token

  • Type: string
  • Description: The authentication token for the user session.

expiresAt

  • Type: string (ISO 8601 datetime)
  • Description: The timestamp indicating when the session expires.