OS1 Services
...
User Management Service
User API

Retrieve Users

10min

Overview

Developers can use the following endpoints in the User API to get detailed information about users, such as their ID, email, and phone number.

  • GetUser: Retrieves a single user by Id or external ref
  • ListUsers: List all users within an organization
  • GetUserEmail: Retrieves the email of a user or multiple users by ID
  • GetUserMobile: Retrieves the mobile number of a user or multiple users by ID

Retrieve a user by id

To get details about a user, including their Id, name, work locations, etc., call GetUser.

Path Parameters

Parameter

Description

userId

The unique Id of the user. You can also use the aaaId , userCode, or uniqueCode with the "ref" prefix

Sample Response

If the call is successful, the API returns a 200 status code with the user's details. See the example response below:

JSON


The data field in the response contains the details of the retrieved user:

  • The id is the unique identifier of the user (user:7d2f1c9e-d454-4b3f-9f1a-e8d8f1c6d8e7).
  • State represents the user's current state, which is onboarding:completed in this example.
  • Other fields such as participantType, name, owner, uniqueCode, category, subCategory, and templateId provide additional information about the user.
  • The properties field contains various user-specific properties such as workLocations, teams, identification, fileID, userType, department, aaaId, aaaGroups, designation, and employmentType.
  • createdAt and updatedAt fields represent the timestamp of when the user was created and last updated, respectively.
  • createdBy and updatedBy fields provide information about the user who created, and last updated the user record.

List users

To get a list of all users in the organization, call ListUsers.

Parameter

Description

size

Number of items in a page.

page

Page number to return(starting from 1)

select

Specifies a list of attributes to be included in the response (id is always included in the response). If not specified, all attributes are included in the response.

query

Query criteria. Refer following links for more details: -  match

- term

- terms

- range

- regexp

- exists

- fuzzy

- prefix

sortBy

fetching data in ascending(asc) or descending(desc) order. Available values : desc, asc Default value : desc

sortKey

key to be used for sorting data.

additionalInfo

key to toggle fetching of additionalInfo Available values : true, false

Retrieve email

You can retrieve the email for one or multiple users by specifying their userIDs in the GetUserEmail request.

Query Parameters

Parameter

Description

ids

This query parameter can contain a list of user IDs or unique codes separated by a comma. Invalid user IDs are ignored. You can include up to 10 IDs in the request.

Example Response

JSON


In this sample response, the data field contains the response data for the GetUserEmail API:

  • Meta provides metadata about the response, such as the total number of elements (totalElements) matching the query. In this example, two users were returned.
  • users is an array of user objects, where each object contains the following fields:
    • userId: The unique identifier of the user.
    • email: The email address associated with the user.
    • uniqueCode: A unique code assigned to the user.

Retrieve mobile number

You can retrieve the mobile phone number for one or multiple users by specifying their userIDs in the GetUserMobile request.

Query Parameters

Parameter

Description

userId

This query parameter can contain a list of user IDs or unique codes separated by a comma. Invalid user IDs are ignored. You can include up to 10 IDs in the request.

Example Response

JSON


In this sample response, the data field contains the response data for the GetUserMobile API:

  • meta provides metadata about the response, such as the total number of elements (totalElements) matching the query. In this example, there are 2 users returned.
  • users is an array of user objects, where each object contains the following fields:
  • userId: The unique identifier of the user.
  • primaryMobile: An object representing the user's primary mobile number, with countryCode and number fields.
  • secondaryMobile: An object representing the user's secondary mobile number, with countryCode and number fields. It can be null if the user doesn't have a secondary mobile number.
  • uniqueCode: A unique code assigned to the user.