GET /admin/api/{realmName}/clients/v2?q=<filter-expression>
| This guide is describing a feature which is currently in preview. Please provide your feedback while we’re continuing to work on this. |
The Admin API v2 supports filtering clients using the q query parameter.
The filter syntax is a subset of the SCIM filter syntax defined in RFC 7644, Section 3.4.2.2. All string comparisons are case-sensitive.
GET /admin/api/{realmName}/clients/v2?q=<filter-expression>
String values must be enclosed in double quotes. Boolean values are unquoted.
GET /admin/api/{realmName}/clients/v2?q=clientId eq "my-app"
GET /admin/api/{realmName}/clients/v2?q=enabled eq true
The following comparison operators are supported for client filtering:
| Operator | Meaning | Example |
|---|---|---|
|
Equal |
|
|
Not equal |
|
|
Contains (substring) |
|
|
Starts with |
|
|
Ends with |
|
|
Present (field is not null) |
|
Logical operators (and, or, not) and parentheses for grouping are supported.
For the full syntax reference, including operator precedence and detailed examples, see the SCIM filtering guide in the Server Administration Guide.
|
The |
A comparison with a field that has no value is never true, and for every searchable field except roles the negated comparison is not true either.
For example, neither auth.method ne "client-secret" nor not (auth.method eq "client-secret") returns SAML clients or public clients, because they have no authentication method. Use not auth.method pr to find them.
The roles field is multi-valued: roles ne "admin" does not return clients without roles, but not (roles eq "admin") does, as described in Collection field matching.
The eq and ne operators accept the null literal, but a comparison such as description eq null never matches any client, so it cannot be used to find clients where the field is absent.
For details, see Attributes without a value in the Server Administration Guide.
Only the fields listed below can be used in filter expressions. Other fields of the client representation are not searchable. Using an unsearchable or unknown field returns HTTP 400, unlike the SCIM API which silently ignores unrecognized attributes.
| Field | Type | Description |
|---|---|---|
|
String |
ID uniquely identifying this client |
|
String |
Human readable name of the client |
|
String |
Human readable description of the client |
|
Boolean |
Whether this client is enabled |
|
String |
URL to the application’s homepage that is represented by this client |
|
Set<String> |
Roles associated with this client |
|
String |
Discriminator. Allowed values: |
|
Integer |
Timestamp when the client was created |
|
Integer |
Timestamp when the client was last updated |
These fields are available only for openid-connect clients.
They resolve to null for SAML clients, so value-based comparisons like eq, ne, co, or sw do not match SAML clients.
See Fields without a value.
| Field | Type | Description |
|---|---|---|
|
String |
Client authentication method (e.g. |
For multi-valued fields (type Set<String> in the tables above), the eq, co, sw, and ew operators match if any element in the collection satisfies the condition:
roles eq "admin" - matches clients that have a role named admin
roles co "adm" - matches clients that have a role whose name contains adm
The ne operator matches if any element in the collection differs from the value.
For example, roles ne "admin" matches clients that have at least one role other than admin, and it does not match clients without roles.
To find clients that do not have a given role, negate the equality instead: not (roles eq "admin").
This form also matches clients without roles.
To match clients that have multiple values, combine conditions with and:
q=roles eq "admin" and roles eq "user"
Find all enabled OIDC clients:
GET /admin/api/{realmName}/clients/v2?q=protocol eq "openid-connect" and enabled eq true
Find clients with a description:
GET /admin/api/{realmName}/clients/v2?q=description pr
Find OIDC clients using client-secret authentication:
GET /admin/api/{realmName}/clients/v2?q=auth.method eq "client-secret"
Find clients by display name prefix, excluding a specific protocol:
GET /admin/api/{realmName}/clients/v2?q=displayName sw "My" and protocol ne "saml"
Use the fields query parameter to include only specific fields in the response.
If omitted, all fields are returned.
GET /admin/api/{realmName}/clients/v2?fields=clientId,enabled,protocol
Filtering and projection can be combined. The filter evaluates against the full representation before projection is applied, so filtered fields do not need to be included in the projection:
GET /admin/api/{realmName}/clients/v2?q=enabled eq true&fields=clientId,displayName
The server returns HTTP 400 with a descriptive error message when:
The filter expression has a syntax error.
The filter references an unknown field.
The filter references a field that is not searchable.
The filter uses an unsupported operator (e.g. gt, ge, lt, le).
The filter uses null with an operator other than eq or ne.
{
"error": "Unknown query field: unknownField"
}