# Link your token to a Lens Post & Account

Once you've programmatically created your token on the `BonsaiLaunchpad` contract , you can link it to a Lens Post & Account via our API so it's presentable on the Bonsai app.

<figure><img src="https://2320382570-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQDXpBrwB8xazmxHvJsen%2Fuploads%2Fiz7jdoE6w7CLQqLYBuDN%2FScreenshot%202025-05-08%20at%201.29.17%E2%80%AFPM.png?alt=media&#x26;token=07414255-75ed-4307-bf0e-ca7ac811e133" alt="" width="369"><figcaption><p>Linked creator on the tokens index page</p></figcaption></figure>

<figure><img src="https://2320382570-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQDXpBrwB8xazmxHvJsen%2Fuploads%2FZ6nblupPfTdlwsH5EyjP%2FScreenshot%202025-05-08%20at%201.26.45%E2%80%AFPM.png?alt=media&#x26;token=a4f9c25a-58dc-4c80-b95d-d15561a073d7" alt=""><figcaption><p>Linked post on the token page</p></figcaption></figure>

## Linking your token

Mainnet API: `https://app.onbons.ai/api/clubs/set-lens-data`

Testnet API: `https://testnet.onbons.ai/api/clubs/set-lens-data`&#x20;

METHOD: `POST`

HEADERS AUTHORIZATION: `Bearer {lensIdToken}` ([Read more about Lens ID Token](https://lens.xyz/docs/protocol/authentication#advanced-topics-authentication-tokens))

:information\_source: To get the Lens ID Token of an authenticated lens account, you can do so via the `SessionClient`

```typescript
const creds = await (sessionClient as SessionClient).getCredentials();
const lensIdToken = creds.isOk() ? creds.value?.idToken : null;
```

BODY:

:information\_source: All of these are required. The typical flow is a) create the token b) create the lens post c) call this `/set-lens-data` endpoint to link them

| Param  | Type          | Description                                       |
| ------ | ------------- | ------------------------------------------------- |
| txHash | `0x${string}` | the transaction hash where you created your token |
| postId | `string`      | the post id or slug to link your token with       |

RESPONSE: 200 | 403 | 401 | 400 | 500

:information\_source: If successful, the response is 200 with json `{ success: true, url: "{bonsai token page}" }` with `url` looking something like this: <https://testnet.onbons.ai/token/lens/0xa42da846a18dcde308bdea8c3b890f782949a5f3>
