Followers
List followers of the authenticated user
Lists the people following the authenticated user.
get /user/followersParameters
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
per_page | integer | query | Results per page (max 100) Default: |
page | integer | query | Page number of the results to fetch. Default: |
Code samples
Example
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/followersawait octokit.request('GET /user/followers', {})gh api \
-H "Accept: application/vnd.github.v3+json" \
/user/followersResponse
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 Code | Description |
|---|---|
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/followingParameters
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
per_page | integer | query | Results per page (max 100) Default: |
page | integer | query | Page number of the results to fetch. Default: |
Code samples
Example
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/followingawait octokit.request('GET /user/following', {})gh api \
-H "Accept: application/vnd.github.v3+json" \
/user/followingResponse
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 Code | Description |
|---|---|
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
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
username | string | path |
Code samples
Example
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/following/USERNAMEawait octokit.request('GET /user/following/{username}', {
username: 'USERNAME'
})gh api \
-H "Accept: application/vnd.github.v3+json" \
/user/following/USERNAMEif the person is followed by the authenticated user
Status: 204Status codes
| HTTP Status Code | Description |
|---|---|
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
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
username | string | path |
Code samples
Example
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/following/USERNAMEawait octokit.request('PUT /user/following/{username}', {
username: 'USERNAME'
})gh api \
--method PUT \
-H "Accept: application/vnd.github.v3+json" \
/user/following/USERNAMEResponse
Status: 204Status codes
| HTTP Status Code | Description |
|---|---|
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
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
username | string | path |
Code samples
Example
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/user/following/USERNAMEawait octokit.request('DELETE /user/following/{username}', {
username: 'USERNAME'
})gh api \
--method DELETE \
-H "Accept: application/vnd.github.v3+json" \
/user/following/USERNAMEResponse
Status: 204Status codes
| HTTP Status Code | Description |
|---|---|
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}/followersParameters
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
username | string | path | |
per_page | integer | query | Results per page (max 100) Default: |
page | integer | query | Page number of the results to fetch. Default: |
Code samples
Example
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/users/USERNAME/followersawait octokit.request('GET /users/{username}/followers', {
username: 'USERNAME'
})gh api \
-H "Accept: application/vnd.github.v3+json" \
/users/USERNAME/followersResponse
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 Code | Description |
|---|---|
200 | OK |
Notes
List the people a user follows
Lists the people who the specified user follows.
get /users/{username}/followingParameters
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
username | string | path | |
per_page | integer | query | Results per page (max 100) Default: |
page | integer | query | Page number of the results to fetch. Default: |
Code samples
Example
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/users/USERNAME/followingawait octokit.request('GET /users/{username}/following', {
username: 'USERNAME'
})gh api \
-H "Accept: application/vnd.github.v3+json" \
/users/USERNAME/followingResponse
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 Code | Description |
|---|---|
200 | OK |
Notes
Check if a user follows another user
get /users/{username}/following/{target_user}Parameters
| Name | Type | In | Description |
|---|---|---|---|
accept | string | header | Setting to |
username | string | path | |
target_user | string | path |
Code samples
Example
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/users/USERNAME/following/TARGET_USERawait octokit.request('GET /users/{username}/following/{target_user}', {
username: 'USERNAME',
target_user: 'TARGET_USER'
})gh api \
-H "Accept: application/vnd.github.v3+json" \
/users/USERNAME/following/TARGET_USERif the user follows the target user
Status: 204Status codes
| HTTP Status Code | Description |
|---|---|
204 | if the user follows the target user |
404 | if the user does not follow the target user |