GET friends/ids

Returns a cursored collection of user IDs for every user the specified user is following (otherwise known as their “friends”).

At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues. Results are given in groups of 5,000 user IDs and multiple “pages” of results can be navigated through using the next_cursor value in subsequent requests. See Using cursors to navigate collections for more information.

This method is especially powerful when used in conjunction with GET users / lookup, a method that allows you to convert user IDs into full user objects in bulk.

Resource URL

https://api.twitter.com/1.1/friends/ids.json

Resource Information

Response formats
JSON
Requires authentication?
Yes
Rate limited?
Yes
Requests / 15-min window (user auth)
15
Requests / 15-min window (app auth)
15

Parameters

Either a screen_name or a user_id must be provided.

user_id optional

The ID of the user for whom to return results for.

Example Values: 12345

screen_name optional

The screen name of the user for whom to return results for.

Example Values: noradio

cursor semi-optional

Causes the list of connections to be broken into pages of no more than 5000 IDs at a time. The number of IDs returned is not guaranteed to be 5000 as suspended users are filtered out after connections are queried. If no cursor is provided, a value of -1 will be assumed, which is the first “page.”

The response from the API will include a previous_cursor and next_cursor to allow paging back and forth. See Using cursors to navigate collections for more information.

Example Values: 12893764510938

stringify_ids optional

Many programming environments will not consume our Tweet ids due to their size. Provide this option to have ids returned as strings instead. More about Twitter IDs.

Example Values: true

count optional

Specifies the number of IDs attempt retrieval of, up to a maximum of 5,000 per distinct request. The value of count is best thought of as a limit to the number of results to return. When using the count parameter with this method, it is wise to use a consistent count value across all requests to the same user’s collection. Usage of this parameter is encouraged in environments where all 5,000 IDs constitutes too large of a response.

Example Values: 2048

OAuth Signature Generator

Sign in to see a list of your registered applications.

Example Request

GET

https://api.twitter.com/1.1/friends/ids.json?cursor=-1&screen_name=twitterapi&count=5000

Example Result

{
  "previous_cursor": 0,
  "ids": [
    657693,
    183709371,
    7588892,
    38895958,
    22891211,
    9019482,
    14488353,
    11750202,
    12249,
    22915745,
    1249881,
    14927800,
    1523501,
    22548447,
    15062340,
    133031077,
    17874544,
    777925,
    4265731,
    27674040,
    26123649,
    9576402,
    821958,
    7852612,
    819797,
    1401881,
    8285392,
    9160152,
    795649,
    3191321,
    783214
  ],
  "previous_cursor_str": "0",
  "next_cursor": 0,
  "next_cursor_str": "0"
}