Guides

Unlink Handle From Profile

🚧

This request is protected by authentication

hint: this means it requires an x-access-token header put in the request with your authentication token.

📘

Lens Profile Manager Compatible: Gasless & Signless

This action can be used through the Lens Profile Manager to enable a gasless and signless experience.

Unlink a handle from an existing Lens Profile.

There are two different approaches you can use to unlink a handle from a profile. Depending on the whitelist status of your app and the settings of the profile you would like to set metadata for, you can use:

  • a) Unlink Handle From a Profile via Lens Profile Manager (Gasless & Signless)
  • b) Unlink Handle From a Profile Using TypedData and Broadcasting Onchain via the API (Gasless & Signed)

To decide which approach to use, you can use the following table. Please note that a profile may also have another Profile Manager enabled that is not powered by the Lens API, this is not covered below. To learn more about checking a profile's Profile Manager settings, see Profile Manager.

Is Your App Whitelisted?Profile has Lens Profiles Manager Enabled?Approach To Use
1truetrueLens Profile Manager
2truefalseTypedData & Broadcast via API
3falsetrueTypedData & Self-Funded
4falsefalseTypedData & Self-Funded

a) Unlink Handle From a Profile via Lens Profile Manager (Gasless & Signless)

Request

  • handle: Handle (required)
    • The handle of to unlink from the Lens Profile. Handle is a string.

Invocation

await client.profile.unlinkHandle({
  handle: "HANDLE",
});
mutation HandleUnlinkFromProfile {
  handleUnlinkFromProfile(request: { handle: "HANDLE" }) {
    ... on RelaySuccess {
      txId
      txHash
    }
    ... on LensProfileManagerRelayError {
      reason
    }
  }
}

Response

{
  "txHash": "0x000000",
  "txId": "0x01"
}
{
  "reason": "FAILED" // LensProfileManagerRelayErrorReasonType
}

b) Unlink Handle From a Profile Using TypedData and Broadcasting Onchain via the API (Gasless & Signed)

Request

  • handle: Handle (required)
    • The handle of to unlink from the Lens Profile. Handle is a string.

Invocation

const unlinkHandleFromProfileTypedData =
  await lensClient.profile.createUnlinkHandleTypedData({
    handle: "HANDLE",
  });

Response

{
  "id": "0x01",
  "expiresAt": "2023-10-01T00:00:00Z",
  "typedData": {
    "types": {
      "Link": [
        { "name": "nonce", "type": "uint256" },
        { "name": "deadline", "type": "uint256" },
        { "name": "profileId", "type": "uint256" },
        { "name": "handleId", "type": "uint256" }
      ]
    },
    "domain": {
      "name": "Lens",
      "chainId": "1",
      "version": "1",
      "verifyingContract": "0x0000000"
    },
    "value": {
      "nonce": "0x01",
      "deadline": "2023-10-01T01:00:00Z",
      "profileId": "0x01",
      "handleId": "0x01"
    }
  }
}

Full GraphQL API Example

📘

Handle Unlink From Profile: GraphQL API Full Example