Manage your staff, invite new users, assign system roles


TABLE OF CONTENTS



User Management

Create a user

POST /v1/b2b/customer/users    

(Requires Admin Permissions)

Pass the email address and password in the headers as x-acme-email and x-acme-password.  An email will be sent to the email address specified with a link for them to click to confirm the account.

Invite a user

POST /v1/b2b/customer/users/invite       

(Requires Admin Permissions)

email list is passed into a request header 'email_invites'


Get list of users by role

GET /v1/b2b/customer/users

Query Parameters:  All are optional

  • pageSize: Number of entries to return
  • page:  Which page you are getting
  • departmentId:  Filter, only return users for this department
  • roleId:  Filter, only return users with this role
  • jobTitle:  Filter only return users with this title in their title.
  • activeOnly: if true then will not return deactivated users.

Get a user

GET /v1/b2b/customer/users/id/{userId}

Input

userId: the id of the user you are looking for.

Response

The User Object corresponding to the user you requested.

Update a user

PUT /v1/b2b/customer/users/{userId}

Note: If you pass a password in then you must also pass in an old password to change the password.

Body

A User Object

Input

userId: the id of the user you are updating.

Response

The resulting User object


Password Management

Recover Password

GET /v1/b2b/customer/users/recoverPassword

Recover Password flow, call this function with an email address in the headers and an email will be sent to that address with a link that contains a token to recover the password. Pass the email address in as header x-acme-email in the request headers.

Input

x-acme-email: (Header) the email address to recover the password for.

Finish Recovering a password

GET /v1/b2b/customer/users/recoverFinish

Second part of the recover password flow, after the user has typed in a new password send it to this url in the headers with the token used to recover the password. This will change the user's password to the new password and return a session that they can use.  Pass token in the header as x-acme-token and the new password in the header as x-acme-password.

Input

x-acme-token: (Header) the token that was emailed to the user.

x-acme-password: (Header) the new password.

Response

A User Session Object


Admin set password

PUT /v1/b2b/customer/users/{userId}/password

The body is simply the new password for the specified user.  Changes the password for the user to that specified.


Confirming Users


Confirm a user

GET /v1/b2b/customer/users/confirm

Token must be passed in as x-acme-token

Input

x-acme-token: (Header) the token that was emailed to the user to confirm their account.

Response

A User Session Object

Resend confirmation

POST /v1/b2b/customer/users/{userId}/resendConfirmation

Resend the confirmation email to the specified user.

confirmationToken will be different than previously sent tokens.

If the user has been deactivated then this will throw an exception saying the "User is deactivated and can not be invited"

if the user has already onboarded we will throw an exception saying "User is already on boarded, please recover password if forgotten."


Input

userId: The id of the user to resend the confirmation for.


Managing Departments, Roles and Titles

Batch Update Departments

PUT /v1/b2b/customer/users/departments/{departmentId}

The body will be a list of userIds that you want assigned to that department.

Body

A list of user ids to assign to the department

Input

departmentId: The id of the department to assign the users to.

Response

None

Batch Update Roles

PUT /v1/b2b/customer/users/permissions/{roleId}

The body will be a list of userIds that you want this role assigned to.

Body

A list of user id's to assign the role to.

Input

roleId:  The id of the role you are adding to the users.

Response

None

Get Existing Titles

GET /v1/b2b/customer/users/titles

Returns

a list of the existing titles.

Get Existing Roles

GET /v1/b2b/customer/users/permissions

Returns

a list of the existing roles Role Objects


Objects

User Object

Field
Description
idThe unique id of the user.
tenantIdThe id of the tenant that the user belongs to.
emailEmail address for the user.
firstNameFirst name of the user.
lastNameLast name, family name, of the user.
phoneNumberUser's phone number.
titleJob title for the user.
streetAddress1First line in the address of the user.
streetAddress2Second line in the address of the user.
cityThe city of the user.
stateThe state/province of the user.
zipCodeThe user's zip/postal code.
countryThe country of the user.
confirmedTrue if the user has confirmed their email address.
onBoardedTrue if the user has been onboarded.
departmentThe name of the department that the user is in. (Read Only)
departmentIdThe id of the department that the user is in.
userNameUser name for the user.
activetrue if the user is active, false if they've been deactivated
status
  • Deactivated if the user is no longer active
  • Active if the user is completely on boarded
  • Unconfirmed if the user has not on boarded
passwordrequired for create and for changing password.  If you pass this in an update user call then you must also provide an oldPassword. Write Only)
oldPasswordLeave empty unless you are changing the password. (Write Only)

Role Object

Field
Description
idThe unique id of the role.
nameThe name of the role.
permissionsA list of permissions for the role.