Fetch Groups

This guide will help you with fetching Groups from Lens API.


Get a Group

Use the group query to fetch a single Group by address or by transaction hash.

Fetching a Group by transaction hash is extremely useful when building a user experience where a user creates a Group and needs it presented back to them.

query {  group(    request: {      group: "0x1234…"
      # OR
      # txHash: TxHash!    }  ) {    address    metadata {      description      icon      name      slug    }  }}

List Groups

Use the paginated groups query to fetch a list of Groups based on the provided filters.

query {  groups(    request: {      # the groups this account is a member of      member: "0x1234…"
      # optional filters      # filter: {      #   optional, name search query      #   name: "Fun"      # }    }  ) {    items {      address      metadata {        description        icon        name        slug      }    }    pageInfo {      prev      next    }  }}

See the Pagination guide for more information on how to handle paginated results.

Search Groups

Use the paginated searchGroups query to search for Groups based on the provided query.

query {  searchGroups(    request: {      # the name search query      query: "f1"    }  ) {    items {      address      metadata {        description        icon        name        slug      }    }    pageInfo {      prev      next    }  }}

See the Pagination guide for more information on how to handle paginated results.