To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.
Get All Casts Casted In A Channel
You can fetch all the casts casted in a certain Farcaster channel by using the FarcasterCasts API and providing the Farcaster channel's URL to the channelUrl filter:
If you don't know the channel's URL, then find the channel's URL with this query here. The url field will return you the channel's URL associated with the given channel ID.
{"data": {"FarcasterCasts": {"Cast": [ {"castedAtTimestamp":"2024-05-15T10:42:06Z","castedBy": {"profileName":"juampi","fid":"6730" },"embeds": [ {"url":"https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/84b11c9b-2308-43c5-821b-b73d7687b400/original" } ],"fid":"6730","hash":"0xb2a16ed043b762e097627ed5b080d5c482b4664b","text":"Everyone loving the Airstack frame, super smooth experience!\n\nNow you can buy $BUILD on it ๐ซก","numberOfLikes":3,"numberOfRecasts":0,"numberOfReplies":0 }// More casts from /airstack channel ] } }}
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 By Cast URL
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 to the url filter:
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 hash to the hash filter:
If the cast is a reply and not a root cast, then you should use this query here.