> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neynar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch & Display Farcaster Feeds with Neynar API

> Complete guide to fetching and displaying casts from specific Farcaster channels using Neynar SDK. Learn how to retrieve channel feeds, filter content by channel IDs, and build engaging social media applications with real-time Farcaster data.

<Info>
  ### Related API reference [Fetch Feed by Channel IDs](/reference/fetch-feed-by-channel-ids)
</Info>

Channels are "subreddits inside Farcaster." Technically, a channel is a collection of casts that share a common channel\_id. For example, the [memes channel](https://warpcast.com/~/channel/memes) is a collection of casts that share the channel\_id `memes`.

## Fetching Casts from a Channel

This guide demonstrates how to use the Neynar SDK to fetch casts from a channel.

Check out this [Getting started guide](/docs/getting-started-with-neynar) to learn how to set up your environment and get an API key.

First, initialize the client:

<CodeGroup>
  ```javascript Javascript theme={"system"}
  // npm i @neynar/nodejs-sdk
  import { NeynarAPIClient, Configuration } from "@neynar/nodejs-sdk";
  import { FeedType,FilterType } from "@neynar/nodejs-sdk/build/api/index.js";

  // make sure to set your NEYNAR_API_KEY .env
  // don't have an API key yet? get one at neynar.com
  const config = new Configuration({
    apiKey: process.env.NEYNAR_API_KEY,
  });

  const client = new NeynarAPIClient(config);
  ```
</CodeGroup>

Then, fetch the feed in the memes channel.

<CodeGroup>
  ```javascript Javascript theme={"system"}
  const client = new NeynarAPIClient(config);
  const channelId = "memes";
  const filterType = FilterType.ChannelId;

  const feed = await client.fetchFeed({
    feedType: FeedType.Filter,
    filterType,
    channelId,
  });

  console.log(feed);
  ```
</CodeGroup>

Example output:

<CodeGroup>
  ```json Json theme={"system"}
  {
    casts: [
      {
        object: "cast_hydrated",
      hash: "0xf17168571d5e403f3b608ea2cc09a0b711d4c4fc",
      thread_hash: "0xf17168571d5e403f3b608ea2cc09a0b711d4c4fc",
      parent_hash: null,
      parent_url: "chain://eip155:1/erc721:0xfd8427165df67df6d7fd689ae67c8ebf56d9ca61",
      parent_author: [Object ...],
      author: [Object ...],
      text: "",
      timestamp: "2023-11-27T14:40:12.000Z",
      embeds: [
        [Object ...]
      ],
      reactions: [Object ...],
      replies: [Object ...],
      mentioned_profiles: []
    }, {
      object: "cast_hydrated",
      hash: "0x344dcd9c7c2671450628aacd0bbb8e29ea2e8809",
      thread_hash: "0x344dcd9c7c2671450628aacd0bbb8e29ea2e8809",
      parent_hash: null,
      parent_url: "chain://eip155:1/erc721:0xfd8427165df67df6d7fd689ae67c8ebf56d9ca61",
      parent_author: [Object ...],
      author: [Object ...],
      text: "sorry",
      timestamp: "2023-11-27T14:24:32.000Z",
      embeds: [
        [Object ...]
      ],
      reactions: [Object ...],
      replies: [Object ...],
      mentioned_profiles: []
    }, {
      object: "cast_hydrated",
      hash: "0x68b94ec2a10ebad8b13e3b673f0db02dd3280f42",
      thread_hash: "0x68b94ec2a10ebad8b13e3b673f0db02dd3280f42",
      parent_hash: null,
      parent_url: "chain://eip155:1/erc721:0xfd8427165df67df6d7fd689ae67c8ebf56d9ca61",
      parent_author: [Object ...],
      author: [Object ...],
      text: "man today is such a nice morning",
      timestamp: "2023-11-27T13:30:11.000Z",
      embeds: [
        [Object ...]
      ],
      reactions: [Object ...],
      replies: [Object ...],
      mentioned_profiles: []
    }
  ],
  next: {
    cursor: "eyJ0aW1lc3RhbXAiOiIyMDIzLTExLTI3IDEzOjMwOjExLjAwMDAwMDAifQ=="
  }
  }
  ```
</CodeGroup>

To fetch the next page of the feed, use the cursor:

<CodeGroup>
  ```javascript Javascript theme={"system"}
  const nextFeed = await client.fetchFeed({
   feedType: FeedType.Filter,
    filterType: FilterType.ChannelId,
    channelId,
    cursor: feed.next.cursor,
  });
  ```
</CodeGroup>

There you go! You now know how to fetch casts from a Farcaster channel with Neynar SDK.

<Info>
  ### Ready to start building?

  Get your subscription at [neynar.com](https://neynar.com) and reach out to us on [Slack](https://neynar.com/slack) with any questions!
</Info>
