Guides

Explore profiles

This query returns a list of profiles based on the profile sort criteria you pass in.

Request

ExploreProfilesRequest

📘

Use the GraphQL schema...

One of the huge advantages of GraphQL is you have a schema that should explain how the request and response schema should look at what properties exist in that. In these docs we explore code examples and explain key concepts but we will not explain each property that exists in the response for example, as the schema already does that!

Invocation

import { ExploreProfilesOrderByType } from "@lens-protocol/client";

const result = await client.explore.profiles({
  orderBy: ExploreProfilesOrderByType.MostFollowers,
});
query ExploreProfiles($request: ExploreProfilesRequest!) {
  exploreProfiles(request: $request) {
    items {
      ...Profile
    }
    pageInfo {
      ...PaginatedResultInfo
    }
  }
}

Response

Paginated result with Profile

You will see the paging result behaviour repeated a lot in the API, this is to allow you to fetch a certain amount and then page it for the most optimal request speed. Every time something is wrapped in a paging result you will always get returned a pageInfo which holds the cursors for the previous and next alongside the total count which exists in the database. These cursors are just pointers for the server to get to the next result and do not need to be understood by your client or server. If you ever want to then page to the next result you can pass these previous and next cursor in the request cursor property.

{
  "items": [
    {
      // profile
    }
    // list of profiles
  ],
  "pageInfo": {
    // ...PaginatedResultInfo
  }
}

Full GraphQL API Example

📘

Explore Profiles: GraphQL API Full Example