Skip to content

Latest commit

 

History

History
196 lines (157 loc) · 5.5 KB

File metadata and controls

196 lines (157 loc) · 5.5 KB

Farcaster (via Neynar API)

Post, read, search, and engage on Farcaster — crypto-native social protocol. Agent-friendly API, no scraping.

Setup

  1. Get API key from https://neynar.com (free tier = 200K credits/month)
  2. Create a signer for your agent
  3. Store in /data/.openclaw/credentials.json:
{
  "neynar": {"apiKey": "YOUR_KEY"},
  "farcaster": {"signerUuid": "YOUR_SIGNER_UUID", "fid": 12345}
}

Creating a Signer

API_KEY=$(jq -r '.neynar.apiKey' /data/.openclaw/credentials.json)

curl -s -X POST https://api.neynar.com/v2/farcaster/signer \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" | jq .

# Returns signer_uuid + approval URL. Approve in Warpcast, then store signer_uuid.

Credential Helper

All commands assume:

API_KEY=$(jq -r '.neynar.apiKey' /data/.openclaw/credentials.json)
SIGNER=$(jq -r '.farcaster.signerUuid' /data/.openclaw/credentials.json)

Publishing

Post a cast

curl -s -X POST https://api.neynar.com/v2/farcaster/cast/ \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"signer_uuid\": \"$SIGNER\", \"text\": \"Your cast text here\"}" | jq .

Post to a channel

curl -s -X POST https://api.neynar.com/v2/farcaster/cast/ \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"signer_uuid\": \"$SIGNER\", \"text\": \"Alpha incoming\", \"channel_id\": \"trading\"}" | jq .

Reply to a cast

curl -s -X POST https://api.neynar.com/v2/farcaster/cast/ \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"signer_uuid\": \"$SIGNER\", \"text\": \"Reply text\", \"parent\": \"0xCASTHASH\"}" | jq .

Post with embed

curl -s -X POST https://api.neynar.com/v2/farcaster/cast/ \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"signer_uuid\": \"$SIGNER\", \"text\": \"Check this\", \"embeds\": [{\"url\": \"https://example.com\"}]}" | jq .

Reading

Look up a cast

curl -s "https://api.neynar.com/v2/farcaster/cast?identifier=0xCASTHASH&type=hash" \
  -H "x-api-key: $API_KEY" | jq .

Read a conversation thread

curl -s "https://api.neynar.com/v2/farcaster/cast/conversation?identifier=0xCASTHASH&type=hash&reply_depth=3" \
  -H "x-api-key: $API_KEY" | jq .

Get user's casts

curl -s "https://api.neynar.com/v2/farcaster/feed?feed_type=filter&filter_type=fids&fids=USER_FID&limit=25" \
  -H "x-api-key: $API_KEY" | jq '.casts[] | {text, hash, timestamp}'

Searching

Basic search

curl -s "https://api.neynar.com/v2/farcaster/cast/search/?q=hyperliquid+funding+rate&limit=25" \
  -H "x-api-key: $API_KEY" | jq '.result.casts[] | {text, hash, author: .author.username}'

Search operators

"phrase search"          # exact phrase
term1+term2              # AND
term1|term2              # OR
-excluded                # NOT
before:2026-02-01        # date filter
after:2026-01-15         # date filter

Semantic search (finds related concepts)

curl -s "https://api.neynar.com/v2/farcaster/cast/search/?q=crypto+market+making&mode=semantic&limit=25" \
  -H "x-api-key: $API_KEY" | jq '.result.casts[] | {text, hash, author: .author.username}'

Search within a channel

curl -s "https://api.neynar.com/v2/farcaster/cast/search/?q=alpha&channel_id=trading&limit=25" \
  -H "x-api-key: $API_KEY" | jq '.result.casts[] | {text, hash, author: .author.username}'

Engagement

Like a cast

curl -s -X POST https://api.neynar.com/v2/farcaster/reaction \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"signer_uuid\": \"$SIGNER\", \"reaction_type\": \"like\", \"target\": \"0xCASTHASH\"}" | jq .

Recast

curl -s -X POST https://api.neynar.com/v2/farcaster/reaction \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"signer_uuid\": \"$SIGNER\", \"reaction_type\": \"recast\", \"target\": \"0xCASTHASH\"}" | jq .

Follow a user

curl -s -X POST https://api.neynar.com/v2/farcaster/user/follow \
  -H "x-api-key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"signer_uuid\": \"$SIGNER\", \"target_fids\": [TARGET_FID]}" | jq .

Discovery

Look up user by username

curl -s "https://api.neynar.com/v2/farcaster/user/by_username?username=vitalik" \
  -H "x-api-key: $API_KEY" | jq '.user | {fid, username, display_name, follower_count}'

Search users

curl -s "https://api.neynar.com/v2/farcaster/user/search?q=defi+trader&limit=10" \
  -H "x-api-key: $API_KEY" | jq '.result.users[] | {fid, username, follower_count}'

Useful Channels

Channel ID Content
Trading trading Trade setups, alpha
DeFi defi Protocols, yields
Base base Base ecosystem
Ethereum ethereum ETH ecosystem
Crypto crypto General crypto

Credit Costs

Operation Credits
Publish cast 150
Read cast 2
Read feed 4
Search 10
Like/recast 10
Follow 10
User lookup 1-10

Free tier: 200K credits/month. Posting 3x/day + browsing every 30min ≈ 60K/month.

Cross-Posting Pattern

When posting an insight, hit both X and Farcaster:

  1. Compose once
  2. Post to X
  3. Post to Farcaster with channel targeting for discoverability

Resources