Guru Query Language

Filter card queries with Guru Query Language expressions, from dates to tags to verification state.

Guru Query Language lets you build complex filters for card queries, similar to WHERE clauses in SQL. Pass a query in the q parameter of the List Cards endpoint.

There are two kinds of expressions. Simple expressions operate on a single field, usually with an operator and a value, like lastModified > 2016-01-01T00:00:00.000-00:00. Grouping expressions link simple expressions with AND and OR, like (lastModified < 7_days_ago AND lastModifiedBy = "[email protected]"). Parentheses control operation grouping.

📘

Legacy board naming

The boardCount and boards fields retain their legacy board naming from before Guru's transition from boards to folders. They operate on folders.

Absolute date expressions

Compare a date field to an absolute date value.

FieldsdateCreated, lastVerified, lastModified, firstCommentCreatedEvent, lastCommentCreatedEvent, firstCopiedEvent, lastCopiedEvent, firstViewedEvent, lastViewedEvent
Operators>, >=, <, <=
ValueA date in an ISO-8601 format (timezone required): yyyy-MM-ddZ, yyyy-MM-ddTHH:mmZ, yyyy-MM-ddTHH:mm:ssZ, or yyyy-MM-ddTHH:mm:ss.SSSZ (for example, 2015-02-01T15:01:30+04:00)

Examples:

  1. dateCreated >= 2016-01-01T00:00+00:00 - the card was created after January 1st, 2016 at midnight UTC
  2. lastViewedEvent < 2016-10-15T+00:00 - the card was last viewed before October 15th

Relative date expressions

Compare a date field to a relative time range, such as finding all cards modified in the last three days.

FieldsdateCreated, lastVerified, lastModified, firstCommentCreatedEvent, lastCommentCreatedEvent, firstCopiedEvent, lastCopiedEvent, firstViewedEvent, lastViewedEvent
Operators>, >=, <, <=
ValueX_days_ago, where X is a positive integer. days is the only unit available.

Examples:

  1. lastModified < 7_days_ago - cards that were modified in the last week
  2. lastViewedEvent > 30_days_ago - cards that haven't been viewed in the last 30 days

Card type expressions

Specify whether to return cards or questions.

Fieldstype
Operators=, !=
ValueCARD or QUESTION

Example: type = CARD - only show cards, not questions

Verification interval expressions

Compare the card's verification interval to a number of days.

FieldsverInterval
Operators=, !=, >, >=, <, <=
ValueNumber of days, positive integers only

Example: verInterval = 7 - cards that must be verified every 7 days

Count expressions

Compare numeric fields of a card.

FieldsboardCount (the number of folders a card is in), favoriteCount, commentCount, copiedCount, viewedCount
Operators=, !=, >, >=, <, <=
ValueA positive integer

Examples:

  1. viewedCount > 5 - cards that have been viewed more than 5 times
  2. boardCount = 0 - cards that aren't in any folder

File attachment expressions

Filter for cards that have or do not have file attachments.

FieldshasFileAttachment, hasNoFileAttachment

Example: hasFileAttachment - returns cards that have a file attachment

File attachment type expressions

FieldsfileAttachmentType
Operators=, !=
ValueAny media type, like application/pdf, application/vnd.ms-powerpoint, or text/plain

Example: fileAttachmentType = "application/pdf" - cards with PDF attachments

Tag category expressions

Filter cards that have or don't have tags from a specific tag category.

FieldstagCategory-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where the suffix is the ID of the tag category. Use Get all tag categories to find tag category IDs.
Operatorsexists, notExists

Example: tagCategory-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx exists

Tag expressions

Filter cards that have or don't have a specific tag.

Fieldstag-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where the suffix is the ID of the tag. Use Get all tag categories to find tag IDs.
Operatorsexists, notExists

Example: tag-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx exists

User expressions

Filter cards associated with a specific user.

FieldscreatorId (user that created the card), verifierId (user responsible for verifying the card), lastVerifiedBy (user that last verified the card), lastModifiedBy (user that last modified the card)
Operators=, !=
ValueThe email address of the user

Example: creatorId = "[email protected]" - cards created by Gary

Group expressions

Filter cards associated with a specific group.

FieldsverifierId (group responsible for verifying the card)
Operators=, !=
ValueThe ID of the group

Example: verifierId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" - cards this group is responsible for verifying

Verification state expressions

Filter cards by verification state.

FieldsverificationState
Operators=, !=
Valuetrusted, needsVerification

Example: verificationState != trusted - cards that are not trusted

Share type expressions

Filter cards based on their visibility.

FieldsshareType
Operators=, !=
ValueTEAM, PRIVATE, or PUBLIC

Example: shareType = PRIVATE - all cards that are private

Board expressions

Filter cards based on a folder the card is in.

Fieldsboards
OperatorsCONTAINS
ValueThe folder ID

Example: boards CONTAINS ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") - cards in the folder with that ID