Users: list

Requires authorization

Retrieves a paginated list of either deleted users or all users in a domain. Try it now.

Request

HTTP request

GET https://www.googleapis.com/admin/directory/v1/users

Parameters

Parameter name Value Description
Optional query parameters
customFieldMask string A comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.
customer string The unique ID for the customer's G Suite account. In case of a multi-domain account, to fetch all groups for a customer, fill this field instead of domain. You can also use the my_customer alias to represent your account's customerId. The customerId is also returned as part of the Users resource. Either the customer or the domain parameter must be provided.
domain string The domain name. Use this field to get fields from only one domain. To return all domains for a customer account, use the customer query parameter instead. Either the customer or the domain parameter must be provided.
maxResults integer Maximum number of results to return. Default is 100. Maximum is 500. Acceptable values are 1 to 500, inclusive.
orderBy string Property to use for sorting results.

Acceptable values are:
  • "email": Primary email of the user.
  • "familyName": User's family name.
  • "givenName": User's given name.
pageToken string Token to specify next page in the list
projection string What subset of fields to fetch for this user.

Acceptable values are:
  • "basic": Do not include any custom fields for the user. (default)
  • "custom": Include custom fields from schemas requested in customFieldMask.
  • "full": Include all fields associated with this user.
query string Query string for searching user fields. For more information on constructing user queries, see Search for Users.
showDeleted string If set to true, retrieves the list of deleted users. Default is false.
sortOrder string Whether to return results in ascending or descending order.

Acceptable values are:
  • "ASCENDING": Ascending order.
  • "DESCENDING": Descending order.
viewType string Whether to fetch the administrator-only or domain-wide public view of the user. For more information, see Retrieve a user as a non-administrator.

Acceptable values are:
  • "admin_view": Results include both administrator-only and domain-public fields for the user. (default)
  • "domain_public": Results only include fields for the user that are publicly visible to other users in the domain.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/admin.directory.user

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "admin#directory#users",
  "etag": etag,
  "users": [
    users Resource
  ],
  "nextPageToken": string
}
Property name Value Description Notes
kind string The type of the API resource. For Users resources, the value is admin#directory#users.
users[] list List of user objects.
nextPageToken string Token used to access next page of this result.
etag etag ETag of the resource.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Send feedback about...

Directory API
Directory API
Need help? Visit our support page.