Get Profile
Fetch a single profile by it's id
or handle
.
Request
- forProfileId:
ProfileId
(optional)- The identifier of the profile to fetch.
ProfileId
is of type string.
- The identifier of the profile to fetch.
- forHandle:
Handle
(optional)- The handle of the profile to fetch.
Handle
is of type string.
- The handle of the profile to fetch.
Note: You must provide either a profileId
or a handle
in the request but not both.
Invocation
const profileById = await lensClient.profile.fetch({
forProfileId: "0x0635",
})
const profileByHandle = await lensClient.profile.fetch({
forHandle: "lens/@handle",
})
query Profile {
profile(request: { forProfileId: "0x0635" }) {
...Profile
}
}
query Profile {
profile(request: { forHandle: "lens/@handle" }) {
...Profile
}
}
Response
{
...Profile
}
Using LensClient SDK
// your LensClient does not need to be authenticated
// by id
const profileById = await lensClient.profile.fetch({
forProfileId: "0x0635",
})
console.log(`Profile fetched by id: `, {
id: profileById.id,
handle: profileById.handle,
})
// by handle
const profileByHandle = await lensClient.profile.fetch({
forHandle: "lens/lensprotocol",
})
console.log(`Profile fetched by handle: `, {
id: profileByHandle.id,
handle: profileByHandle.handle,
})
Full GraphQL API Example
Updated 2 days ago