Skip to main content
The engagements query provides a powerful way to list and search through all of your engagements. It supports filtering, text search, sorting, and cursor-based pagination.

Basic paginated list

To retrieve a simple paginated list of engagements, use the first argument to specify how many results you want:
query ListEngagements {
  engagements(first: 10) {
    edges {
      cursor
      node {
        ... on PurchaseEngagement {
          id
          shortId
          type
          closingDate
          owner
          status {
            ... on PurchaseEngagementReceivedStatus { state }
            ... on PurchaseEngagementSettingUpStatus { state }
            ... on PurchaseEngagementPreparingForClosingStatus { state }
            ... on PurchaseEngagementClosingInProgressStatus { state }
            ... on PurchaseEngagementClosedStatus { state }
            ... on PurchaseEngagementCancelledStatus { state }
          }
        }
        ... on RefinanceEngagement {
          id
          shortId
          type
          closingDate
          owner
          status {
            ... on RefinanceEngagementReceivedStatus { state }
            ... on RefinanceEngagementSettingUpStatus { state }
            ... on RefinanceEngagementPreparingForClosingStatus { state }
            ... on RefinanceEngagementClosingInProgressStatus { state }
            ... on RefinanceEngagementClosedStatus { state }
            ... on RefinanceEngagementCancelledStatus { state }
          }
        }
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}

Filtering

Use the filters argument with an EngagementSearchFilterInput to narrow down results. All filter fields are optional and can be combined:

By status

query ActiveEngagements {
  engagements(
    first: 20,
    filters: {
      statuses: [RECEIVED, SETTING_UP, PREPARING_FOR_CLOSING]
    }
  ) {
    edges {
      node {
        ... on PurchaseEngagement { id shortId type }
        ... on RefinanceEngagement { id shortId type }
      }
    }
  }
}

By type

query PurchaseEngagementsOnly {
  engagements(
    first: 20,
    filters: {
      types: [PURCHASE]
    }
  ) {
    edges {
      node {
        ... on PurchaseEngagement { id shortId closingDate }
      }
    }
  }
}

By province

query OntarioEngagements {
  engagements(
    first: 20,
    filters: {
      provinces: [ONTARIO, BRITISH_COLUMBIA]
    }
  ) {
    edges {
      node {
        ... on PurchaseEngagement { id shortId }
        ... on RefinanceEngagement { id shortId }
      }
    }
  }
}

By date range

Both closingDate and createdAt support date range filtering:
query EngagementsClosingThisMonth {
  engagements(
    first: 20,
    filters: {
      closingDate: {
        startDate: "2025-09-01",
        endDate: "2025-09-30"
      }
    }
  ) {
    edges {
      node {
        ... on PurchaseEngagement { id shortId closingDate }
        ... on RefinanceEngagement { id shortId closingDate }
      }
    }
  }
}

Combining filters

All filter fields can be used together. When multiple filters are specified, results must match all of them:
query FilteredEngagements {
  engagements(
    first: 20,
    filters: {
      types: [PURCHASE],
      statuses: [PREPARING_FOR_CLOSING, CLOSING_IN_PROGRESS],
      provinces: [ONTARIO],
      closingDate: {
        startDate: "2025-09-01",
        endDate: "2025-12-31"
      }
    }
  ) {
    edges {
      node {
        ... on PurchaseEngagement { id shortId closingDate owner }
      }
    }
  }
}
Use the query parameter to perform a text search across engagements. This is useful for finding engagements by client name, short ID, or other searchable fields:
query SearchEngagements {
  engagements(
    first: 10,
    query: "Jane Doe"
  ) {
    edges {
      node {
        ... on PurchaseEngagement { id shortId clients { firstName lastName } }
        ... on RefinanceEngagement { id shortId clients { firstName lastName } }
      }
    }
  }
}
The query and filters parameters can be combined to perform a text search within a filtered set of results.

Sorting

Control the order of results with the sortOrder argument using the EngagementSearchSortOrder enum:
Sort orderDescription
CLOSING_DATE_ASCClosing date, earliest first
CLOSING_DATE_DESCClosing date, most recent first
CREATED_AT_ASCCreation date, oldest first
CREATED_AT_DESCCreation date, newest first
query EngagementsByClosingDate {
  engagements(
    first: 20,
    sortOrder: CLOSING_DATE_ASC
  ) {
    edges {
      node {
        ... on PurchaseEngagement { id shortId closingDate }
        ... on RefinanceEngagement { id shortId closingDate }
      }
    }
  }
}

Pagination

The engagements query uses cursor-based pagination. Use pageInfo to determine if there are more results, and pass the endCursor value as the after argument to fetch the next page:
query NextPage {
  engagements(
    first: 10,
    after: "eyJpZCI6MTB9"
  ) {
    edges {
      cursor
      node {
        ... on PurchaseEngagement { id shortId }
        ... on RefinanceEngagement { id shortId }
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
A typical pagination loop:
1

Fetch the first page

Call engagements(first: 20) without an after cursor.
2

Check for more results

If pageInfo.hasNextPage is true, there are more results to fetch.
3

Fetch subsequent pages

Pass pageInfo.endCursor as the after argument in the next request. Repeat until hasNextPage is false.
For more details on cursor-based pagination patterns, see the Pagination documentation.