# Getting followers via API

**URL:** <https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222>\
**Category:** API\
**Created:** [November 21, 2014, 7:34am UTC](https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222 "2014-11-21T07:34:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vorisi](https://avatars.discourse-cdn.com/v4/letter/v/a88e4f/32.png) [@vorisi](https://staging-discuss.dev.twitch.com/u/vorisi)\
**Post date:** [November 21, 2014, 7:34am UTC](https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222/1 "2014-11-21T07:34:06Z")

</div>

I am writing a greasemonkey script and I need to fetch the current follower count from the api.

```
Twitch.api.get("channels/target").done(function(channel){ console.log(channel); });

```

When the above line is entered into console, it spits out an object that contains a lot of information, but not all of the information contained in the channel object, including the follower count.

Is this behavior intended?

---

<div class="post-metadata">

**Author:** ![Freddy](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/freddy/32/111_2.png) [@Freddy](https://staging-discuss.dev.twitch.com/u/Freddy)\
**Post date:** [November 21, 2014, 12:49pm UTC](https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222/2 "2014-11-21T12:49:16Z")

</div>

you can get the current follower count by calling

> Twitch.api.get(“channels/:name/follows”).done(function(channel){ console.log(channel.\_total); });

---

<div class="post-metadata">

**Author:** ![night](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/night/32/1613_2.png) [@night](https://staging-discuss.dev.twitch.com/u/night)\
**Post date:** [November 21, 2014, 5:50pm UTC](https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222/3 "2014-11-21T17:50:00Z")

</div>

> [@vorisi](#):
>
> I am writing a greasemonkey script and I need to fetch the current follower count from the api.
> 
> Twitch.api.get(“channels/target”).done(function(channel){ console.log(channel); });
> 
> When the above line is entered into console, it spits out an object that contains a lot of information, but not all of the information contained in the channel object, including the follower count.
> 
> Is this behavior intended?

You’re pulling the entire channel object, so you need to grab the followers from the output object.

```
Twitch.api.get("channels/:name").done(function(channel){ console.log(channel.followers); });

```

---

<div class="post-metadata">

**Author:** ![vorisi](https://avatars.discourse-cdn.com/v4/letter/v/a88e4f/32.png) [@vorisi](https://staging-discuss.dev.twitch.com/u/vorisi)\
**Post date:** [November 21, 2014, 8:24pm UTC](https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222/4 "2014-11-21T20:24:57Z")

</div>

@night the Channel object does not have a followers property according to my Firefox Element Inspecter

---

<div class="post-metadata">

**Author:** ![Colten45](https://avatars.discourse-cdn.com/v4/letter/c/9de0a6/32.png) [@Colten45](https://staging-discuss.dev.twitch.com/u/Colten45)\
**Post date:** [November 22, 2014, 9:44pm UTC](https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222/5 "2014-11-22T21:44:43Z")

</div>

If you’re looking for total amount of channels followed, Freddy was correct.

If you want to know how many objects are in the follows array that was returned. Then do this.

Twitch.api.get(“channels/:name/follows”).done(function(json){ console.log(json.follows.length); });

EDIT: changed “channels array” to “follows array” and “of followers” to “of channels followed,”

---

<div class="post-metadata">

**Author:** ![XOFrank](https://d1d6mrmdu7ztse.cloudfront.net/user_avatar/staging-discuss.dev.twitch.com/xofrank/32/374_2.png) [@XOFrank](https://staging-discuss.dev.twitch.com/u/XOFrank)\
**Post date:** [March 11, 2015, 10:36pm UTC](https://staging-discuss.dev.twitch.com/t/getting-followers-via-api/1222/6 "2015-03-11T22:36:03Z")

</div>

Hi Freddy,

how would a websites code look like, that simply has the number of followers as an output? (I am no Developer, thus it would be nice to have a noobfriendly explanation)  
I want to generate a website that displays the number of followers as text to embed that then into a costom command of the nightbot.

greetz, Frank
