Skip to main content

baseFM identity API

Link your Base wallet address to connect your baseFM DJ identity. Once linked, you can retrieve your DJ profile, listener stats, show history, and tip totals from baseFM.

Get linked wallet

GET /api/user/basefm-wallet
Returns the Base wallet address currently linked to your account. Requires session authentication.

Response

{
  "wallet": "0xd8fd0e1dce89beaab924ac68098ddb17613db56f"
}
FieldTypeDescription
walletstring | nullThe linked Base wallet address, or null if no wallet is linked

Errors

CodeDescription
401Unauthorized — no valid session

Example

curl -X GET https://agentbot.sh/api/user/basefm-wallet \
  -H "Cookie: next-auth.session-token=YOUR_SESSION"

Update linked wallet

PATCH /api/user/basefm-wallet
Save or clear the Base wallet address linked to your baseFM DJ identity. Requires session authentication.

Request body

FieldTypeRequiredDescription
walletstring | nullYesA valid Base wallet address (0x-prefixed, 40 hex characters). Pass null or an empty string to unlink the wallet.

Response

{
  "ok": true,
  "wallet": "0xd8fd0e1dce89beaab924ac68098ddb17613db56f"
}
FieldTypeDescription
okbooleanWhether the update succeeded
walletstring | nullThe saved wallet address, or null if the wallet was unlinked

Errors

CodeDescription
400Invalid Base wallet address — the value must match 0x followed by 40 hexadecimal characters
401Unauthorized — no valid session

Example

curl -X PATCH https://agentbot.sh/api/user/basefm-wallet \
  -H "Content-Type: application/json" \
  -H "Cookie: next-auth.session-token=YOUR_SESSION" \
  -d '{"wallet": "0xd8fd0e1dce89beaab924ac68098ddb17613db56f"}'
To unlink:
curl -X PATCH https://agentbot.sh/api/user/basefm-wallet \
  -H "Content-Type: application/json" \
  -H "Cookie: next-auth.session-token=YOUR_SESSION" \
  -d '{"wallet": null}'

Get DJ stats

GET /api/basefm/dj-stats
Fetches your baseFM DJ profile and aggregated stats using the linked wallet address. Requires session authentication and a linked Base wallet.

Response (wallet linked, baseFM reachable)

{
  "linked": true,
  "wallet": "0xd8fd0e1dce89beaab924ac68098ddb17613db56f",
  "dj": {
    "name": "DJ Rave",
    "slug": "dj-rave",
    "avatar": "https://basefm.space/avatars/dj-rave.png",
    "followers": 142,
    "genres": ["Techno", "House"]
  },
  "stats": {
    "totalShows": 23,
    "totalListeners": 8401,
    "totalTipsUsdc": 54.25,
    "isLive": false
  }
}

Response fields

FieldTypeDescription
linkedbooleanWhether a Base wallet is linked to the account
walletstringThe linked Base wallet address
djobject | nullDJ profile from baseFM. null if no DJ profile exists for this wallet.
dj.namestring | nullDJ display name
dj.slugstring | nullURL slug for the DJ profile on baseFM
dj.avatarstring | nullAvatar image URL
dj.followersnumberFollower count
dj.genresstring[]List of genres associated with the DJ
statsobject | nullAggregated show statistics. null if baseFM is unreachable.
stats.totalShowsnumberTotal number of completed and active shows
stats.totalListenersnumberCumulative listener count across all shows
stats.totalTipsUsdcnumberTotal tips received in USDC (rounded to 2 decimal places)
stats.isLivebooleanWhether the DJ currently has an active live stream
errorstringPresent when baseFM could not be reached. The linked and wallet fields are still returned.

Response (no wallet linked)

{
  "linked": false
}
When no wallet is linked, the response contains only linked: false. Link a wallet using the update linked wallet endpoint first.

Response (baseFM unreachable)

{
  "linked": true,
  "wallet": "0xd8fd0e1dce89beaab924ac68098ddb17613db56f",
  "dj": null,
  "stats": null,
  "error": "baseFM unreachable"
}
When baseFM cannot be reached within the 6-second timeout, the dj and stats fields are null and an error message is included.

Errors

CodeDescription
401Unauthorized — no valid session

Example

curl -X GET https://agentbot.sh/api/basefm/dj-stats \
  -H "Cookie: next-auth.session-token=YOUR_SESSION"