The addUserV2() GraphQL mutation may be used to add or invite a new user. Using this with an invitation token will activate the account. By activating the account, the client accepts LogScale's Terms and Conditions.

For more information on user authorization, see the Managing Users & Permissions documentation page. For information on access tokens of various types, see the Ingest Tokens documentation page.

Syntax

Below is the syntax for the addUserV2() mutation field. Input would be given within the parentheses. The resulting changes will occur within LogScale, but can be returned and captured by specifying the elements desired within the userOrPendingUser type.

graphql
addUserV2(
      input: AddUserInputV2!
   ): userOrPendingUser!

The AddUserInputV2 above would be replaced by parameters with their values, in a comma-separated list, all within a pair of curly brackets. See the examples in the next section for a better understanding.

Given Datatypes

For the input (i.e., AddUserInputV2), there are several parameters that may be given. Below is a list of them along with their data type and a description of each:

Table: AddUserInputV2

ParameterTypeRequired[a]DefaultDescription
usernamestringyes User name for the login account.
companystring  The name of the company associated with the user.
isRootboolean  Whether the user account is granted root access.
firstNamestring  The user's actual first name (e.g., Rob). Don't use with fullName.
lastNamestring  The user's actual last name or family name (e.g., Blindman). Don't use with fullName.
fullNamestring  The user's full name (e.g., Rob U. Blindman). Don't use if using other name parameters.
picturetype  The file name of an image file for the user.
emailtype  The user's email address for communications from LogScale. Required when using sendInvite.
countryCodestring  The two-letter ISO 3166-1 Alpha-2 code for the country of residence (e.g., us).
stateCodestring  The two-letter, ISO 3166-2 country sub-division code for the state of residence (e.g., ny).
sendInviteboolean  Whether LogScale should send an email providing the user with information to login.
verificationTokenstring  The verification token for the user account.

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


As mentioned previously, the addition of a user account and setting of attributes related to that account are made in LogScale, but some values may be captured in return by the application by specifying the desired fields based on the userOrPendingUser schema.

Returned Datatypes

As mentioned previously, the addition of a user account and setting of attributes related to that account are made in LogScale, but some values may be captured in return by the application by specifying the desired fields based on the userOrPendingUser schema. Depending on what is given, this includes two possible specialized datatypes: user() or PendingUser

The fields available depend on whether the user has been created, or is instead a pending user. This is determined based on whether the input parameters include not sending an invitation (i.e., sendInvite is set to false). So what's pending is the user acceptance of the invitation.

The schema for the user() possibility includes all of the user account attributes. They are listed in the table below, along with their data type and a description of each. Additionally, the Resultant column is used to indicate whether the respective field is always created and filled with a value.

Table: User

ParameterTypeRequired[a]DefaultDescription
idstringyes The identifier or token for the user.
displayNamestringyes The value of the fullName if used, otherwise the username.
usernamestringyes The user name for the account.
isRootbooleanyes Whether the user account is granted root access.
isOrgRootbooleanyes Whether the organization is granted root access.
fullNamestring  The user's full name (e.g., Bob Smith). Don't use if using other name parameters.
firstNamestring  The user's actual first name (e.g., Bob). Don't use with fullName.
lastNamestring  The user's actual last name or family name (e.g., Smith). Don't use with fullName.
phoneNumberstring  The telephone number for LogScale to use for telephone text messages.
emailstring  The user account's email address for communications from LogScale.
picturestring  File name of an image file for the account.
createdAtdatetimeyes The data and time the account was created.
countryCodestring  The two-letter ISO 3166-1 Alpha-2 code for the country of residence (e.g., us).
stateCodestring  The two-letter, ISO 3166-2 country sub-division code for the state of residence (e.g., ny).
companystring  The name of the company for the user account.
userOrGroupSearchDomainRolessearch: string, skip: Int = 0, limit: Int = 50): UserOrGroupSearchDomainRoleResultSet!yes The number of results to skip or the offset to use. For instance, if implementing pagination, set skip = limit * (page - 1). See UserOrGroupSearchDomainRoleResultSet Table.
groupSearchDomainRolesGroupSearchDomainRoleyes The group search domain roles for the user (see GroupSearchDomainRole Table).
searchDomainRoles[SearchDomainRole]  The search domain roles assigned to the user (see SearchDomainRole Table).
searchDomainRolesByNamestringyes The search domain roles for the user, by name.
group[Group]yes The groups of which the user is a member (see Group Table).
permissionstypeyes Permissions of the user.
permissionsPagetypeyes PREVIEW: A page of user permissions.
allowedSystemActions[SystemAction]yes Returns the actions the user is allowed to perform in the system. See SystemAction Table.
allowedOrganizationActions[OrganizationAction]yes Returns the actions the user is allowed to perform in the organization (see OrganizationAction Table).

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


The schema for the PendingUser possibility includes several fields based on the minimal data collected thus far. They are listed in the table below, along with their data type and a description of each, as well as whether the respective field will always result in it being created and filled with a value.

Table: PendingUser

ParameterTypeRequired[a]DefaultDescription
idstringyes The identifier or token for the pending user.
idpbooleanyes Whether IDP is enabled for the organization.
createdAtlongyes The time the pending user was created.
invitedByEmailstringyes The email address of the user that invited the pending user.
invitedByNamestringyes The name of the user that invited the pending user.
orgNamestringyes The name of the organization the the pending user is about to join.
newUserEmailstringyes The email of the pending user.
pendingUserStatePendingUserStateyes The current organization state for the user (see PendingUserState Table).

[a] Some arguments may be required, as indicated in this column. For some fields, this column indicates that a result will always be returned for it.


Examples

Below is a simple example of what you do if you want to add a new user to LogScale — and to have the system send that user an invitation by email:

graphql
mutation {
  addUserV2(
    input: {
      username: "robublindman"
      sendInvite: true
      email: "rob@company.com"
    }
  ) {
    __typename
  }
}

The example above will create a pending user and send an email invitation to the address given. It will return an error message if there is a problem, but not much else. To capture some of the results, you could enter something like the following instead:

graphql
mutation {
  addUserV2(
    input: {
      username: "robublindman"
      sendInvite: true
      email: "rob@company.com"
    }
  ) {
    __typename
    ... on User {
      id
      displayName
    }
    ... on PendingUser {
      id
      newUserEmail
    }
  }
}

Since the user was sent an invitation email, the user will be saved as a pending user — pending acceptance and activation of the account by the user. In the example above, for a PendingUser, the application will be returned the user's identifier and email address.