Users

Get users with filters and pagination.

Logto provides a very flexible way to query users. You can filter users by almost any fields with multiple modes. To learn more about the query syntax, please refer to Advanced user search.

get/api/users

Request

  • Base URL: https://[tenant_id].logto.app
  • URL: https://[tenant_id].logto.app/api/users
  • Auth: OAuth 2 (client credentials, token URL /oidc/token, scopes: all)

Query parameters

pageinteger

Page number (starts from 1).

page_sizeinteger

Entries per page.

search_paramsobject

Search query parameters.

identityType'social' | 'sso'

The external identity type to use for an exact user lookup. Use social for a social connector identity or sso for an enterprise SSO identity. Must be provided together with identityProvider and identityId. External identity filters are combined with other user filters using AND logic.

identityProviderstring

The connector target for a social identity (for example, dingtalk), or the issuer for an enterprise SSO identity. Must be provided together with identityType and identityId.

identityIdstring

The user identifier issued by the external identity provider, such as a DingTalk OpenID. Must be provided together with identityType and identityProvider.

customDatastring[]

A repeatable filter for exact user lookup by custom data. Each value must be a URL-encoded JSON object, for example customData=%7B%22customId%22%3A114514%7D for {"customId":114514}. Matching uses PostgreSQL JSONB containment (users.custom_data @> value::jsonb) with strict JSON types: the number 114514 does not match the string "114514", strings are case-sensitive without phone/date normalization, and null only matches an explicit JSON null, not a missing key. Nested objects are matched recursively, and arrays are matched by element regardless of order or duplicates. All keys within one object are combined with AND, repeated customData parameters are combined with OR, and the whole custom data condition is combined with search, identity, excludeRoleId, and excludeOrganizationId filters using AND. Empty objects and empty arrays are rejected with 400, and at most 20 customData values are allowed per request. The mode, joint, and isCaseSensitive parameters do not apply to customData, and nested syntax such as customData.customId or mode.customData is not supported.

Response

An array of users that match the given criteria.

idstring required
usernamestring nullable required
primaryEmailstring nullable required
primaryPhonestring nullable required
namestring nullable required
avatarstring nullable required
customDataobject required

arbitrary

identitiesobject required
lastSignInAtnumber nullable required
createdAtnumber required
updatedAtnumber required
applicationIdstring nullable required
cimdClientIdstring nullable required

The identifier of the CIMD (client ID metadata document) client from the user's first consent. null unless the user's first consent was granted to a CIMD client. Mutually exclusive with applicationId.

isSuspendedboolean required
hasPasswordboolean
hasSecurityVerificationMethodboolean
passwordDigeststring nullable
passwordAlgorithm'Argon2i' | 'Argon2id' | 'Argon2d' | 'SHA1' | 'SHA256' | 'MD5' | 'Bcrypt' | 'Legacy' nullable

Changes

    • info

      added the new optional query request parameter customData

    • breaking

      the / response property's maxLength was increased from 12 to 128 for the response status

    • breaking

      the /// response property's maxLength was increased from 12 to 128 for the response status

    • info

      added the new optional query request parameter identityId

    • info

      added the new optional query request parameter identityProvider

    • info

      added the new optional query request parameter identityType