> For the complete documentation index, see [llms.txt](https://docs.knn3.xyz/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.knn3.xyz/welcome/k.transformer/real-time-data-service/k.graphx-legacy/categories/lens.md).

# Lens

The Lens Protocol is a decentralized social graph built on the Polygon blockchain that is modular and composable. The modularity of the protocol is central to its design, making it one of the most competitive social graph protocols in the web3 ecosystem. Developers can obtain information about other modules and relationships bound to Lens protocol modules by querying the protocol, and reverse resolution is also supported.&#x20;

### Profile

In order to retrieve data related to Lens, such as assets and relationship data, via an EOA address, it is necessary to first locate the associated profileId by retrieving basic information about Lens using the address. The profileId serves as the key to query Lens-related data. Here is a sample code to illustrate this process.

```graphql
{addrs(where:{address:"0x88520C10ad3d35aD2D3220CdE446CcB33f09331B"}){
    lensInclude{
      profileId
      handle
      imageURI
      metadata
      address
      followModule
      value
    }
  }
}
```

[**`Try Yourself`**](https://master.graphql.knn3.xyz/graphql)

## Relationship

The Lens follow relationship is established through the EOA address and profileId of the users involved. This relationship represents the connection between a follower and the user they are following. For instance, if user A is following user B, the actual EOA address of user A will be bound to user B's profileId. To determine which Lens users are being followed by user A, it is necessary to query their EOA addresses. Here is a sample code that demonstrates this query process.

```graphql
{
  addrs(where:{address:"0x88520C10ad3d35aD2D3220CdE446CcB33f09331B"}){
    lensInclude{
      profileId
      handle
      imageURI
      metadata
      address
      followModule
      value
    }
    followLens{               #check handles followed by this address
      profileId
      handle
      imageURI
      metadata
      address
      followModule
      value
    }
    followLensAggregate{    # aggregation search
      count
    }
  }
}
```

[**`Try Yourself`**](https://master.graphql.knn3.xyz/graphql)

## Follower

To retrieve information about followers on a Lens account, it is necessary to conduct a query based on the Lens profileId or handle. This query will ultimately yield the EOA addresses of the followers associated with the account. Below is a sample code demonstrating the query process.

```graphql
{ 
  lens(where:{profileId:104724}){        # query based on profileId/handle
    profileId
    handle
    address
    metadata
    imageURI
    # followers, limit for the number of limit (default 10), offset is the paging query
    followerAddrs(options:{limit:5,offset:1}){           
      address
    }
    followerAddrsAggregate{
      count
    }
  }
}

```

[**`Try Yourself`**](https://master.graphql.knn3.xyz/graphql)

## Publishment List

The Lens pub of a given Lens account houses all of the NFT data associated with that account. To query the Lens pub, it is necessary to use either the Lens profileId or handle as a basis for the query. Below is a sample code demonstrating how to conduct this query.

```graphql
{
  lens(where:{profileId:104724}){        # query based on profileId/handle
    profileId
    handle
    address
    publishComments(options:{limit:5,offset:1}){    # each pub can be queried with paging
      profileId                         
      pubId                            
      profileIdPointed            # for which user to comment 
      pubIdPointed                # for which pub of users to comment
      contentURI                   # access the actual user comment data through this url
      timestamp
    }
    publishMirrors{
      pubId
      profileId
      profileIdPointed           # for which user to mirror
      pubIdPointed	      # for which pub of users to mirror
      contentURI
      timestamp
    }
    publishPosts{
      pubId
      profileId
      contentURI
      timestamp
    }
  }
}

```

[**`Try Yourself`**](https://master.graphql.knn3.xyz/graphql)

## Publishment Details

To quickly access specific information about a pub, it is possible to conduct a query using both the Lens profileId and pubId. This query will ultimately provide a complete export of all information associated with the Lens pub. Below is a sample code demonstrating how to conduct this query.

```graphql
{ 
  lens_post(where:{profileId:104724,pubId:27}){
    id
    profileId
    pubId
    contentURI
  }
  lens_comment(where:{profileId:104724,pubId:19}){
    contentURI
    timestamp
    pubIdPointed
    profileIdPointed
  }
  lens_mirror(where:{profileId:104724,pubId:12}){
    contentURI
    timestamp
    pubIdPointed
    profileIdPointed
  }
}
```

[**`Try Yourself`**](https://master.graphql.knn3.xyz/graphql)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.knn3.xyz/welcome/k.transformer/real-time-data-service/k.graphx-legacy/categories/lens.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
