To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
Get All Casts Casted By A Farcaster User
You can fetch all the casts casted by a Farcaster user by using the FarcasterCasts API and providing the Farcaster user's fname or fid to the castedBy filter:
{"data": {"FarcasterCasts": {"Cast": [ {"castedAtTimestamp":"2024-03-27T15:27:38Z","embeds": [],"url":"https://warpcast.com/betashop.eth/0x82bbbf0c","text":"Whoops","numberOfRecasts":0,"numberOfLikes":1,"channel": {"channelId":"farcaster" },"mentions": [] },// Other casts casted by Farcaster user betashop.eth ] } }}
Get All Casts That Have Frames
You can fetch all the casts casted that contain Frames by using the FarcasterCasts API and set the hasFrames filter to true:
Try Demo
Code
queryMyQuery { FarcasterCasts( input: {filter: { # Make sure to have `hasFrames` to truehasFrames: {_eq: true} },blockchain: ALL } ) { Cast { castedAtTimestamp embeds url text numberOfRecasts numberOfLikes channel { channelId } mentions { fid position } frame { buttons { action id index target } frameUrl imageAspectRatio imageUrl inputText postUrl state } } }}
{"data": {"FarcasterCasts": {"Cast": [ {"castedAtTimestamp":"2024-02-27T19:07:24Z","embeds": [ {"url":"https://i.imgur.com/znWzuFb.jpg" }, {"url":"https://api.anky.lat/farcaster-frames/newen-tldr" } ],"url":"https://warpcast.com/kregitmhun/0x949a4e0e", "text": "Mint free or not try to get a place earlier than anyone else, I will provide specific updates later\nhttps://api.anky.lat/farcaster-frames/newen-tldr",
"numberOfRecasts":0,"numberOfLikes":0,"channel": {"channelId":"base" },"mentions": [],// Frame details"frame": {"buttons": [ {"action":"","id":"0x85bffc4de32c70688855f31a868181613fe4182890c4d35224a0afa311cfc6df-1","index":1,"target":"" } ],"frameUrl":"https://api.anky.lat/farcaster-frames/newen-tldr","imageAspectRatio":"","imageUrl":"https://jpfraneto.github.io/images/newen2.png","inputText":"","postUrl":"http://api.anky.lat/farcaster-frames/newen-tldr?page=1","state":"" } },// Other casts that contains Frames ] } }}
Get All Casts That Have Embeds
You can fetch all the casts casted that contain Frames by using the FarcasterCasts API and set the hasEmbeds filter to true:
Try Demo
Code
queryMyQuery { FarcasterCasts( input: {filter: { # Make sure to set `hasEmbeds` to truehasEmbeds: {_eq: true} },blockchain: ALL } ) { Cast { castedAtTimestamp embeds url text numberOfRecasts numberOfLikes channel { channelId } mentions { fid position } } }}
{"data": {"FarcasterCasts": {"Cast": [ {"castedAtTimestamp":"2024-02-27T19:07:25Z","embeds": [ {"url":"https://audius.co/dannylove/lovestruck" } ],"url":"https://warpcast.com/dannylove/0xabc68559","text":"https://audius.co/dannylove/lovestruck\n\n@audius it works!!","numberOfRecasts":0,"numberOfLikes":0,"channel": {"channelId":"music" },"mentions": [ {"fid":"366747","position":40 } ] },// Other casts that have embeds ] } }}
Get All Casts Casted At Certain Period Of Time
You can fetch all the casts casted that contain Frames by using the FarcasterCasts API and providing the time period to the castedAtTimestamp filter with the appropriate operators:
Try Demo
Code
queryMyQuery { FarcasterCasts( input: {filter: { # Make sure to set `castedTimestamp` with the matching operator # to filter by the desired time periodcastedAtTimestamp: {_gte: "2024-01-01T00:00:00Z"} },blockchain: ALL } ) { Cast { castedAtTimestamp embeds url text numberOfRecasts numberOfLikes channel { channelId } mentions { fid position } } }}
{"data": {"FarcasterCasts": {"Cast": [ {"castedAtTimestamp":"2024-02-27T19:07:28Z","embeds": [],"url":"https://warpcast.com/qdau.eth/0x654ed051", "text": "not siue if that's a warpcast or zora problem, but mint with warps in a frame don't seem to work for base nfts\n\ncc @incarterseyes.eth @rawtoast @l444u",
"numberOfRecasts":0,"numberOfLikes":0,"channel": {"channelId":"warpcast" },"mentions": [ {"fid":"5952","position":115 }, {"fid":"17129","position":116 }, {"fid":"15037","position":117 } ] },// Other casts casted since Jan 1, 2024 ] } }}
Get All Casts That Have Mentions
You can fetch all the casts casted that contain mentions by using the FarcasterCasts API and set the hasMentions filter to true:
Try Demo
Code
queryMyQuery { FarcasterCasts( input: {filter: { # Make sure to set `hasMentions` to truehasMentions: {_eq: true} },blockchain: ALL } ) { Cast { castedAtTimestamp embeds url text numberOfRecasts numberOfLikes channel { channelId } mentions { fid position } } }}
{"data": {"FarcasterCasts": {"Cast": [ {"castedAtTimestamp":"2024-02-27T19:07:28Z","embeds": [],"url":"https://warpcast.com/qdau.eth/0x654ed051", "text": "not siue if that's a warpcast or zora problem, but mint with warps in a frame don't seem to work for base nfts\n\ncc @incarterseyes.eth @rawtoast @l444u",
"numberOfRecasts":0,"numberOfLikes":0,"channel": {"channelId":"warpcast" },"mentions": [ {"fid":"5952","position":115 }, {"fid":"17129","position":116 }, {"fid":"15037","position":117 } ] },// Other casts that have mentions ] } }}
Get Details Of A Certain Cast
You can fetch all the details, including text, embeds, url, social capital value, etc., of a given cast by using the FarcasterCasts API and provide the cast's URL from Warpcast the url filter:
{"data": {"FarcasterCasts": {"Cast": [ {"castedAtTimestamp":"2024-04-04T13:23:04Z","embeds": [],"fid":"397612","castedBy": {"profileName":"mafinmz" },"url":"https://warpcast.com/mafinmz/0x4d0bb095","text":"It was good, I will try","numberOfLikes":1,"numberOfRecasts":0,"numberOfReplies":0,"hash":"0x4d0bb095f9896d81bdccabb4d16c5171c4b1b252" },// Other replies on the cast ] } }}
Developer Support
If you have any questions or need help regarding fetching Farcaster Casts data, please join our Airstack's Telegram group.