Filtering
Most results that are paginated can also be filtered. This makes it easy to retrieve specific information, like any issues assigned to a particular user, but much more complex queries are also possible. For example, you could fetch all issues associated with a project that is supposed to be completed next week and have not yet been started.
Filtering is currently in Alpha. While we don't anticipate the filtering format to change, it might. Follow our API slack channel to get a heads up on breaking changes.
For example, to return all urgent and high priority issues in the workspace, you can use the following query:
1
query HighPriorityIssues {
2
issues(filter: {
3
priority: { lte: 2 }
4
}) {
5
nodes {
6
id, title, priority
7
}
8
}
9
}
Copied!
The above query will also return any issues that haven't been given any priority (their priority is 0). To exclude them, you can add another not equals comparator:
1
query HighPriorityIssues {
2
issues(filter: {
3
priority: { lte: 2, neq: 0 }
4
}) {
5
nodes {
6
id, title, priority
7
}
8
}
9
}
Copied!

Comparators

You can use the following comparators on string, numeric, and date fields:
Comparator
Description
eq
Equals the given value
neq
Doesn't equal the given value
in
Value is in the given collection of values
nin
Value is not in the given collection of values
Numeric and date fields additionally have the following comparators:
Comparator
Description
lt
Less than the given value
lte
Less than or equal to the given value
gt
Greater than then given value
gte
Greater than or equal to the given value
String fields additionally have the following comparators:
parator
Description
startsWith
Starts with the given value
notStartsWith
Doesn't start with the given value
endsWith
Ends with the given value
notEndsWith
Doesn't end with the given value
contains
Contains the given value
notContains
Doesn't contain the given value
Optional values additionally support the null comparator, which can be used to return entities depending on whether the field has a value or not. The following query will return all issues that don't have a description:
1
query Issues {
2
issues(filter: {
3
description: { null: true }
4
}) {
5
nodes {
6
id, title, description
7
}
8
}
9
}
Copied!

Logical operators

By default, all fields described in the filter need to be matched. The filter merges all the conditions together using a logical and operator.
For example, The below example will find all urgent issues that are due in the year 2021.
1
query Issues {
2
issues(filter: {
3
priority: { eq: 1 }
4
dueDate: { lte: "2021" }
5
}) {
6
nodes {
7
id, title, priority, dueDate
8
}
9
}
10
}
Copied!
To change the logical operator, all filters support the or keyword that lets you switch to a logical or operator. For example, to filter for low-priority or un-prioritized issues that need to be completed in the year 2021, you can execute the following query:
1
query Issues {
2
issues(filter: {
3
or: [
4
{ priority: { eq: 4 } },
5
{ priority: { eq: 0 } }
6
]
7
dueDate: { lte: "2021" }
8
}) {
9
nodes {
10
id, title, priority, dueDate
11
}
12
}
13
}
Copied!

Filtering by relationship

Data can also be filtered based on their relations. For example, you can filter issues based on the properties of their assignees. To query all issues assigned to a user with a particular email address, you can execute the following query:
1
query AssignedIssues {
2
issues(filter: {
3
assignee: { email: { eq: "[email protected]" } }
4
}) {
5
nodes {
6
id
7
title
8
assignee {
9
name
10
}
11
}
12
}
13
}
Copied!
Many-to-many relationships can be filtered similarly. The following query will find issues that have the Bug label associated.
1
query Issues {
2
issues(filter: {
3
labels: { name: { eq: "Bug" } }
4
}) {
5
nodes {
6
id, title
7
}
8
}
9
}
Copied!
The above query returns all issues that have at least one label that matches the name Bug. To create a query where all labels on an issue are matched to the filter criteria, you can use the every keyword:
1
query Issues {
2
issues(filter: {
3
labels: { every: { name: { eq: "Bug" } } }
4
}) {
5
nodes {
6
id, title
7
}
8
}
9
}
Copied!
The above would also filter out issues that have multiple labels, regardless of what they are.

Relative time

All date fields support relative time, defined as ISO 8601 durations relative to the current date. This lets you create a filter that always returns all issues that are due in the next 2 weeks, regardless of when you run it:
1
query IssuesDue {
2
issues(filter: {
3
dueDate: { lt: "P2W" }
4
}) {
5
nodes {
6
id, title
7
}
8
}
9
}
Copied!

Examples

Find all bugs and defects from projects that are lead by any user named "John":
1
query Projects {
2
projects(filter: {
3
lead: { name: { startsWith: "John" } }
4
}) {
5
nodes {
6
issues(filter: {
7
labels: { name: { in: ["Bug", "Defect"] } }
8
}) {
9
nodes {
10
id
11
title
12
}
13
}
14
}
15
}
16
}
Copied!
Find all issues assigned to me that have a comment containing a thumbs-up emoji:
1
query Issues {
2
viewer {
3
assignedIssues(filter: {
4
comments: { body: { contains: "👍" } }
5
}) {
6
nodes {
7
id
8
title
9
}
10
}
11
}
12
}
Copied!
Find all issues that have been created by me and have been closed in the past two weeks:
1
query ClosedIssues {
2
viewer {
3
createdIssues(filter: { completedAt: { gt: "-P2W" } }) {
4
nodes {
5
id, title
6
}
7
}
8
}
9
}
Copied!
Find all started issues in ongoing projects that don't have an estimate:
1
query Issues {
2
issues(
3
filter: {
4
estimate: { eq: 0 }
5
state: { type: { eq: "started" } }
6
project: { state: { eq: "started" } }
7
}
8
) {
9
nodes {
10
title
11
estimate
12
project {
13
name
14
}
15
}
16
}
17
}
Copied!
Last modified 1mo ago