# About Profiles
Source: https://docs.clicker.xyz/about/profiles
How we assign addresses to people
We do not infer profiles from usage patterns.
## Background
Many crypto apps and APIs are based on *addresses* interacting with *other addresses*, but an important insight of the Feed API is that users want to follow *people*, not *addresses*.
As a result, many of our API endpoints return *profiles*, which is an identity with one or more associated addresses.
## How to think about profiles and addresses
Our goal is to make things as easy as possible for you. So we have a simple mental model for addresses and profiles: *you send us addresses*, and *our API returns profiles*.
### You send us addresses (or external IDs)
Examples:
* To bulk-upload your internal follower network to us, send us each address and the addresses they follow.
* When a user sees a profile and wants to follow it, use the [Follow endpoint](/api-reference/follow).
* To request a user's feed, send the user's addresses to the [Feed endpoint](/api-reference/feed).
* If you identify users by an internal ID rather than a wallet address, you can use [External IDs](/guides/external-ids) with the `ext:` prefix in place of addresses.
### Our API returns profiles
Examples:
* The discovery endpoint recommends lists of profiles.
* When a user sends us one or more addresses to follow, we return each profile that was followed.
* Our feed endpoint always returns the profile of the actor (along with the specific address that performed the swap).
## Profile object
```ts theme={null}
export type Profile = {
id: string;
name: string;
images: {
raw: string | null;
sm: string | null;
xs: string | null;
};
addresses: string[];
externalId?: string; // Your app's internal user ID, if set
metadata: { ... }; // Social identities (Farcaster, ENS, Twitter) and trading metrics (PnL, win rate, trade count)
metrics?: { ... }; // Follower counts, comment activity, and copytrade stats
};
```
See [ProfileExtended](/response-types/profile-extended) for the full schema.
## Profile rules
We only associate addresses into a profile if there's *proven, public associations* between those addresses. For now, we only associate addresses together if they're verified under a single Farcaster account, or a user verifies their addresses in the Clicker mobile app.
Right now, we support EVM addresses (returned lowercased) and Solana addresses in profiles.
# Request API Key
Source: https://docs.clicker.xyz/about/request-api-key
The API and its docs are under active development. Response shapes and
endpoints may change over time.
Submit [this form](https://fq6lmgxucir.typeform.com/to/zdT7tPXn) to get a Clicker API key.
# Copyswap Intent
Source: https://docs.clicker.xyz/api-reference/copy-intent
POST /v1/swap-comment/{id}/copyswap
Fire this when a user moves to copytrade a comment. (For example: when a user taps a button on a comment to buy that token.)
The user’s trade must be matched exactly with an intent, so send us any address the user could use to make the copytrade, and fire this request any time you think a user could make a trade.
We use this information to measure copytrade volume and reward commenters.
# Feed
Source: https://docs.clicker.xyz/api-reference/feed
GET /v1/feed
Given a list of addresses, return a feed of swaps made by profiles that those addresses follow. Returns swaps on Base, Ethereum, and Solana.
# Feed, Specific Addresses
Source: https://docs.clicker.xyz/api-reference/feed-actor
GET /v1/feed/actor
Given a profile ID, return a feed of swaps made by them. Returns swaps on Base, Ethereum, and Solana.
# Follow Address
Source: https://docs.clicker.xyz/api-reference/follow
PUT /v1/addresses/{addressOrUid}/follow
For a given address, follow one or more target addresses. Following an address will automatically follow the whole profile and all their other addresses. The given address will then see those targets' activity in their feed. Note: For performance, returned profiles exclude social metrics (follower counts, copytrade stats). Use the Get Profile endpoint for full metrics.
# Bulk Follow/Unfollow Addresses
Source: https://docs.clicker.xyz/api-reference/follow-bulk
POST /v1/addresses/follow/bulk
Bulk-add follow and unfollow relationships between addresses and their targets. Note: For performance, returned profiles exclude social metrics (follower counts, copytrade stats). Use the Get Profile endpoint for full metrics.
# Leaderboard
Source: https://docs.clicker.xyz/api-reference/leaderboard-v2
GET /v2/leaderboard
Get the top traders with combined PnL across selected chains. Returns a flat list of traders sorted by total PnL.
**V2 is the recommended leaderboard API.** It provides a simpler, filter-based approach compared to the section-based V1 endpoint.
## V2 vs V1 Comparison
| Feature | V1 (`/v1/leaderboard`) | V2 (`/v2/leaderboard`) |
| ------------------- | ---------------------------------------- | -------------------------------------- |
| **Structure** | Section-based (multiple categories) | Filter-based (flat list) |
| **Chain selection** | Pre-defined sections like `chain-solana` | `chains` query param |
| **PnL data** | Single `pnl30` value | `pnl.total` + `pnl.perChain` breakdown |
| **Response** | `{ sections: [...] }` | `{ traders: [...] }` |
## Key Features
### Chain Filtering
Filter traders by one or more chains:
```bash theme={null}
# Single chain
GET /v2/leaderboard?chains=solana
# Multiple chains (combined PnL)
GET /v2/leaderboard?chains=base&chains=solana
```
When multiple chains are selected, `pnl.total` is the sum of PnL across those chains.
### Commenters Filter
Show only traders who have posted swap comments:
```bash theme={null}
GET /v2/leaderboard?onlyWithComments=true
```
### Per-Chain PnL Breakdown
The V2 response includes a breakdown of PnL per chain:
```json theme={null}
{
"traders": [
{
"profile": { ... },
"pnl": {
"total": 125000,
"perChain": {
"base": 80000,
"solana": 45000,
"ethereum": 0,
"hyperliquid": 0
}
},
"hasComments": true
}
]
}
```
## Supported Chains
* `base` - Base (Coinbase L2)
* `solana` - Solana
* `ethereum` - Ethereum mainnet
* `hyperliquid` - Hyperliquid
## Migration from V1
If you're currently using V1 section-based leaderboards:
| V1 Section | V2 Equivalent |
| ------------------- | ---------------------------------------------------------------------------------------- |
| `chain-solana` | `?chains=solana` |
| `chain-base` | `?chains=base` |
| `chain-ethereum` | `?chains=ethereum` |
| `chain-hyperliquid` | `?chains=hyperliquid` |
| `all` | `?chains=base&chains=solana&chains=ethereum&chains=hyperliquid` (or omit `chains` param) |
# Leaderboard Ranking
Source: https://docs.clicker.xyz/api-reference/leaderboard-v2-ranking
GET /v2/leaderboard/ranking
Get a specific user's ranking position based on combined PnL across selected chains.
Get a specific user's ranking position based on combined PnL across selected chains.
## Usage
```bash theme={null}
# Get ranking across all chains
GET /v2/leaderboard/ranking?address=0x1234...
# Get ranking for specific chains
GET /v2/leaderboard/ranking?address=0x1234...&chains=base&chains=solana
```
## Response
```json theme={null}
{
"ranking": 42
}
```
Returns `null` if the user is not on the leaderboard (either not a trader or below the minimum threshold).
## Notes
* Ranking is 1-indexed (rank 1 = top trader)
* When multiple chains are specified, PnL is summed across those chains for ranking
* Omitting `chains` parameter uses all supported chains
# Position by ID
Source: https://docs.clicker.xyz/api-reference/position
GET /v1/position/{id}
Given a position ID, get a single position with its trades and comments.
# Position by Details
Source: https://docs.clicker.xyz/api-reference/position-by-timestamp
GET /v1/positions/{address}/{chain}/{contract}/{timestamp}
Find a position (actor address, chain, token address) by the UNIX timestamp. Can be used to find a position for a user's specific swap transaction.
# Post Comment
Source: https://docs.clicker.xyz/api-reference/post-comment
POST /v1/swap-comments
Creates a new comment on a swap transaction.
# Profile
Source: https://docs.clicker.xyz/api-reference/profile
GET /v1/addresses/{identifier}/profile
Returns the profile (name, addresses, images, and metadata) for a given address or profile UUID.
# Profile Name
Source: https://docs.clicker.xyz/api-reference/profile-delete-name
DELETE /v1/profiles/{identifier}/name
Deletes the name and avatar for this profile.
# Address Followers
Source: https://docs.clicker.xyz/api-reference/profile-followers
GET /v1/addresses/{identifier}/followers
Return a list of the profiles who follow the given address.
# Address Follows
Source: https://docs.clicker.xyz/api-reference/profile-follows
GET /v1/addresses/{identifier}/follows
Return a list of the profiles that the given address follows.
# Profile Positions
Source: https://docs.clicker.xyz/api-reference/profile-positions
GET /v1/addresses/{identifier}/positions/{status}
Returns token positions for a profile containing full trade history.
**Position status:**
- `open`: Tokens currently held (remaining position value >= \$1)
- `closed`: Tokens fully exited or dust remaining (remaining position value < \$1)
Each position includes:
- Token metadata (chain, symbol, name, address, image)
- Position stats (bought/sold USD, realized gains, current holdings cost basis)
- All individual trades for that token with timestamps and comments
- Engagement metrics (copytrade count/volume, comments, replies)
**Sorting options:**
- `value` (default): For closed positions, sorted by realized gains descending (with zero-sell positions pushed to bottom). For open positions, sorted by 30-day sell cost basis.
- `latest`: For closed positions, sorted by close date. For open positions, sorted by open date.
**Aggregation:**
By default, returns aggregated positions across all addresses in the profile. Set `providedAddressesOnly=true` to scope to just the provided wallet address.
# Profile Name
Source: https://docs.clicker.xyz/api-reference/profile-set-name
PUT /v1/profiles/{identifier}/name
Set a name and avatar for a profile, scoped to each partner. Your domain suffix (e.g. `.clicker.xyz`) is appended to the name in responses.
Approved partners can have names promoted as the global username when the profile has no social identity (Twitter, Farcaster, ENS, etc.). Contact us to enable this.
# Retrieve Comments
Source: https://docs.clicker.xyz/api-reference/retrieve-comment
GET /v1/swap-comments
Retrieves all comments for specific swaps.
# Token Comments
Source: https://docs.clicker.xyz/api-reference/token-comments
GET /v1/tokens/{chain}/{contractAddress}/comments
# Token Positions
Source: https://docs.clicker.xyz/api-reference/token-positions
GET /v1/tokens/{chain}/{contractAddress}/positions/{status}
Returns positions for a specific token across all traders. Open positions are those with remaining value >= \$1; closed positions have remaining value < \$1 (fully exited or dust). The metadata.trades array is only populated with trades which were commented on.
Returns open or closed positions for a specific token across named traders. Use this to enrich token detail pages with social trading context — showing which traders have conviction in a token and how their positions are performing.
## Path Parameters
### `chain`
The blockchain the token is on. Supported chains:
| Chain | Description |
| ------------- | ------------------- |
| `base` | Base (Coinbase L2) |
| `solana` | Solana |
| `ethereum` | Ethereum mainnet |
| `hyperliquid` | Hyperliquid (perps) |
### `contractAddress`
The token's contract address on the given chain.
### `status`
Either `open` or `closed`.
## Sorting
The default sort is `value`, which orders positions by size:
* **Open positions** are sorted by **holding amount** (largest current holdings first).
* **Closed positions** are sorted by **all-time realized PnL** (highest profit first).
You can pass `sort=latest` to sort by most recent trade activity instead.
## Calling This Endpoint for Perps
Perps positions on Hyperliquid use the same endpoint — just pass `hyperliquid` as the chain. For example, to get open ETH perps positions:
```
GET /v1/tokens/hyperliquid/0x0000000000000000000000000000000000000000/positions/open
```
Perps positions include additional fields like `perpPositionType`, `perpLeverage`, and `positionAmountWithLeverage`. See the [Perps Positions guide](/guides/perps) for how to handle these fields in your integration.
## Understanding Position Values
The response includes several USD value fields that serve different purposes:
**`positionAmount`** is the base token quantity held. For perps, this is the margin amount (un-leveraged).
**`positionAmountWithLeverage`** (perps only) is the token amount multiplied by leverage — the notional exposure.
**`positionStats.holdingsCostBasisUSD`** is the USD cost basis of the current holdings. For spot, this is what the trader paid for tokens they still hold. For perps, this is the margin posted.
**`positionStats.realizedGainsUSD`** is the all-time realized PnL for the position.
To compute **unrealized PnL**, you need a current price from your own pricing source:
```
// Spot
unrealizedPnL = (positionAmount * currentPrice) - holdingsCostBasisUSD
// Perps (see the Perps guide for long vs short)
unrealizedPnL = (positionAmountWithLeverage * currentPrice) - holdingsCostBasisUSDWithLeverage
```
Clicker provides the position data and cost basis. Your app provides the real-time price.
# Tokens Feed
Source: https://docs.clicker.xyz/api-reference/tokens-feed
GET /v1/tokens/feed
Returns a feed of tokens sorted by most recent comment. Each item contains the most recent comment (and associated trade metadata) per actor for that token within the past 7 days. Filter by chain using the `chains` query parameter.
# Unfollow Address
Source: https://docs.clicker.xyz/api-reference/unfollow
DELETE /v1/addresses/{addressOrUid}/follow
Remove one or more target addresses from the given address's follow list. Unfollowing an address will automatically unfollow other addresses belonging to that profile. Note: For performance, returned profiles exclude social metrics (follower counts, copytrade stats). Use the Get Profile endpoint for full metrics.
# Verifying Webhooks
Source: https://docs.clicker.xyz/api-reference/verifying-webhooks
When Clicker sends a webhook event to your server, a signature passed in the request headers allows you to verify it's authenticity. It's important that you verify that the header matches the HMAC signature of the request payload signed with your webhook secret to ensure the request originated from Clicker.
What you need to do this:
* The secret generated when first creating the webhook
* The signature in the header `daylight-signature`
* The string of the body included in the request
## Example verification function
```typescript theme={null}
import crypto from 'crypto';
export function verifyDaylightWebhookSignature({
headerSignature,
body,
secret,
}: {
headerSignature: string | null | undefined;
body: string;
secret: string;
}) {
//Step 1: Extract the timestamp and signatures from the header
// (the signature var in this case)
const sigSplit = (headerSignature || '').split(',') || [];
let timestamp: string | undefined = undefined;
let signature: string | undefined = undefined;
for (const element of sigSplit) {
const [key, value] = element.split('=');
if (key === 't') {
timestamp = value;
} else if (key === 'v1') {
signature = value;
}
}
if (!signature || !timestamp) {
throw new Error(`Missing timestamp or signature in ${signature}`);
}
// Step 2: Prepare the signed_payload string
const toSign = `${timestamp}.${body}`;
//Step 3: Determine the expected signature
const hash = crypto
.createHmac('sha256', secret)
.update(toSign)
// use base64url instead of base64 to escape equal signs
// a header ending with an = is invalid!
.digest('base64url');
if (hash !== signature) {
throw new Error(`Incorrect signature value in ${signature}`);
}
return true;
}
```
# Registered Webhooks
Source: https://docs.clicker.xyz/api-reference/webhook
GET /v1/webhooks/feed
Provides a list of all or your currently registered feed webhooks. Use this if you have lost the uid for a webhook you created.
# Webhook Addresses
Source: https://docs.clicker.xyz/api-reference/webhook-addresses
GET /v1/webhooks/feed/{uid}/addresses
Provides a page of 1000 addresses subscibed to your feed webhook, with links to the next and prev pages if applicable.
# Integration Guide
Source: https://docs.clicker.xyz/api-reference/webhook-integration
Best practices for integrating trade and comment notifications with fatigue prevention
## Overview
The Clicker API provides real-time trade and comment data by delivering webhook events to the partner's backend. **Notification delivery and fatigue prevention are the responsibility of the integrating partner.** This guide shows examples of how the Clicker app uses a webhook's payload to filter notifications. Each webhook POST body contains `{ events: [...] }` — the field paths below reference fields within each event object.
## Automatic Filters
These filters could be implemented in the background on your side without surfacing to users in notification settings.
### Filter by trade freshness
**Event types:** `new-feed-item`, `comment-created`
**User story:** Stale trades aren't actionable. If there's a delivery backlog, users shouldn't get flooded with outdated notifications.
**Webhook payload field:** `feedItem.timestamp`
**Recommended automatic filter:** Don't send notifications for trades older than 5 minutes.
### Filter by comment timeliness
**Event types:** `comment-created`
**User story:** Comments on old trades are less relevant. Users want to see commentary while the trade context is still fresh.
**Webhook payload field:** `feedItem.timestamp`
**Recommended automatic filter:** Don't send comment notifications if the trade is older than 15 minutes.
### Rate limit by trader/token pair
**Event types:** `new-feed-item`, `comment-created`
**User story:** Active traders might make multiple swaps on the same token in a short period. Users don't need a notification for every single one.
**Webhook payload fields:** `feedItem.actor.address`, `feedItem.metadata.tokenAddress`
**App-specific data:** Timestamp of last notification sent for this trader/token pair
**Recommended automatic filter:** Max one notification per trader per token per 12-24 hours.
## User-Configurable Filters
These filters should be surfaced to users in notification settings.
### Filter by buy and/or sell trades
**Event types:** `new-feed-item`
**User story:** Users may be more interested in what traders are buying than selling.
**Webhook payload field:** `feedItem.metadata.trades[0].direction`
**Options:** Buy (toggle: on/off), Sell (toggle: on/off)
**Recommended default:** Buy on, sell off.
### Filter by buy and/or sell comments
**Event types:** `comment-created`
**User story:** Comments represent high-signal moments regardless of trade direction. A trader explaining why they're exiting a position is just as valuable as their entry thesis.
**Webhook payload field:** `feedItem.metadata.trades[0].direction`
**Options:** Buy comments (toggle: on/off), Sell comments (toggle: on/off)
**Recommended default:** Both on.
### Filter by dollar minimum
**Event types:** `new-feed-item`, `comment-created`
**User story:** Small trades are often noise - test transactions, minor rebalances, or low-conviction plays. Users want to see meaningful positions. Different users also have different portfolio sizes, so a \$100 trade is significant to some and irrelevant to others.
**Webhook payload field:** `feedItem.metadata.trades[0].usdCost`
**App-specific data:** User's configured dollar minimum setting
**Options:** \$10, \$100, \$250, \$500, \$1,000+
**Recommended default:** \$500.
### Filter by chain
**Event types:** `new-feed-item`, `comment-created`
**User story:** Users often focus on specific ecosystems and don't want notifications for chains they don't trade on.
**Webhook payload field:** `feedItem.metadata.tokenChain`
**Options:** Base (toggle: on/off), Ethereum (toggle: on/off), Solana (toggle: on/off)
**Recommended default:** All on.
## Recommended Data Flow
```
Webhook Event Received from Clicker API
↓
Event Age Check
↓
Chain Filter (user preference)
↓
Trade Size Filter (user preference)
↓
Buy/Sell Filter (user preference)
↓
Cooldown/Rate Limit Check
↓
Notification Delivered to User
```
## Summary
| Layer | Responsibility |
| :-------------- | :------------------------------------------------------------------------------------- |
| **Clicker API** | Delivers real-time trade and comment data with all relevant metadata |
| **Your App** | Filters events, applies user preferences, enforces rate limits, delivers notifications |
# Webhook Payloads
Source: https://docs.clicker.xyz/api-reference/webhook-payloads
Payload shapes for each webhook event type
When your webhook endpoint receives a POST request, the body will contain an `events` array with one or more event objects:
```json theme={null}
{
"events": [WebhookEvent, ...]
}
```
## Common Fields
Each event object in the `events` array includes these fields:
| Field | Type | Description |
| ----------------- | --------- | -------------------------------------- |
| `eventId` | string | Unique identifier for this event |
| `eventType` | string | The type of event (see sections below) |
| `walletAddresses` | string\[] | The audience for this event |
***
## new-feed-item
Triggered when an actor trades a token.
```json theme={null}
{
"eventId": "string",
"eventType": "new-feed-item",
"reason": "first-buy",
"walletAddresses": ["0x..."],
"feedItem": HydratedPosition
}
```
### Fields
| Field | Type | Description |
| ----------------- | ----------------------------------------------------- | ------------------------------------------------------------- |
| `reason` | `"first-buy"` \| `"repeat-buy"` \| `"aped-in"` | Why this buy was considered noteworthy |
| `walletAddresses` | string\[] | Addresses that follow the trader |
| `feedItem` | [HydratedPosition](/response-types/hydrated-position) | The position card for this trade |
| `externalIds` | string\[] | External IDs for the audience (optional, only present if set) |
### Reasons
`new-feed-item` webhooks are generated for noteworthy buys. Sells do not generate `new-feed-item` follower webhooks.
| Reason | Meaning |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `first-buy` | The trader's first buy of this token within Clicker's notification counter window. The counter is keyed by trader address and token address. |
| `repeat-buy` | This buy caused the trader's cumulative buy amount for this token to cross the notification threshold. The current threshold is \$1,000. |
| `aped-in` | This buy was significantly larger than the trader's average buy for this token. The current rule is current buy > 1.4x average buy size. |
The notification counter window is two weeks and is extended on each evaluated buy. If a trader buys, sells, then buys the same token again within that window, the second buy is not a `first-buy`, but it can still generate a webhook if it qualifies as `repeat-buy` or `aped-in`.
***
## comment-created
Triggered when an actor comments on their trade.
```json theme={null}
{
"eventId": "string",
"eventType": "comment-created",
"walletAddresses": ["0x..."],
"feedItem": HydratedPosition,
"comment": SwapCommentResponse
}
```
### Fields
| Field | Type | Description |
| ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------- |
| `walletAddresses` | string\[] | Addresses that follow the commenter |
| `feedItem` | [HydratedPosition](/response-types/hydrated-position) | The position card for this trade |
| `comment` | [SwapCommentResponse](/response-types/swap-comment-response) | The actor's comment |
| `externalIds` | string\[] | External IDs for the audience (optional, only present if set) |
***
## copyswap
Triggered when an actor copies the subscriber's trade.
```json theme={null}
{
"eventId": "string",
"eventType": "copyswap",
"walletAddresses": ["0x..."],
"feedItem": HydratedPosition,
"comment": SwapCommentResponse,
"copyswapActor": FeedActor,
"copyswapTrade": Trade
}
```
### Fields
| Field | Type | Description |
| ----------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `walletAddresses` | string\[] | The comment author's address (whose trade was copied) |
| `feedItem` | [HydratedPosition](/response-types/hydrated-position) | The original position that was copied |
| `comment` | [SwapCommentResponse](/response-types/swap-comment-response) | The comment associated with the copytrade |
| `copyswapActor` | [FeedActor](/response-types/feed-actor) | The profile of the user who copied the trade |
| `copyswapTrade` | [Trade](/response-types/feed-response#schema-items-items-metadata-trades) | The trade details of the copy (same shape as a trade in the feed) |
# Register Webhook
Source: https://docs.clicker.xyz/api-reference/webhook-register
POST /v1/webhooks/feed
Register a new endpoint to receive webhook events containing feed items. This endpoint will respond with:
- a UID which identifies the webhook so that you can modify or delete it later
- a secret which you must use to verify requests that your endpoint receives. For more about how webhook signature verification works, see https://docs.daylight.xyz/reference/verifying-webhooks
Make sure to save both of these values, the secret will only be returned after creating a webhook.
If you need to register more than 1000 addresses as subscribers to your webhook, please create the webhook using this endpoint, and then use the PUT /v1/webhooks/feed/:uid endpoint to provide the addresses in chunks of 1000.
# Update Webhook
Source: https://docs.clicker.xyz/api-reference/webhook-update
PUT /v1/webhooks/feed/{uid}
Provide the UID you received when you created your webhook in order to modify it using this endpoint. Updatees include:
-Add or remove wallets who are subscribed to the webhook
-Replace the list of subscribers for the webhook entirely
-Modify the destination URL which this webhook uses to send you feed items
# Validate Destination
Source: https://docs.clicker.xyz/api-reference/webhook-validate
POST /v1/webhooks/feed/{uid}/validate
Validate and test the functionality of your receiving endpoing by calling this endoint. Upon receiving this POST, we will make two requests to the destination URL:
- one without a signature
- one with a valid "Daylight-Signature" header.
Each request will contain an example feed item, allowing you to test parsing and validation. To receive a successful response from this request, your receiving endpoint must return a non-2xx response to the invalid request and a 2xx response to the valid one.
When a webhook alert pings your server, we provide a signature to verify that the alert is coming from us. This signature should match a hash of the incoming request's body.
To perform this verification, you need:
* The secret generated when first creating the webhook
* The signature in the header daylight-signature
* The string of the body included in the request
## Example verification function
```ts theme={null}
import crypto from "crypto";
export function verifyDaylightWebhookSignature({
headerSignature,
body,
secret,
}: {
headerSignature: string | null | undefined;
body: string;
secret: string;
}) {
//Step 1: Extract the timestamp and signatures from the header
// (the signature var in this case)
const sigSplit = (headerSignature || "").split(",") || [];
let timestamp: string | undefined = undefined;
let signature: string | undefined = undefined;
for (const element of sigSplit) {
const [key, value] = element.split("=");
if (key === "t") {
timestamp = value;
} else if (key === "v1") {
signature = value;
}
}
if (!signature || !timestamp) {
throw new Error(`Missing timestamp or signature in ${signature}`);
}
// Step 2: Prepare the signed_payload string
const toSign = `${timestamp}.${body}`;
//Step 3: Determine the expected signature
const hash = crypto
.createHmac("sha256", secret)
.update(toSign)
// use base64url instead of base64 to escape equal signs
// a header ending with an = is invalid!
.digest("base64url");
if (hash !== signature) {
throw new Error(`Incorrect signature value in ${signature}`);
}
return true;
}
```
# Comment Moderation
Source: https://docs.clicker.xyz/guides/comment-moderation
Clicker handles comment moderation so you don't have to. When you integrate Clicker's trade comment network, our moderation infrastructure works behind the scenes to keep spam, scams, and low-quality content out of your app. This document explains how.
# Spam Is Structurally Expensive on Clicker
Unlike traditional social media systems, Clicker's architecture makes spam economically impractical by design.
**Minimum trade requirement.** Every comment on Clicker is attached to a real trade of `$10` or more. There is no way to post a comment without putting real capital at risk. This means every spam attempt costs the attacker real money, making large-scale spam campaigns prohibitively expensive.
**Reputation is tied to PnL.** The traders who gain large followings on Clicker are the ones with strong profit-and-loss track records. You can't fake your way to influence - it requires sustained, verifiable trading performance. Spam and scam accounts simply don't reach a meaningful audience because the network's discovery and ranking mechanisms are rooted in real trading results, not follower counts or engagement tricks.
**The economics don't work for attackers.** A trader skilled enough to build a high-PnL account and gain a following has far more to gain from legitimate trading than from running scams. The incentive structure naturally selects for quality.
# Surface Area Depends on What You Display
The degree of spam exposure in your app depends on which Clicker surfaces you choose to integrate. Each has a different risk profile:
* **Leaderboards and comments from ranked traders.** These are the lowest-risk surfaces. Content here is tightly bound to verified trading activity and high-performing accounts. Clicker's leaderboards rank traders by 30-day PnL, and it is extremely difficult for a spammer to build an account with even `$10,000` in 30-day PnL. As a result, spammers and scammers have virtually no path to gaining reach or visibility inside the Clicker network through these surfaces. The accounts that earn followers and show up in notifications are real traders with proven track records.
* **Comments on a token screen.** When displaying a timeline of all comments on a given token, there is a wider surface area. These feeds could be manipulated by bad actors willing to spend money on low-value trades in order to post spam comments.
Our moderation team actively monitors for these patterns, and comments flagged as low-quality or manipulative are suppressed from timelines.
# Active Moderation Team
Beyond structural defenses, Clicker maintains a dedicated moderation team of four reviewers who continuously monitor all comments entering the system. Their responsibilities include:
* Reviewing incoming comments in real time for spam and scam content
* Blocking and removing violating comments and repeat offenders
* Reviewing user reports submitted through our reporting endpoints
To date, spam and scam volume on Clicker has been very low - a direct result of the economic barriers described above. However, we expect these attempts to increase as the network grows, and we have proactively built the team and tooling to stay ahead of it.
# Reporting Endpoints
Clicker provides reporting API endpoints that your users can use to flag comments or traders as spam or scam. All reports are actively reviewed by our moderation team.
# Link Safety Controls
Comments on Clicker can contain links, but your front-end has full control over how (or whether) those links are displayed. Here are some options for handling links:
* **Filter link types.** You can choose to only render links to trusted domains (e.g., Twitter/X links) while hiding all others. The comment text itself still displays normally - only the link is suppressed.
* **Hide all links.** If you prefer a zero-risk approach, you can strip all links from rendered comments while still showing the full comment text.
* **Show links with a warning.** Display an interstitial warning when a user taps a link, informing them they are leaving your app and that you are not responsible for the safety or security of external content. This lets users access links while making the risk explicit.
These options can be combined or adjusted at any time based on your moderation preferences.
# Summary
Clicker's moderation approach works on three levels:
1. **Structural.** The `$10`+ trade requirement and PnL-based reputation system make spam economically irrational.
2. **Human.** A dedicated team of four moderators reviews all comments and user reports in real time.
3. **Configurable.** Link safety controls give your front-end full authority over which links are displayed, hidden, or gated behind warnings.
When you integrate Clicker, you get all of this out of the box. Your team doesn't need to build or manage any comment moderation infrastructure.
# Core Concepts
Source: https://docs.clicker.xyz/guides/core-concepts
How Clicker works
Clicker is modular. You don't need to adopt everything at once. You might start with just leaderboards, or just trade comments appended to your existing notification system. The experience gets better the more of the stack you use, but each piece can deliver standalone value.
# Trade Comments vs Trades
## What is a Trade?
A trade is any onchain transaction where someone buys or sells a token. Clicker indexes trades from tracked wallets and can help you surface them to your users via feeds, profiles, token screens, and notifications. You can also use your own internal trade indexing and just layer Clicker's social data on top.
## What is a Trade Comment?
A trade comment is when a trader attaches commentary explaining their trade. Not every trade has a comment. Each trade can have at most one comment. A trade comment provides context about why the trader is buying or selling - their thesis, conviction level, technical read, or any other reasoning they want to share.
## Why This Distinction Matters
This distinction determines whether Comment Rewards apply:
* When a user copies a trade comment, your trade fee is split between you, Clicker, and the comment author.
* When a user copies a standard trade or trade notification that has no comment, you keep 100% of your trade fees.
## Concrete Scenarios
**Scenario A: Trade without comment.**
A user sees in their feed that a trader they follow just bought a token. There's no comment attached. If the user buys the same token, it's inspired by trade but does not qualify for Comment Rewards. You keep 100% of your fees.
**Scenario B: Trade with comment leading to copytrade.**
A user receives a notification: "Trader you follow just bought `$WIF` and wrote: 'Buying because the team announced a partnership yesterday. Chart is forming a cup and handle pattern. Conviction: high.'" The user clicks the notification, reviews the comment, then buys `$WIF`. This IS a comment copytrade. Comment Rewards apply.
**Scenario C: Position visible on a profile, no comment.**
A user browses a leaderboard, clicks on a top trader's profile, and sees that the trader has a new `$WIF` position but there's no comment attached. If the user buys `$WIF`, it's NOT a comment copytrade because no comment was involved. You keep 100% of fees.
**Scenario D: Comment on a position, viewed and acted on.**
A user browses a leaderboard, clicks on a top trader's profile, and sees their open positions. One position has an attached comment explaining their thesis. The user reads the comment, is convinced, and buys `$WIF`. This IS a comment copytrade because the user engaged with the comment before trading. Comment Rewards apply.
# Profiles & the Clicker Network
A Clicker profile represents a trader and aggregates their identity and trading activity.
## Profile Structure
A profile consists of:
* **Linked Socials and Namespaces**: ENS names, Solana names (.sol), Twitter/X accounts, Farcaster accounts, or other verified identity namespaces
* **Aggregated Addresses**: All trading addresses controlled by the same trader across different blockchains and apps
* **Performance Metrics**: PnL calculations, win rates, trade frequency
* **Positions**: Open and closed positions across all linked addresses
* **Trade Comments**: If a position has a comment, the comment is visible on that position - whether open or closed
## How We Create Trader Profiles
Traders enter the Clicker network through two paths:
**1. Direct Clicker onboarding.** A trader signs up for Clicker and verifies their trading addresses across the apps they use. From there, whenever they trade on any platform, Clicker detects the trade and can prompt the trader to add a comment. This is how Clicker captures trade comments from traders across any platform - not just inside your app or a partner app. The trader comments in Clicker, and that comment flows out to every app in the network.
**2. Partner app profile integration.** Your app can push user profile data to Clicker. When you push a username and profile picture for a user who opts in, they appear across the entire Clicker network with a namespaced identifier: `username.yourapp.xyz`. They become discoverable on leaderboards and in search, and their positions and comments are visible network-wide.
## Named vs Unnamed
A core principle of social trading is that people want to follow people, not addresses. Throughout the Clicker API, we default towards named trader profiles. Addresses can be named even with anonymous names - an ENS name or a .sol domain still makes a raw address more approachable.
Leaderboards only surface named profiles. Open and closed positions on token screens only show named profiles - another strong surface area for discovery.
# The Social Graph
Following a trader adds that trader's trades to a user's feed and webhook notifications.
## How Following Works
Users follow traders through the API by calling the follow endpoint with the follower's address or profile ID and the target trader's address or profile ID. This creates a directed relationship: User A now follows Trader B.
## Why the Social Graph Matters
Dropping your users' follow graph into Clicker is what powers two key features:
1. **Feed building.** Clicker uses follow relationships to curate each user's feed with relevant trades and comments from traders they care about.
2. **Webhooks.** When a trader that one of your users follows makes a trade or comments on a trade, Clicker fires a webhook to your app so you can notify the user.
## Siloed Social Graphs
Each app maintains its own isolated social graph. If a user follows a trader through your app, that follow relationship only exists in your context. If the same user also uses another Clicker-powered app, they would need to follow the same trader again there.
This is the best of both worlds for you and your users. Your users' follow graph isn't portable to other apps, which gives you higher retention and stickiness. But your users can gain followers from other apps in the network, giving them more reach and more Comment Rewards. You get stickiness, your users get distribution.
## Discovering Traders
Clicker provides multiple pathways for users to discover traders:
**Leaderboards.** Traders are ranked by PnL. Leaderboards can be filtered by chain (Ethereum, Base, Solana, etc.). You can show "All Traders" or filter to "Commenters" only, surfacing traders who actively share their reasoning.
**Feed and Recommendations.** Clicker can generate "For You" feed recommendations based on a user's follow graph and what's trending and interesting onchain.
**Token Positions.** For any token, we return open positions sorted by holding amount (largest holders first) and closed positions sorted by all-time realized PnL (highest profit first) from named traders. When a user is browsing a specific token, they can see which traders have conviction in it. For example, a user researching `$WIF` sees that one trader has a `$500K` open position with 400% unrealized PnL, another has a `$120K` closed position with 250% realized PnL. The user can follow these traders, read their comments, and monitor their activity.
# Copytrade Attribution
Copytrade attribution is Clicker's mechanism for linking a user's copytrade to a specific comment, enabling Comment Rewards for the comment author.
## The Copytrade Flow
The complete flow for a valid copytrade:
1. **User engages with a comment.** The user interacts with a trade comment in some context - clicking a comment notification, viewing a comment in their feed, reading a comment on a trader's profile.
2. **User initiates a trade.** The user decides to trade the same token and navigates to your trading UI.
3. **Your app modifies the fee recipient.** Your app calls the DEX aggregator (0x, OKX, 1inch, etc.) but changes the fee recipient parameter from your own address to Clicker's fee collection address.
4. **Your app fires a copy-intent.** Before the user submits the transaction, your app makes a POST request to [`/v1/swap-comment/{id}/copyswap`](/api-reference/copy-intent) with the user's address and the token being purchased.
5. **User executes the transaction.** The transaction hits the chain with the fee recipient set to Clicker's address.
6. **Clicker validates it.** Clicker monitors for the transaction and validates it against the copy-intent.
7. **Copytrade is recorded.** If valid, the trade is recorded as a copytrade and attributed to the comment. Payouts to you, the comment author, and Clicker are scheduled for that day.
## When Copytrades Apply
* User receives a comment notification, clicks through, and buys = copytrade
* User sees a comment in their feed or activity tracker, navigates to the token, and buys = copytrade
* User visits a trader's profile, reads a comment on a position, clicks through and buys = copytrade
## When Copytrades Do NOT Apply
* User sees trade activity (no comment) in a feed or on a leaderboard and buys = NOT a copytrade
* User gets a trade notification (not a comment) and buys = NOT a copytrade
* User sees a comment but buys the token days later by searching without any further engagement with the comment = NOT a copytrade
* User copies a trade without engaging with any comment = NOT a copytrade
## Attribution Window
There must be a reasonable timeframe between the user engaging with the comment and executing the trade. The typical window is within one hour of engagement. You and Clicker define this together during integration based on your app's UX patterns.
## Implementation Requirements
To implement copytrades, you need to:
1. **Monitor comment attribution** Know when the user engaged with the comment so the fee recipient change happens afterwards.
2. **Have DEX aggregator parameter control.** Ensure you can pass a custom fee recipient address to your DEX aggregator API.
3. **Coordinate with Clicker.** Tell Clicker the address we should send your share of fees back to.
# Comment Rewards & Settlement
Comment Rewards are the revenue mechanism that aligns Clicker with your app and rewards comment authors for their valuable content. Everyone wins: you get net new revenue from content that keeps users engaged in your app, comment authors earn from sharing useful analysis, and Clicker earns from facilitating it.
## When Comment Rewards Apply
Comment Rewards apply ONLY to comment copytrades - trades directly driven by a comment interaction.
All other activity has zero revenue split:
* Leaderboard browsing and discovery: you keep 100% of fees
* Trade notifications: you keep 100% of fees
* Profile viewing: you keep 100% of fees
* Regular positions with no comment engagement: you keep 100% of fees
You're not paying Clicker for access to data or leaderboards. You only share revenue when Clicker's comment content directly drives a user to trade - net new revenue you wouldn't have captured otherwise.
## How It Works Mechanically
You already integrate with DEX aggregators as part of your normal trading flow. These aggregators accept a fee recipient parameter. The integration requires no new infrastructure, no new smart contracts, and no routing changes.
**For non-comment trades:** You call the DEX aggregator with the fee recipient set to your own address. You receive 100% of fees.
**For comment copytrades:** You change the fee recipient parameter to Clicker's fee collection address instead. Clicker then splits the fees.
Different DEX aggregators use different parameter names:
* **0x Protocol:** `swapFeeRecipient`
* **OKX DEX API:** `fromTokenReferrerWalletAddress` or `toTokenReferrerWalletAddress`
* **1inch:** `referrer` and `referrerFee`
The key point: these are standard parameters. You're only changing who receives the fees on comment-driven trades.
## Revenue Split
The revenue split on copytrades:
* A share to you (the trading app where the comment copytrade happened)
* A share to Clicker
* **15%** to the comment author (the trader who wrote the comment)
## Settlement
Clicker settles Comment Rewards daily in USDC. Your share is sent to the wallet address registered with your partner account with us.
## How Everyone Wins
* **You get content that keeps users in your app.** Instead of discovering alpha elsewhere and potentially trading elsewhere, your users find compelling trade comments in your app and decide to act right there. Comment-driven trades are net new revenue.
* **Comment authors earn from sharing useful analysis.** A share of copytrade fees on their comments creates a real incentive to write thoughtful, high-quality commentary. Authors earn when they drive revenue for you.
* **Clicker earns from facilitating the network.** We invest in growing the commenter base, improving comment quality, and expanding the network because that's how we earn.
# Summary
These five core concepts form the foundation of how Clicker works:
1. **Trade Comments vs Trades.** Only comment copytrades (comment-driven trades) trigger Comment Rewards. Regular trade activity and notifications are free for you to use however you want.
2. **Profiles & Network.** Clicker is a named social network where traders build reputations, link identities, and become discoverable across apps. You can push your users' profiles into the network.
3. **Social Graph.** Users follow traders and discover new ones through leaderboards, feeds, and token position endpoints. Your social graph is siloed to your app, giving you retention advantages.
4. **Comment Copytrade Attribution.** When a user engages with a comment and trades, Clicker attributes the trade to that comment by changing the fee recipient at the DEX aggregator level.
5. **Comment Rewards & Settlement.** Only comment copytrades trigger revenue sharing. You change one parameter in your DEX aggregator call. Clicker settles your share daily in USDC. We only earn when we drive net new revenue for you.
# External IDs
Source: https://docs.clicker.xyz/guides/external-ids
Use your own user IDs to manage follows and webhooks without requiring wallet addresses
# External IDs
External IDs let you attach your app's internal user identifiers to Clicker profiles. This means you can set up follows and webhook subscriptions for your users before you know their wallet addresses.
# Why external IDs exist
Many apps identify users by an internal ID, not a wallet address. Your user might have an account in your system long before they connect a wallet. External IDs bridge this gap — you can start building a social graph for your users immediately, using identifiers you already have.
When a user later connects a wallet, you add their address to the profile and everything flows naturally: their follows are already in place, their webhook subscriptions start delivering on-chain activity, and their profile is ready to appear on leaderboards.
# How it works
Use the `ext:` prefix with any identifier in place of a wallet address or profile UUID. The `ext:` prefix tells Clicker to look up (or create) a profile using your app's internal ID, scoped to your API key.
```
ext:your-internal-user-id
```
For example, if your user's ID is `user_abc123`, you'd reference them as `ext:user_abc123` in API calls.
External IDs are scoped to your API key. Two different partners can use the same external ID string without conflict — each resolves to a separate profile.
# URL encoding
When using `ext:` identifiers in URL paths, the colon must be URL-encoded as `%3A`:
```
PUT /v1/addresses/ext%3Auser_abc123/follow
```
In request bodies (JSON), use the `ext:` prefix as-is:
```json theme={null}
{
"walletAddresses": ["ext:user_abc123", "ext:user_xyz789"]
}
```
# Setting up follows
Create follow relationships using your internal user IDs. Clicker creates stub profiles automatically on first use.
```bash theme={null}
# user_abc123 follows a trader by their wallet address
curl -X PUT https://api.clicker.xyz/v1/addresses/ext%3Auser_abc123/follow \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"targets": ["0x1234..."]}'
```
You can also use `ext:` identifiers in bulk follow operations and as follow targets.
# Webhook subscriptions
Subscribe your users to webhook notifications using external IDs. When an `ext:` user is subscribed to a webhook and later gains wallet addresses, those addresses are automatically added as subscribers too.
```bash theme={null}
# Register a feed webhook with ext: subscribers
curl -X POST https://api.clicker.xyz/v1/webhooks/feed \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"destinationUrl": "https://yourapp.com/webhooks/clicker",
"walletAddresses": ["ext:user_abc123", "ext:user_xyz789"]
}'
```
You can mix `ext:` identifiers with regular wallet addresses in the same request.
# Profile responses
When a profile has an external ID for your app, it appears in API responses as `externalId`:
```json theme={null}
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "trader.yourapp.xyz",
"addresses": ["0x1234..."],
"externalId": "user_abc123",
"metadata": { ... }
}
```
The `externalId` field is only present when the profile has an external ID for your API key. Other partners see their own external IDs, or no field at all.
This field appears everywhere profiles are returned: profile lookups, follow responses, feed actors, leaderboard entries, and webhook payloads.
# Adding addresses later
When your user connects a wallet, add their address to the existing profile. This is the "de-anonymization" step — the stub profile becomes a full profile with on-chain activity.
After addresses are added:
* The profile starts appearing in feeds and leaderboards
* Webhook subscriptions automatically expand to cover the new addresses
* The user's existing follows remain intact
* The `externalId` field continues to appear in responses alongside the addresses
# Limitations
* External IDs are permanent — once assigned to a profile, they cannot be reassigned to a different profile.
* A profile can have one external ID per partner.
* Profiles with only external IDs (no addresses) cannot author feed items, appear on leaderboards, or have PnL. They can follow other profiles and receive webhook notifications.
* External IDs cannot be followed by other users — only profiles with addresses can be followed.
# FAQ
Source: https://docs.clicker.xyz/guides/faq
Frequently asked questions about Clicker
## Do users need the Clicker app?
No. Your users stay entirely within your app. Clicker is a backend API that you integrate. Your users follow traders, see trade comments, interact with leaderboards, and copy trades - all without ever leaving your platform. They don't download Clicker, they don't create a separate account, and they don't switch contexts. The Clicker experience is embedded seamlessly into your app via API.
## Does Clicker execute trades?
No. Your app handles all trade execution. Clicker never touches fund management or trade settlement. The only thing that changes when you integrate is which address receives the trade fee when a comment drives a copytrade. If a fee would normally go to your protocol or treasury, it now gets split: your cut plus a share to the commenter. The execution, settlement, and mechanics remain entirely your responsibility.
## What chains does Clicker support?
Clicker indexes traders on Solana, Base, Ethereum mainnet, and Hyperliquid (perps). BSC is available with 4 weeks notice - if you need it, let us know and we'll activate it. Prediction markets (Polymarket) are planned for Q2. If you need a different chain or protocol, let's discuss your roadmap and we can prioritize accordingly.
## Does Clicker provide price or chart data?
No. Clicker provides point-in-time trade data, PnL calculations, trader profiles, and social metadata. We do not provide real-time pricing, charting, or market data. You provide your own pricing infrastructure (most apps already have internal systems or integrate with providers like Codex or similar). This separation of concerns keeps Clicker lean and lets you maintain control over the pricing source your UX depends on.
## What if a user buys a token days after seeing a comment?
Attribution is based on a reasonable interaction window. Typically this is within an hour of viewing or engaging with a comment. If a user sees a comment, navigates away, and then manually initiates a buy days later without clicking through the comment or triggering the copytrade flow, that interaction doesn't count as comment-driven. This prevents attribution spam and ensures Comment Rewards only apply to trades directly influenced by the comment exposure.
## How does Clicker handle meme-to-meme swaps?
Clicker treats these as "swaps" - atomic exchanges of two tokens. Both sides are priced independently at the exact block timestamp. A swap updates two positions: the token being sold records a sale (with proceeds valued at the bought token's USD value at that moment), and the token being bought creates a new lot (with cost basis valued at the sold token's USD value at that moment). This gives accurate PnL accounting for traders who frequently rotate between emerging tokens.
## How does Clicker handle unnamed/anonymous addresses?
Clicker prioritizes named profiles over raw addresses. A named profile is one tied to a social identity: ENS, .sol domain, linked Twitter/X, linked Farcaster, or similar. User research shows that traders care about following *people*, not hex strings. Leaderboards by default surface named profiles only. Unnamed addresses are still indexed and tracked for internal purposes (so you can look up an address if needed), but they don't appear in public leaderboards and aren't promoted in discovery flows.
## Can our users create profiles without leaving our app?
Yes. You can push user data (username, profile picture) to Clicker via API. Once pushed, those users appear in the Clicker network as `username.yourappname.xyz`. They immediately start accumulating following and become discoverable in leaderboards and search. X (Twitter) verification is available - the trust model for partner-initiated verification is still being finalized, so reach out if verification at sign-up is critical to your product flow.
## Does Clicker have SOC 2 Type 2 certification?
Yes. Clicker meets SOC 2 Type 2 standards, which covers security, availability, and confidentiality controls.
## How do Comment Rewards work?
Comment Rewards only apply to copytrades directly driven by a trade comment interaction. When a user copies a trade based on a comment, the normal trade fee is collected by your app and split between your app, the comment author (who receives 15%), and Clicker. Settlement is daily in USDC to the comment author's address. Regular trades - even if they happen after a user follows a trader - don't generate Comment Rewards unless a comment directly triggered the copytrade.
## What's the commercial model?
Clicker uses a Comment Rewards system where fee revenue from copytrading is distributed across all parties: your app, the traders writing comments, and Clicker. When someone copies a trade based on a comment, the fee is split between your app, the comment author (15%), and Clicker. Settlement occurs daily. This aligns incentives: everyone benefits when your community engages with comments and copies trades.
# Integration Guide
Source: https://docs.clicker.xyz/guides/integration-guide
How to implement Clicker features in your app
# The Integration Spectrum
Clicker is modular. You can integrate as much or as little as you want. You could build entirely your own social trading features - your own leaderboard, your own trade notifications, your own wallet tracking - and just use Clicker for trade comments. That works. Our goal is to provide you the best trade comments for your users, and to let your users comment on their trades and earn from them across the Clicker network.
Our PnL, leaderboard, and social trading APIs exist so that you don't have to build all of that internally, since we've already done the work. But they're optional. Use what you need, skip what you don't.
# Leaderboard
The leaderboard ranks traders by PnL across different blockchains.
## What you're building
A leaderboard tab or section in your app where users can discover top traders, see their performance, and follow them. This is the lowest-friction starting point - no webhooks, no user authentication needed.
## How to implement
Fetch leaderboard data from Clicker's [leaderboard endpoint](/api-reference/leaderboard-v2) with chain filters (Solana, Base, Ethereum, etc.). Provide tab switching between "All Traders" and "Commenters" - the commenters tab surfaces traders who actively explain their trades, which is higher signal.
For each trader, pull their profile data to display: name, avatar, verified socials (Twitter/X, ENS, Farcaster), and PnL. Add a follow button next to each trader that calls the follow endpoint.
## Token page enrichment
On any token detail page, call the [token positions endpoint](/api-reference/token-positions). This returns open positions sorted by holding amount (largest holders first) and closed positions sorted by all-time realized PnL (highest profit first) from named traders.
The value here is discovery: your users find the best traders on tokens they already care about. When they follow those traders, they start getting relevant trade and trade comment notifications in your app, which drives engagement and keeps users coming back.
# Trade Notifications
Real-time alerts when traders your users follow make trades.
## What you're building
Webhook-driven notifications that let your users know when followed traders are active. If you already have your own trade tracking and notification system, you can skip Clicker's webhooks and just append trade comments (see next section) to your own notifications.
## How to implement
Register a webhook endpoint with Clicker. When a followed trader makes a trade, Clicker sends a POST request to your endpoint with the trade details.
## Position context
When users open a trade or trade comment notification, land them on a position screen for that trader and token. The position screen shows entry price, current price, unrealized PnL, position size, and whether the trader is still holding or has already exited. This gives the user context to decide - not just a raw buy screen or token screen. See [Position Calculations](/guides/position-calculations) for how to derive these values from the API.
# Trade Comments
Trade comments are the core of Clicker. A trade comment is when a trader explains why they made a trade - their thesis, conviction, analysis.
## What you're building
Surfacing trade comments from the Clicker network in your app, and letting your own users write comments on their trades.
## Where to surface comments
Comments can appear in several places in your app:
* **Notifications** - when a followed trader comments on a trade, include the comment in the notification
* **Feed items** - comments displayed in a social feed or activity feed
* **Positions on profiles** - when viewing a trader's profile, comments are visible on their open and closed positions
* **Positions on token screens** - when viewing a specific token, trader positions with comments show the comment
* **Full position screen** - when viewing a specific trader's position in detail, the comment is front and center
Comments are higher signal than raw trade notifications because they explain the reasoning. Distinguish comment notifications visually from trade-only notifications.
## Letting your users comment
Provide an in-app interface for users to add a comment after they execute a trade. Each trade can have at most one comment. Comments should be optional but encouraged. Once posted, the comment is visible across the entire Clicker network - on leaderboards, in other apps, wherever that trader's positions appear.
Your users earn Comment Rewards when other users copytrade based on their comments.
# Copytrade Attribution
Copytrade attribution links a user's trade to a specific comment, enabling Comment Rewards.
## What you're building
You're not building the revenue split - Clicker handles that. The only change you make is swapping the fee payout address whenever a trade is driven by a comment. Clicker takes care of splitting revenue between you, the comment author, and Clicker from there.
## How it works
1. A user engages with a trade comment - clicks a comment notification, views a comment in a feed, reads a comment on a trader's profile, etc.
2. The user decides to buy the same token.
3. Before the transaction, your app fires a [`POST /v1/swap-comment/{id}/copyswap`](/api-reference/copy-intent) with the user's address and the token.
4. Your app calls the DEX aggregator but changes the fee recipient parameter from your address to Clicker's fee collection address. The parameter name varies by aggregator:
* **0x:** `swapFeeRecipient`
* **OKX:** `fromTokenReferrerWalletAddress` / `toTokenReferrerWalletAddress`
* **1inch:** `referrer` and `referrerFee`
5. The user executes the transaction.
6. Clicker validates it against the copy-intent.
7. If valid, the trade is recorded as a copytrade. Payouts to you, the comment author, and Clicker are scheduled for that day.
## Revenue split
* A share to your app
* **15%** to the comment author
* A share to Clicker
Settlement is daily in USDC.
## What counts as a copytrade
* User gets a comment notification, clicks through, buys = copytrade
* User sees a comment in a feed, navigates to the token, buys = copytrade
* User reads a comment on a trader's profile, clicks through, buys = copytrade
## What does NOT count
* User sees trade activity (no comment) and buys = not a copytrade
* User gets a trade notification (not a comment notification) and buys = not a copytrade
* User sees a comment but buys the token days later without re-engaging with the comment = not a copytrade
# User Profiles
Profiles let your users build reputation across the Clicker network.
## What you're building
A bridge that pushes your users' identities into Clicker so they're discoverable and can earn Comment Rewards.
## How to implement
When a user opts in, push their username and profile picture to Clicker's profile endpoint. They appear across the Clicker network as `username.yourapp.xyz` - discoverable on leaderboards, in search, and in other apps.
Users who create profiles can comment on their trades and earn Comment Rewards. Their reputation compounds as they accumulate followers across apps.
If you identify users by an internal ID rather than wallet addresses, you can use [External IDs](/guides/external-ids) to set up follows and webhook subscriptions before a user connects a wallet.
X/Twitter verification is available - reach out to discuss.
# Perps Positions
Source: https://docs.clicker.xyz/guides/perps
How do use perps returned by the Clicker API
Perps positions use the same position API structure as spots, with a few additional fields. This guide covers what's different, and how to handle perps in your integration.
## Spot vs Perps: What Changes
A spot position tracks tokens bought and sold onchain. A perps position tracks a leveraged long or short on Hyperliquid.
The API returns both through the same position-fetching endpoints. Perps positions are distinguished by three fields on `metadata` (plus three new properties on `metadata.positionStats`, discussed later):
| Field | Type | Description |
| ---------------------------- | --------------------------- | ------------------------------------------ |
| `perpPositionType` | `"long" \| "short" \| null` | Position direction. Present only on perps. |
| `perpLeverage` | `number \| null` | Leverage multiplier (e.g. 2, 5, 10). |
| `positionAmountWithLeverage` | `number` | Token amount with leverage applied. |
If `perpPositionType` is null or absent, the position is spot.
## Perps Fields in Detail
### Position Direction and Leverage
```json theme={null}
{
"metadata": {
"perpPositionType": "long",
"perpLeverage": 5,
"positionAmount": 0.5,
"positionAmountWithLeverage": 2.5
}
}
```
`perpPositionType` tells you whether the trader is long or short. `perpLeverage` is the multiplier. `positionAmount` is the base amount (the margin denominated in the token), and `positionAmountWithLeverage` is the notional exposure (`positionAmount * perpLeverage`).
For shorts on Hyperliquid, `positionAmount` can be negative.
### Position Stats
Perps positions add several fields to `positionStats`:
| Field | Type | Description |
| ---------------------------------- | -------- | --------------------------------------- |
| `holdingsCostBasisUSD` | `number` | The margin (collateral) in USD |
| `holdingsCostBasisUSDWithLeverage` | `number` | The leveraged cost basis in USD |
| `boughtUSDWithLeverage` | `number` | Total USD entered with leverage applied |
| `soldUSDWithLeverage` | `number` | Total USD exited with leverage applied |
For spot positions, `holdingsCostBasisUSD` is the total cost of the tokens currently held. For perps, it represents the margin posted. The `WithLeverage` variants reflect the full notional values.
```json theme={null}
{
"metadata": {
"positionStats": {
"holdingsCostBasisUSD": 1000,
"holdingsCostBasisUSDWithLeverage": 5000,
"boughtUSD": 1000,
"boughtUSDWithLeverage": 5000,
"soldUSD": 0,
"soldUSDWithLeverage": 0,
"realizedGainsUSD": 0
}
}
}
```
In this example, the trader posted \$1,000 margin with 5x leverage, giving \$5,000 notional exposure.
### Metadata vs Trade-Level Props
`perpPositionType` and `perpLeverage` exist in two places: on `metadata` (position-level) and on each object in the `trades` array. They serve different purposes.
**Metadata-level** (`metadata.perpPositionType`, `metadata.perpLeverage`) reflects the current state of the position. Use these for:
* Position cards, profile pages, and token screens
* PnL calculations
* Detecting whether a position is perps or spot
* Displaying the current direction and leverage
For most integrations, the metadata-level fields are all you need.
**Trade-level** (`trade.perpPositionType`, `trade.perpLeverage`) reflects what happened at the time of that specific trade. Use these when rendering individual trade activity. The trade-level leverage matters because it tells you the leverage *that trade* used, which is what you want when describing the action:
```
"alice 5x longed $2,000 of ETH" ← trade.perpLeverage
"alice closed their 5x long ETH" ← trade.perpLeverage
"alice closed $500 of their 5x long ETH" ← trade.perpLeverage
```
## Computing Position Values
For the full formulas covering unrealized PnL, current value, and percent change for both spot and perp positions, see the [Position Calculations](/guides/position-calculations) guide.
## Perps Trade Actions
If you're building activity feeds or notifications, you can use the `trades` array to produce more descriptive copy than "entered" or "exited." The Clicker app has copy for four different types of actions:
| Action | How to derive | Example copy |
| --------------- | ------------------------------------------------------- | ----------------------------------- |
| `open` | `intent` is `"enter"` and it's the first trade | "opened a 5x long on ETH" |
| `add` | `intent` is `"enter"` and prior trades exist | "5x longed \$2,000 more of ETH" |
| `partial-close` | `intent` is `"exit"` and the position still has balance | "closed \$500 of their 5x long ETH" |
| `full-close` | `intent` is `"exit"` and the position is fully closed | "closed their 5x long ETH" |
# PnL Data Integrity
Source: https://docs.clicker.xyz/guides/pnl-integrity
Accurate PnL isn't just about calculation methodology - it's about what data you allow into the system in the first place. Clicker's approach is to **discard data we don't trust** and apply multiple layers of validation before any metric appears in a feed or leaderboard.
This page explains the safeguards that make our PnL data resistant to gaming and manipulation.
## Our Approach
Clicker's philosophy is to **exclude data we don't trust** rather than try to correct it after the fact. At a high level:
* Sends and receives aren't trades - moving tokens between wallets doesn't create phantom gains
* Unknown or extreme prices are rejected rather than estimated
* Anomalous traders and tokens are blocked from leaderboards
The sections below explain each layer in detail.
## Price Integrity Safeguards
Manipulated prices are a common attack vector. We validate pricing at multiple levels:
| Safeguard | Implementation |
| ----------------------------- | ---------------------------------------------------------------- |
| Liquidity thresholds | Reject prices with under 1K or over 1B USD liquidity |
| Price ratio outlier detection | Flag if ratio exceeds 10x or falls below 0.1x between swap sides |
| Quote token preference | When prices conflict, prefer stablecoin side |
| 5-minute quantization | Price windows prevent manipulation via timing |
## Leaderboard Eligibility
Appearing on a leaderboard requires meeting multiple criteria. High PnL alone isn't enough.
| Requirement | Value |
| ----------------------- | --------------------------------------- |
| Recent trading activity | 3+ swaps in last 7 days |
| Minimum trade value | 500+ USD each |
| Recent swap comment | Within 30 days (for commenters section) |
| Not blocked | Address not flagged by moderation |
These gates ensure leaderboards reflect active, legitimate traders rather than one-time lucky trades or inactive accounts with historical gains.
## Token & User Moderation
### Global Blocklists
When we identify a manipulated token or bad actor:
* **Token blocklist:** Admin-curated list of suspicious tokens. When a token is blocked, all affected user metrics are recalculated from scratch.
* **Leaderboard-specific blocks:** Profiles can be hidden from leaderboards while remaining visible in other contexts.
### Manual Curation
Our moderation team:
* Reviews PnL leaderboards daily
* Blocks tokens that inappropriately impact PnL across users
* Investigates and removes accounts that appear to be gaming
* Searches for new addresses of known traders across public sources
What moderators don't do:
* Manually adjust PnL values - all PnLs are calculated
* Remove traders without documented reason
* Discriminate against legitimate trading activity
## Summary
| Layer | What It Protects Against |
| ----------------- | --------------------------------------------------- |
| Data exclusion | Airdrops, sends, dust, non-trade transactions |
| Price validation | Manipulated prices, illiquid tokens, timing attacks |
| Eligibility gates | Inactive accounts, one-time outliers |
| Manual curation | Novel manipulation, edge cases, bad actors |
The result is defense-in-depth: no single safeguard is sufficient, but together they make gaming the system significantly harder than building a legitimate track record.
# PnL in Your App
Source: https://docs.clicker.xyz/guides/pnl-overview
Accurate PnL data is core to every feature in a social trading app and in the Clicker API: position tracking, profiles, and trader discovery.
## Positions
Users get full context on a trader's position in a specific token - whether they're fully in or out, their cost basis, and how profitable they are.
## Profiles
Users can view a trader's current open positions and historical best PnL positions, along with aggregate PnL metrics.
## Tokens
Users can discover top position holders on any token - not just wallet addresses, but real traders with identities - along with live PnL on those positions.
## Leaderboards
Ranked traders across various categories like Base, Solana, Ethereum, and Perps.
***
The entire social trading experience of your app can be powered by Clicker's PnL calculation engine out-of-the-box. Read more about our system:
* [How we calculate PnL](/guides/pnl-system)
* [How we keep PnL trustworthy](/guides/pnl-integrity)
# How We Compute PnL
Source: https://docs.clicker.xyz/guides/pnl-system
Clicker provides **Realized PNL** for onchain trading activity. This document explains what we provide, what you need to bring, and how our PNL calculations work.
## What Clicker Provides
| Data | Description |
| ----------------- | ------------------------------------------------------ |
| **Cost Basis** | What you paid for your tokens, tracked per acquisition |
| **Holdings** | Current token balances per position |
| **Realized PNL** | Actual profit/loss from closed positions |
| **Lot History** | Record of token acquisitions with cost basis |
| **Sales History** | Record of dispositions with realized gains |
## How PNL Works
### The Basic Flow
When you buy tokens and later sell them, Clicker tracks the cost basis and computes your realized gain or loss:
```
+--------------------------------------------------------------+
| POSITION LIFECYCLE |
+--------------------------------------------------------------+
| |
| BUY 100 tokens @ $1 ---> SELL ALL 100 tokens @ $5 |
| |
| Cost: $100 Proceeds: $500 |
| |
| | | |
| v v |
| +-----------+ +------------+ |
| | OPEN | price moves | CLOSED | |
| | POSITION | -----------> | POSITION | |
| +-----------+ $1 -> $5 +------------+ |
| |
| Realized PnL = Proceeds - Cost = $500 - $100 = $400 |
| |
| Position closes when no tokens remain. |
| Future acquisitions open a new position. |
| |
+--------------------------------------------------------------+
```
### How Receives Are Handled
On-chain, tokens can arrive without a purchase - airdrops, bridge transfers, staking rewards, payments. Clicker assigns a cost basis at market price when received:
```
+--------------------------------------------------------------+
| API RESPONSE: POSITION WITH BUYS + RECEIVES |
+--------------------------------------------------------------+
| |
| BUY 500 tokens @ $8 = $4,000 spent |
| RECV 500 tokens @ $10 = $5,000 market value at receive |
| |
| +-----------------------------------------------------+ |
| | "bought": 4000 <-- actual $ spent | |
| | "recv_basis": 5000 <-- cost from receives | |
| | "cost_basis": 9000 <-- used for PnL calc | |
| +-----------------------------------------------------+ |
| |
| Partners choose what to display: |
| * "bought" alone for "total invested" |
| * "cost_basis" for full accounting view |
| * Both separately and let user toggle |
| |
+--------------------------------------------------------------+
```
| Field | Definition |
| --------------- | ------------------------------------------------ |
| **bought** | Sum of actual dollars spent (buys only) |
| **recv\_basis** | Market value of tokens at time of receive |
| **cost\_basis** | `bought + recv_basis` - used for PNL calculation |
### FIFO Lot Matching
When you sell tokens, Clicker uses **FIFO (First In, First Out)** to determine which tokens are sold first. Each acquisition creates a "lot" with its own cost basis:
```
+--------------------------------------------------------------+
| LOT QUEUE (FIFO - First In, First Out) |
+--------------------------------------------------------------+
| |
| +---------+ +---------+ +---------+ |
| | LOT 1 | | LOT 2 | | LOT 3 | <-- newest |
| | 50 @ $2 | | 30 @ $5 | | 20 @ $8 | |
| | (BUY) | | (RECV) | | (BUY) | |
| +---------+ +---------+ +---------+ |
| ^ |
| | |
| oldest, sells first |
| |
+--------------------------------------------------------------+
SELL 60 tokens @ $10:
* 50 from LOT 1 (cost $2): PnL = 50 x ($10 - $2) = +$400
* 10 from LOT 2 (cost $5): PnL = 10 x ($10 - $5) = +$50
Total Realized PnL: +$450
Remaining: 20 from LOT 2, 20 from LOT 3
```
## Position-Based PnL (Not Token-Based)
Clicker uses **position-based PnL tracking**, which is the standard approach used by leading trading apps like Axiom and fomo. This differs from token-based systems that aggregate all activity on a token into a single view.
### How It Works
When you buy a token, Clicker opens a **position**. When you sell all of it, that position **closes**. If you re-enter that same token later, a **new position** opens with its own separate PnL:
```
+--------------------------------------------------------------+
| POSITION-BASED TRACKING |
+--------------------------------------------------------------+
| |
| Jan 1: Buy $XYZ ---> Position A opens |
| Feb 2: Sell all ---> Position A closes (+$3,100) |
| |
| Jun 15: Buy $XYZ again ---> Position B opens (fresh start) |
| Jul 20: Sell all ---> Position B closes (-$200) |
| |
+--------------------------------------------------------------+
| |
| Position A PnL: +$3,100 (closed Feb 2) |
| Position B PnL: -$200 (closed Jul 20) |
| |
| These are tracked SEPARATELY - Position B starts fresh. |
| |
+--------------------------------------------------------------+
```
### Why Position-Based Matters
With position-based tracking, each position stands on its own. This makes it easier to:
* **Reason about your trading history** - See exactly how each entry into a token performed
* **Evaluate current positions clearly** - Your new entry's PnL isn't clouded by gains or losses from previous trades in the same token
### Token-Based Systems Are Different
Some portfolio trackers use token-based PnL, which aggregates all activity on a token into one combined view. In the example above, a token-based system would show:
```
$XYZ total PnL: +$2,900 (combined from both entries)
```
This makes it harder to evaluate your current position because past profits inflate or past losses deflate your view of the new trade.
If you're comparing PnL data across different platforms, be aware that portfolio trackers may use token-based aggregation, which will show different numbers.
## Trade Types: Buys, Sells, and Swaps
Clicker categorizes every trade based on the tokens involved. This determines how we price each side of the trade.
### Quote Tokens
Quote tokens are the "base currencies" of crypto trading:
* **Native assets**: ETH, SOL, and other chain-native tokens
* **Stablecoins**: USDC, USDT, DAI, and other standard stablecoins
These are the tokens traders typically use to enter and exit positions.
### How We Categorize Trades
| Trade Type | Definition | Example |
| ---------- | --------------------------------------------------- | ----------- |
| **Buy** | Spending a quote token to acquire a non-quote token | ETH → PEPE |
| **Sell** | Selling a non-quote token back into a quote token | PEPE → USDC |
| **Swap** | Trading one non-quote token for another | PEPE → WIF |
### How We Price Trades
Every trade has two sides: the token you send (sold) and the token you receive (bought). Clicker prices both sides independently at the block timestamp, then uses the appropriate side to determine trade value:
```
+--------------------------------------------------------------+
| TRADE PRICING BY TYPE |
+--------------------------------------------------------------+
| |
| BUY (ETH -> PEPE) |
| +---------------------------------------------------------+ |
| | Sold: 0.5 ETH @ $3,000 = $1,500 | |
| | Bought: 1,000,000 PEPE | |
| | | |
| | Trade Value = $1,500 (from sold asset - the ETH) | |
| | Cost Basis = $0.0015 per PEPE | |
| +---------------------------------------------------------+ |
| |
| SELL (PEPE -> USDC) |
| +---------------------------------------------------------+ |
| | Sold: 1,000,000 PEPE | |
| | Bought: 2,000 USDC @ $1 = $2,000 | |
| | | |
| | Trade Value = $2,000 (from bought asset - the USDC) | |
| | Realized PnL = $2,000 - $1,500 cost basis = +$500 | |
| +---------------------------------------------------------+ |
| |
| SWAP (PEPE -> WIF) |
| +---------------------------------------------------------+ |
| | Sold: 500,000 PEPE @ $0.002 = $1,000 | |
| | Bought: 100 WIF @ $9.75 = $975 | |
| | | |
| | A swap updates TWO positions: | |
| | | |
| | PEPE position (sell side): | |
| | Sale value = $975 (from bought WIF) | |
| | Realized PnL calculated against PEPE cost basis | |
| | | |
| | WIF position (buy side): | |
| | Cost basis = $1,000 (from sold PEPE) | |
| | New lot added to WIF position | |
| | | |
| | Prices often differ on either side of a swap. | |
| +---------------------------------------------------------+ |
| |
+--------------------------------------------------------------+
```
### Why We Price This Way
* **Buys**: The quote token (ETH, USDC) has reliable pricing. We use it to determine what you paid for the new token.
* **Sells**: The quote token you receive has reliable pricing. We use it to determine your proceeds.
* **Swaps**: Neither token is a quote token, so we price both independently. The sold token's value becomes the cost basis for what you bought, and the bought token's value determines the sale proceeds for what you sold. These values may differ slightly due to liquidity differences.
This approach ensures consistent PnL tracking even when trading between volatile assets.
## What You Need to Bring: Unrealized PNL
**Clicker does not provide realtime token prices.** We focus on the hard accounting problem - tracking cost basis and computing realized gains - while you retain control over pricing.
You combine our data with your live prices to compute unrealized PnL, current position value, and percent change. See the [Position Calculations](/guides/position-calculations) guide for the full formulas covering both spot and perp positions.
## Why PNL Is Harder Than It Looks
Building accurate PNL for onchain trading involves solving several interconnected problems:
### Swap Detection
A blockchain transaction is just a list of token transfers. Determining whether those transfers represent a buy, sell, swap, airdrop, bridge, or something else requires parsing balance changes, identifying contract patterns (DEX routers, bridges), handling multi-hop swaps, and distinguishing intentional trades from fees, MEV, and dust.
### Cost Basis Tracking
Each acquisition creates a lot record: `(token, amount, unit_price, timestamp, type)`. Partial sales consume lots in FIFO order, splitting lots when necessary. Receives are priced at market rate via Codex at transaction time.
### Position Lifecycle
Position opens on first acquisition, closes when remaining value drops below the dust threshold of \$1. Re-acquiring after full sale opens a new position with fresh lots.
### Edge Cases
Failed transactions with partial state changes, LP token mints/burns, and cross-chain trades.
## What We Handle
Clicker solves these problems so you don't have to:
* **Swap derivation** from raw transaction data
* **Cost basis tracking** across acquisitions
* **FIFO accounting** for sales
* **Position lifecycle management**
* **Cross-chain awareness** for common bridges
* **Historical pricing** at transaction time (via Codex)
You get clean, computed PNL data. We handle the complexity.
## Summary
| Concern | Who Handles It |
| ------------------- | --------------------------------------------------------------------------------- |
| Cost basis tracking | Clicker |
| Realized PNL | Clicker |
| Position accounting | Clicker |
| Swap detection | Clicker |
| Realtime pricing | You |
| Unrealized PNL | You (using our data) — see [Position Calculations](/guides/position-calculations) |
# Position Calculations
Source: https://docs.clicker.xyz/guides/position-calculations
How to calculate current value, unrealized PnL, and percent change
This guide shows how to combine them to derive current value, unrealized PnL, and percent change for both spot and perp positions.
## Philosophy
Your app likely its own high-performance system for live prices. (If not, we can recommend pricing APIs for you.) For that reason, the Clicker API only returns historical data: cost basis, realized PnL, and position amounts. **You bring your own live price data to these calculations.**
These fields can be found in `metadata` and `metadata.positionStats` of a [HydratedPosition](/response-types/hydrated-position).
## Detecting Spot vs Perps
Check `metadata.perpPositionType`. If it's `"long"` or `"short"`, the position is a perp. If it's `null` or absent, it's spot.
For Hyperliquid positions, you can also check for the presence of `positionAmountWithLeverage`.
## Spot Positions
### Current Value
```
currentValue = positionAmount * currentPrice
```
| Field | Source |
| ---------------- | ------------------------- |
| `positionAmount` | `metadata.positionAmount` |
| `currentPrice` | Your pricing feed |
### Unrealized PnL
```
costBasis = holdingsCostBasisUSD + holdingReceivedCostBasisUSD
unrealizedPnL = currentValue - costBasis
```
| Field | Source |
| ----------------------------- | ---------------------------------------------------- |
| `holdingsCostBasisUSD` | `metadata.positionStats.holdingsCostBasisUSD` |
| `holdingReceivedCostBasisUSD` | `metadata.positionStats.holdingReceivedCostBasisUSD` |
`holdingsCostBasisUSD` is the cost basis of tokens the trader bought. `holdingReceivedCostBasisUSD` is the cost basis of tokens the trader received via airdrops or transfers, valued at market price at the time of receipt. Together they form the full cost basis of current holdings.
### Total PnL
To show total PnL (realized + unrealized):
```
totalPnL = realizedGainsUSD + unrealizedPnL
```
`realizedGainsUSD` captures profit or loss from tokens already sold.
### Percent Change
```
totalInvested = boughtUSD + receivedCostBasisUSD
percentChange = (totalPnL / totalInvested) * 100
```
| Field | Source |
| ---------------------- | --------------------------------------------- |
| `boughtUSD` | `metadata.positionStats.boughtUSD` |
| `receivedCostBasisUSD` | `metadata.positionStats.receivedCostBasisUSD` |
Only compute percent change when `totalInvested >= 1`. Below that threshold, the percentage is meaningless.
### Example
A trader bought 10,000 tokens at \$0.05 for \$500. The token is now \$0.08.
```
currentValue = 10000 * 0.08 = $800
costBasis = 500 + 0 = $500
unrealizedPnL = 800 - 500 = $300
totalPnL = 0 + 300 = $300 (no realized gains yet)
percentChange = (300 / 500) * 100 = 60%
```
## Perp Positions
Perps use leveraged values for PnL and margin (collateral) for position value.
### Unrealized PnL
Compute the current leveraged notional value:
```
leveragedNotionalValue = abs(positionAmountWithLeverage) * currentPrice
```
Then compute PnL based on direction:
```
// Long
unrealizedPnL = leveragedNotionalValue - holdingsCostBasisUSDWithLeverage
// Short
unrealizedPnL = holdingsCostBasisUSDWithLeverage - leveragedNotionalValue
```
| Field | Source |
| ---------------------------------- | --------------------------------------------------------- |
| `positionAmountWithLeverage` | `metadata.positionAmountWithLeverage` |
| `holdingsCostBasisUSDWithLeverage` | `metadata.positionStats.holdingsCostBasisUSDWithLeverage` |
### Current Value (Equity)
For perps, the position value is the trader's equity: margin plus unrealized PnL.
```
margin = holdingsCostBasisUSD
currentValue = abs(margin + unrealizedPnL)
```
`holdingsCostBasisUSD` on a perp position represents the margin (collateral) posted, not the full notional exposure.
### Total PnL
```
totalPnL = realizedGainsUSD + unrealizedPnL
```
### Percent Change
```
totalInvested = boughtUSD + receivedCostBasisUSD
percentChange = (totalPnL / totalInvested) * 100
```
Same formula as spot. `boughtUSD` on a perp is the total margin posted across all entries.
### Example
A trader opens a 5x long on ETH at \$3,000 with \$1,000 margin. ETH is now \$3,300.
```
positionAmountWithLeverage = 1.6667 (5000 / 3000)
holdingsCostBasisUSDWithLeverage = $5,000
holdingsCostBasisUSD (margin) = $1,000
leveragedNotionalValue = 1.6667 * 3300 = $5,500
unrealizedPnL = 5500 - 5000 = $500
currentValue = abs(1000 + 500) = $1,500
totalPnL = 0 + 500 = $500
percentChange = (500 / 1000) * 100 = 50%
```
The 10% move in ETH produced a 50% return because of 5x leverage.
## Closed Positions
A position is closed when the trader has exited entirely. For closed positions, there is no unrealized PnL to compute. Display `realizedGainsUSD` as the total PnL and compute percent change against `totalInvested` as above.
```
totalPnL = realizedGainsUSD
percentChange = (realizedGainsUSD / totalInvested) * 100
```
You can detect a closed position by checking `metadata.positionStats.isOpen === false`, or by checking that the position's remaining value is below \$1 (the dust threshold).
## TL;DR Calculation
```typescript theme={null}
function calculatePosition(
metadata: HydratedPosition["metadata"],
currentPrice: number,
) {
const { positionStats: stats } = metadata;
const isPerp =
metadata.perpPositionType === "long" ||
metadata.perpPositionType === "short";
// Unrealized PnL
const notionalValue =
Math.abs(
isPerp ? metadata.positionAmountWithLeverage : metadata.positionAmount,
) * currentPrice;
const costBasis = isPerp
? stats.holdingsCostBasisUSDWithLeverage
: stats.holdingsCostBasisUSD + stats.holdingReceivedCostBasisUSD;
const unrealizedPnL =
metadata.perpPositionType === "short"
? costBasis - notionalValue
: notionalValue - costBasis;
// Current value, total PnL, percent change
const currentValue = isPerp
? Math.abs(stats.holdingsCostBasisUSD + unrealizedPnL)
: notionalValue;
const totalPnL = stats.realizedGainsUSD + unrealizedPnL;
const totalInvested = stats.boughtUSD + stats.receivedCostBasisUSD;
const percentChange =
totalInvested >= 1 ? (totalPnL / totalInvested) * 100 : undefined;
return { currentValue, unrealizedPnL, totalPnL, percentChange };
}
```
# What is Clicker?
Source: https://docs.clicker.xyz/guides/what-is-clicker
The cross-app social network for traders
# The Social Network for Trading Apps
Clicker is an API and social network that lets any trading app quickly add social trading features without building the network from scratch. We don’t execute trades, we don’t provide pricing data, and we don’t require your users to leave your app. Instead, we provide a network of traders explaining their trades, and the APIs to surface that network inside your app.
Every trading app wants to show their users what good traders are doing. But the real value isn’t “someone bought this token.” It’s “someone bought this token because of this reason, and here’s their track record.” That reasoning - the explanation behind the trade - is what Clicker brings to your app.
# The Core Primitive: Trade Comments
A trade comment is an incentive-aligned, realtime trade thesis — not just social chatter. When a trader comments on their trade, they're explaining *why* they made it: "buying `$WIF` because the team just announced a partnership and the chart is forming a cup and handle." That reasoning is linked to the verified onchain transaction, tied to the commenter's track record, and will earn rewards payments to the author every time another trader finds it valuable.
This is what makes trade comments high-alpha content — other social networks lack a reason to share good, true, and insightful messaging around trade motivation. Three things are true about every comment in the Clicker network:
1. **Skin in the game.** The comment is attached to a real trade. The commenter actually put money behind their thesis.
2. **Verifiable track record.** Every commenter's history of commented trades — and their PnL on those trades — is public. You can evaluate the source, not just the signal.
3. **Financial incentive for quality.** When someone copies a trade based on a comment, the commenter earns a share of the copytrade fee. Better reasoning attracts more copytrades. Commenters are rewarded for being helpful, not just loud.
## What are Comment Rewards?
When a user copies a trade based on a comment, the trade fee is split between your app, the comment author (who receives 15%), and Clicker. Settlement is daily in USDC. Comment Rewards only apply to copytrades - trades directly driven by a comment interaction. All other trades have zero revenue split. Clicker only gets paid when an author gets paid — when a Clicker comment directly drives a user to trade. That's net new revenue you wouldn't have captured otherwise.
# What You Get Out of the Box
When you integrate Clicker, you get immediate access to an active commenter communityacross the Solana, Ethereum, and Base ecosystems: thousands of authors have written trade theses, and our average commenter has earned over \$50 each in copyswap rewards. These aren't theoretical users - they're live, active traders, posting their best takes and opinions and backing them up with a verifiable track record.
Clicker is modular. You can use as much or as little as you want. Our APIs are there to help you move fast if you need them, but they're all optional (besides trade comments):
* **Trade comments** are the core. Surface comments from across the network in your app, and let your users write comments on their own trades.
* **Leaderboards** rank traders by PnL across chains.
* **Position-based PnL data** so you can give your users context on a trader's position, including that trader's comments on that position.
* **Trader profiles** surface linked usernames (Twitter/X, Farcaster, ENS, .sol domains) so your users can follow real people and see a trader's open and closed positions with trade comments.
* **Token positions** so you can help your users discover top holders and top PnL traders on each token and their trade comments.
* **Webhook-based trade notifications** let your app send trade and trade comment notifications.
Use what you need, skip what you don't. You could build your own social trading features entirely and just use Clicker to inject trade comments into your own system. That works.
# What Your Users Get
Your users see alpha from traders who explain their thinking. Instead of just watching a leaderboard of top performers, they see *why* top performers made each trade. This context means they're not blindly mirroring positions - they're understanding the thesis, and they're doing it without leaving your app.
Your users can also earn Comment Rewards: a share of the copytrade fees driven across our network by their comments flows back to them.
# How the Network Helps You
As more apps join the Clicker network, your users get access to trade comments from traders across those apps. A trader commenting on a perp trade on one platform has that comment surface in your app too. Your users discover more traders, get more context, and have more reasons to stay in your app and trade.
The core mechanics are straightforward: traders explain trades, users follow traders and see explanations, Clicker distributes those explanations across apps, and users who copytrade based on comments trigger Comment Rewards. More apps in the network means more comments and reach for your users.
# FeedActor
Source: https://docs.clicker.xyz/response-types/feed-actor
Represents an actor (trader) in the social feed, with their profile information and relationship to the viewer.
# Feed
Source: https://docs.clicker.xyz/response-types/feed-response
The paginated response from feed endpoints, containing an array of feed positions and pagination metadata.
# HydratedPosition
Source: https://docs.clicker.xyz/response-types/hydrated-position
A position card representing all trades of a single token by a single actor. Contains full trade history, position stats, and engagement metrics.
See [Position Calculations](/guides/position-calculations) for how to use `metadata` and `positionStats` fields to compute current value, unrealized PnL, and percent change.
# Leaderboard
Source: https://docs.clicker.xyz/response-types/leaderboard-v2-response
The V2 leaderboard response containing a flat list of traders sorted by combined PnL.
## Structure
```typescript theme={null}
{
traders: TraderV2[] // Sorted by pnl.total descending
}
```
## Differences from V1
| V1 Response | V2 Response |
| ---------------------------------------------------- | ------------------------------------- |
| `{ sections: [{ key, title, commenters, others }] }` | `{ traders: [...] }` |
| Multiple categories in one response | Single filtered list |
| Traders split into `commenters` and `others` | Single list with `hasComments` flag |
| PnL in `reason.value` | PnL in `pnl.total` and `pnl.perChain` |
## Example
```json theme={null}
{
"traders": [
{
"profile": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "TopTrader",
"images": {
"raw": "https://example.com/avatar.png",
"xs": "https://example.com/avatar-75.png",
"sm": "https://example.com/avatar-300.png"
},
"addresses": ["0x1234..."],
"metadata": { "pnl30d": 250000, "winRate30d": 0.72 },
"metrics": {
"thisPartner": { "followerCount": 100, "followingCount": 50 },
"allPartners": { "followerCount": 320, "followingCount": 50 },
"comments": { "commentCount30d": 12, "commentCountAllTime": 48 },
"copytradedAllTime": {
"count": 85,
"distinctActors": 30,
"volumeUSD": 125000
}
}
},
"pnl": {
"total": 250000,
"perChain": {
"base": 150000,
"solana": 100000
}
},
"hasComments": true
}
]
}
```
# Profile
Source: https://docs.clicker.xyz/response-types/profile-extended
The extended profile schema includes all profile information plus trading metrics metadata.
This type is returned by profile endpoints and embedded in feed and leaderboard responses.
# ProfileWithMetrics
Source: https://docs.clicker.xyz/response-types/profile-with-metrics
A profile response that includes social metrics like follower counts and comment activity.
# SwapComment
Source: https://docs.clicker.xyz/response-types/swap-comment-response
A swap comment with the commenter's profile, the comment text, metrics (likes, replies), and trade context.
# Trader
Source: https://docs.clicker.xyz/response-types/trader-v2
A trader on the V2 leaderboard, including their profile, PnL breakdown by chain, and optionally their copytrade stats.
## Structure
```typescript theme={null}
{
profile: ProfileExtended, // Full profile with metrics
pnl: {
total: number, // Combined PnL across selected chains
perChain?: { // Per-chain breakdown (optional, partial record)
base?: number,
solana?: number,
ethereum?: number,
hyperliquid?: number
}
},
hasComments: boolean, // Whether this trader has posted swap comments
copytrades?: { // Only present on /v2/leaderboard/copytraded
count: number, // Total copytrades of their comments
distinctActors: number, // Unique users who copied
volumeUSD: number // Total volume from copytrades
}
}
```
## PnL Calculation
* `pnl.total` is calculated by summing `pnl.perChain` values for the chains requested in the query
* If no `chains` parameter is provided, all chains are included
* All values are 30-day realized PnL in USD
# WebhookConfig
Source: https://docs.clicker.xyz/response-types/webhook-response
A registered webhook configuration, including the URL, event filters, and status.
# Signing Comments
Source: https://docs.clicker.xyz/signing-comments
When a user creates a Swap Comment from a partner wallet, they also sign a message proving the comment is authentic.
The message to sign is:
```
Clicker Swap Comment:
Chain: ${chain}
Token Address: ${contractAddress}
Txn Hash: ${txnHash}
Comment: ${commentText}
```
To assist you with testing and debugging your swap comment signatures, we've provided the entire `signature-verification.ts` that we use in our own backend services and test suite.
```typescript signature-verification.ts theme={null}
import { getBase58Codec, getBase58Decoder, signBytes } from '@solana/kit';
import { timingSafeEqual, verify } from 'crypto';
import { createWalletClient, http, recoverMessageAddress } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { mainnet } from 'viem/chains';
import { z } from 'zod';
const solanaPrefixRegex = /^(solana:)/;
const EVMAddress = z
.string()
.regex(/^0x[a-zA-Z0-9]{40}$/, 'Must be an Ethereum address starting with 0x')
.transform(a => a.toLowerCase())
.openapi({ type: 'string' });
export const removeSolPrefixTransformer = (val: string) => val.replace(solanaPrefixRegex, '');
export const isValidEVMAddress = (value: string) => EVMAddress.safeParse(value).success;
export const SWAP_COMMENT_MESSAGE_PREFIX = 'Clicker Swap Comment:';
export const createSwapCommentMessage = (
chain: string,
tokenAddress: string,
txnHash: string,
commentText: string
): string => {
// If you find yourself updating this, update the mintilfy docs page too!
const contractAddress = isValidEVMAddress(tokenAddress) ? tokenAddress.toLowerCase() : tokenAddress;
return `${SWAP_COMMENT_MESSAGE_PREFIX}\n\nChain: ${chain}\nToken Address: ${contractAddress}\nTxn Hash: ${txnHash}\nComment: ${commentText}`;
};
// This is a test helper function - in production, signing should happen client-side
export const signMessage = async (message: string, privateKey: string | CryptoKeyPair): Promise<{ signature: string; signerAddress: string }> => {
if (typeof privateKey === 'object' && 'privateKey' in privateKey) {
// Solana signing using CryptoKeyPair from @solana/kit
const signedBytes = await signBytes(privateKey.privateKey, Buffer.from(message, 'utf-8'));
const signature = getBase58Decoder().decode(signedBytes);
const signerAddress = getBase58Decoder().decode(
Buffer.from(await crypto.subtle.exportKey('raw', privateKey.publicKey))
);
return { signature, signerAddress };
} else if (typeof privateKey === 'string' && privateKey.startsWith('0x')) {
// EVM signing using viem
const account = privateKeyToAccount(privateKey as `0x${string}`);
const client = createWalletClient({
account,
chain: mainnet,
transport: http(),
});
const signature = await client.signMessage({ message });
return { signature, signerAddress: account.address };
} else {
throw new Error('Invalid private key format. Expected EVM private key (0x...) or Solana CryptoKeyPair');
}
};
export const verifySwapCommentSignature = async (
chain: string,
tokenAddress: string,
txnHash: string,
commentText: string,
signature: string,
signerAddress: string
): Promise => {
try {
const contractAddress = isValidEVMAddress(tokenAddress) ? tokenAddress.toLowerCase() : tokenAddress;
const message = createSwapCommentMessage(chain, contractAddress, txnHash, commentText);
if (signerAddress.startsWith('solana:')) {
const publicKeyBytes = getBase58Codec().encode(removeSolPrefixTransformer(signerAddress));
const signatureBytes = getBase58Codec().encode(signature);
return verify(
null, // No digest algorithm for Ed25519
Buffer.from(message, 'utf-8'),
{
key: Buffer.concat([
Buffer.from('302a300506032b6570032100', 'hex'), // ASN.1 DER prefix for Ed25519
Buffer.from(publicKeyBytes),
]),
format: 'der',
type: 'spki',
},
Buffer.from(signatureBytes)
);
} else {
const formattedSignature = signature.startsWith('0x') ? signature : `0x${signature}`;
const recoveredAddress = await recoverMessageAddress({
message,
signature: formattedSignature as `0x${string}`,
});
// Convert addresses to Buffer for constant-time comparison
const recoveredBuffer = Buffer.from(recoveredAddress.toLowerCase().slice(2), 'hex');
const expectedBuffer = Buffer.from(signerAddress.toLowerCase().slice(2), 'hex');
return (
recoveredBuffer.length === expectedBuffer.length &&
timingSafeEqual(recoveredBuffer, expectedBuffer)
);
}
} catch (error) {
console.error('Signature verification failed:', error);
return false;
}
};
```