I need to find the Twitter username for NFT projects using their contract address. I want to do this automatically through code.
I already tried using the OpenSea collections API but the twitter_username field is almost always null, even for verified collections. I also attempted to scrape the information directly but ran into Cloudflare error 1020.
Has anyone successfully used services like Moralis NFT API or similar GraphQL services to get social media handles for NFT collections? I’m starting with just the contract address and need to find the associated Twitter account programmatically.
Any suggestions for reliable APIs or methods that actually return populated social media data would be really helpful.
honestly the nft metadata itself sometimes has social links embedded. try calling the tokenURI function directly on the contract and parse the json - some projects include twitter handles there. it’s hit or miss but worth checking before paying for apis
Yeah, this is tricky! I’ve been dealing with the same thing lately. Have you tried Alchemy’s NFT API? Their metadata endpoints might pull more complete social data than OpenSea.
The twitter_username field being null for verified collections is weird though - you sure you’re hitting the right endpoint? Social data sometimes hides in nested objects or different response fields. Check the raw metadata to see if Twitter handles are buried elsewhere in the JSON.
Alternatively, flip it around and use Twitter’s API to search for NFT project mentions. Not as clean as contract → Twitter directly, but worth trying if NFT APIs keep failing you.
What’s up with those Cloudflare 1020 errors? Were you rotating user agents and using proper headers? Sometimes you can bypass anti-bot measures with the right setup, though that’s obviously a gray area.
How much volume are you processing? Manual verification might work for a few collections, but sounds like you need something scalable.
Had this exact issue building a portfolio tracker last year. Most NFT APIs skip social media data since it’s not core blockchain metadata. Here’s what worked for me - combine multiple sources. CoinGecko’s API covers major NFT projects pretty well. They track social links for tokens and collections, so you can query by contract address and grab Twitter handles other APIs miss. Also try checking the contract’s metadata URI directly. Lots of projects stuff social links into collection-level metadata instead of individual tokens. Look for “external_url” or “social_links” in the base metadata. For smaller collections, I used a hybrid approach - pulled project names from metadata, then searched Twitter’s API for matching usernames with NFT keywords. Not perfect but caught about 70% of what pure NFT APIs missed. Just heads up though - data quality’s sketchy. You’ll need manual verification for anything critical since handles change all the time and APIs are always behind.