Access Management Query Syntax
Use the query parameter to filter role assignments and find roles with specific permissions. Role and role assignment queries use their own search syntax.
Endpoints
Endpoint | Filters covered on this page |
|---|---|
| |
|
Search fields are specific to each resource. The assignment filters described below apply to /api/assignedRoles. For user and group searches, see Search Users by Email or Group Membership.
The query parameter is optional. If you omit it or pass an empty value or only whitespace, the resource applies no search filter. The response is subject to the resource's permissions and pagination limits.
Search Fields
Write each condition as field:value. Use YouTrack database IDs for projects, organizations, users, groups, and roles. For details about IDs, see Users, Groups, and Access Management.
All IDs in the examples are sample database IDs. Replace them with database IDs from your YouTrack instance.
Field | Accepted value | Matches |
|---|---|---|
| The database ID of a project or organization, or | Assignments that apply in the specified scope, including assignments inherited from broader scopes. |
| The database ID of a user or user group. | Assignments to the holder, including assignments inherited through group or project team membership. |
| The database ID of a role. | Assignments of the specified role. |
| A permission key, for example, | Assignments whose role includes the specified permission. |
To find permission keys, request GET /api/permissions?fields=id,name. Use the permission's id value as the key. See Permissions.
Unknown search fields and unknown permission keys cause a 400 Bad Request response.
Direct and Inherited Assignments
Scope and holder filters include inherited assignments by default. Append ! to a scope or holder value to return only direct role assignments.
Query | Matches |
|---|---|
| Assignments in project |
| Assignments directly in project |
| Assignments in the global scope. |
| Assignments to user |
| Assignments directly to user |
For an organization ID, scope: includes the organization and the global scope. With !, the query matches only assignments in that organization.
For a user group ID, holder: also matches assignments to groups and project teams through which the group inherits roles. With !, the query matches only assignments directly to that group.
For example, assume your account can read two assignments in project 0-0, one in its organization, and one globally. The query scope:0-0 matches all four assignments. The query scope:0-0! matches only the two project assignments. The number of matches depends on your instance's assignments and your permissions.
Combine Conditions
Syntax | Meaning | Example |
|---|---|---|
Adjacent field conditions or | Match both conditions. |
|
| Match either condition. |
|
| Exclude matches for the following condition. |
|
| Group conditions. |
|
Comma-separated values | Match any listed value. An optional |
|
| Match all listed values. |
|
Use parentheses to make grouping explicit when you combine operators. Apply ! to each value that requires an exact match, for example, scope:0-0!,0-1!.
URL-encode the query value. In cURL, use --data-urlencode with --get to encode spaces, ampersands, and other special characters.
Request Examples
Find Direct Project Assignments
When migrating a Hub /users/{id}/projectroles request, use the YouTrack user and project database IDs. Apply ! to both values to retrieve roles assigned directly to the user in that project.
Replace 0-0 with the project's database ID and 24-2 with the user's database ID. To retrieve direct project assignments for every holder, use only scope:0-0!.
Include Inherited Assignments
To include assignments inherited by a user in a project, omit both exact-match suffixes:
This query includes assignments at the project, organization, and global scopes. It also includes assignments to groups and project teams through which the user inherits roles.
Find Roles with a Permission
To find roles that include the Read Issue permission, query /api/roles with its permission key:
To find assignments of roles with this permission, use the same permission: condition with /api/assignedRoles. Add scope: and holder: conditions to limit the assignments.