Skip to main content

Followers

List followers of the authenticated user

Lists the people following the authenticated user.

get /user/followers

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

per_pageintegerquery

Results per page (max 100)

Default: 30

pageintegerquery

Page number of the results to fetch.

Default: 1

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/user/followers
JavaScript @octokit/core.js
await octokit.request('GET /user/followers', {})
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /user/followers

Response

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false } ]

Status codes

HTTP Status CodeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

List the people the authenticated user follows

Lists the people who the authenticated user follows.

get /user/following

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

per_pageintegerquery

Results per page (max 100)

Default: 30

pageintegerquery

Page number of the results to fetch.

Default: 1

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/user/following
JavaScript @octokit/core.js
await octokit.request('GET /user/following', {})
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /user/following

Response

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false } ]

Status codes

HTTP Status CodeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Check if a person is followed by the authenticated user

get /user/following/{username}

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

usernamestringpath

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/user/following/USERNAME
JavaScript @octokit/core.js
await octokit.request('GET /user/following/{username}', { username: 'USERNAME' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /user/following/USERNAME

if the person is followed by the authenticated user

Status: 204

Status codes

HTTP Status CodeDescription
204

if the person is followed by the authenticated user

304

Not modified

401

Requires authentication

403

Forbidden

404

if the person is not followed by the authenticated user

Follow a user

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

put /user/following/{username}

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

usernamestringpath

Code samples

Example

Shell
curl \ -X PUT \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/user/following/USERNAME
JavaScript @octokit/core.js
await octokit.request('PUT /user/following/{username}', { username: 'USERNAME' })
GitHub CLI gh api
gh api \ --method PUT \ -H "Accept: application/vnd.github.v3+json" \ /user/following/USERNAME

Response

Status: 204

Status codes

HTTP Status CodeDescription
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Unfollow a user

Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

delete /user/following/{username}

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

usernamestringpath

Code samples

Example

Shell
curl \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/user/following/USERNAME
JavaScript @octokit/core.js
await octokit.request('DELETE /user/following/{username}', { username: 'USERNAME' })
GitHub CLI gh api
gh api \ --method DELETE \ -H "Accept: application/vnd.github.v3+json" \ /user/following/USERNAME

Response

Status: 204

Status codes

HTTP Status CodeDescription
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

List followers of a user

Lists the people following the specified user.

get /users/{username}/followers

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

usernamestringpath
per_pageintegerquery

Results per page (max 100)

Default: 30

pageintegerquery

Page number of the results to fetch.

Default: 1

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/users/USERNAME/followers
JavaScript @octokit/core.js
await octokit.request('GET /users/{username}/followers', { username: 'USERNAME' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /users/USERNAME/followers

Response

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false } ]

Status codes

HTTP Status CodeDescription
200

OK

Notes

List the people a user follows

Lists the people who the specified user follows.

get /users/{username}/following

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

usernamestringpath
per_pageintegerquery

Results per page (max 100)

Default: 30

pageintegerquery

Page number of the results to fetch.

Default: 1

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/users/USERNAME/following
JavaScript @octokit/core.js
await octokit.request('GET /users/{username}/following', { username: 'USERNAME' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /users/USERNAME/following

Response

Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api.github.com/users/octocat", "html_url": "https://github.com/octocat", "followers_url": "https://api.github.com/users/octocat/followers", "following_url": "https://api.github.com/users/octocat/following{/other_user}", "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", "organizations_url": "https://api.github.com/users/octocat/orgs", "repos_url": "https://api.github.com/users/octocat/repos", "events_url": "https://api.github.com/users/octocat/events{/privacy}", "received_events_url": "https://api.github.com/users/octocat/received_events", "type": "User", "site_admin": false } ]

Status codes

HTTP Status CodeDescription
200

OK

Notes

Check if a user follows another user

get /users/{username}/following/{target_user}

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

usernamestringpath
target_userstringpath

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/users/USERNAME/following/TARGET_USER
JavaScript @octokit/core.js
await octokit.request('GET /users/{username}/following/{target_user}', { username: 'USERNAME', target_user: 'TARGET_USER' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /users/USERNAME/following/TARGET_USER

if the user follows the target user

Status: 204

Status codes

HTTP Status CodeDescription
204

if the user follows the target user

404

if the user does not follow the target user

Notes