Skip to main content
O controle de versão da API REST já foi feito. Para obter mais informações, confira "Sobre o controle de versão da API".

Pontos de extremidade de API REST para seguidores

Use a API REST para obter informações sobre seguidores de usuários autenticados.

Sobre a administração de seguidores

Se uma URL de solicitação não incluir um parâmetro {username}, a resposta será para o usuário conectado (e você deverá passar informações de autenticação com sua solicitação). Informações privadas adicionais, como se um usuário tem a autenticação de dois fatores habilitada, são incluídas quando autenticadas por meio da Autenticação Básica OAuth com o escopo user.

List followers of the authenticated user

Lists the people following the authenticated user.

Tokens de acesso refinados para "List followers of the authenticated user"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token deve ter os seguintes conjuntos de permissões:

  • followers:read

Parâmetros para "List followers of the authenticated user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Padrão: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "List followers of the authenticated user"

Código de statusDescrição
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Exemplos de código para "List followers of the authenticated user"

Exemplo de solicitação

get/user/followers
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/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 } ]

List the people the authenticated user follows

Lists the people who the authenticated user follows.

Tokens de acesso refinados para "List the people the authenticated user follows"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token deve ter os seguintes conjuntos de permissões:

  • followers:read

Parâmetros para "List the people the authenticated user follows"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Padrão: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "List the people the authenticated user follows"

Código de statusDescrição
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

Exemplos de código para "List the people the authenticated user follows"

Exemplo de solicitação

get/user/following
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/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 } ]

Check if a person is followed by the authenticated user

Tokens de acesso refinados para "Check if a person is followed by the authenticated user"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token deve ter os seguintes conjuntos de permissões:

  • followers:read

Parâmetros para "Check if a person is followed by the authenticated user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

Códigos de status de resposta HTTP para "Check if a person is followed by the authenticated user"

Código de statusDescrição
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

Exemplos de código para "Check if a person is followed by the authenticated user"

Exemplo de solicitação

get/user/following/{username}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/user/following/USERNAME

if the person is followed by the authenticated user

Status: 204

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."

OAuth app tokens and personal access tokens (classic) need the user:follow scope to use this endpoint.

Tokens de acesso refinados para "Follow a user"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token deve ter os seguintes conjuntos de permissões:

  • followers:write

Parâmetros para "Follow a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

Códigos de status de resposta HTTP para "Follow a user"

Código de statusDescrição
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Exemplos de código para "Follow a user"

Exemplo de solicitação

put/user/following/{username}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/user/following/USERNAME

Response

Status: 204

Unfollow a user

OAuth app tokens and personal access tokens (classic) need the user:follow scope to use this endpoint.

Tokens de acesso refinados para "Unfollow a user"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token deve ter os seguintes conjuntos de permissões:

  • followers:write

Parâmetros para "Unfollow a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

Códigos de status de resposta HTTP para "Unfollow a user"

Código de statusDescrição
204

No Content

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

Exemplos de código para "Unfollow a user"

Exemplo de solicitação

delete/user/following/{username}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/user/following/USERNAME

Response

Status: 204

List followers of a user

Lists the people following the specified user.

Tokens de acesso refinados para "List followers of a user"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token não requer permissões.

Parâmetros para "List followers of a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Padrão: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "List followers of a user"

Código de statusDescrição
200

OK

Exemplos de código para "List followers of a user"

Exemplo de solicitação

get/users/{username}/followers
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/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 } ]

List the people a user follows

Lists the people who the specified user follows.

Tokens de acesso refinados para "List the people a user follows"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token não requer permissões.

Parâmetros para "List the people a user follows"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

Parâmetros de consulta
Nome, Tipo, Descrição
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Padrão: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Padrão: 1

Códigos de status de resposta HTTP para "List the people a user follows"

Código de statusDescrição
200

OK

Exemplos de código para "List the people a user follows"

Exemplo de solicitação

get/users/{username}/following
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/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 } ]

Check if a user follows another user

Tokens de acesso refinados para "Check if a user follows another user"

Esse ponto de extremidade funciona com os seguintes tipos de token:

O token não requer permissões.

Parâmetros para "Check if a user follows another user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

target_user string Obrigatório

Códigos de status de resposta HTTP para "Check if a user follows another user"

Código de statusDescrição
204

if the user follows the target user

404

if the user does not follow the target user

Exemplos de código para "Check if a user follows another user"

Exemplo de solicitação

get/users/{username}/following/{target_user}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/users/USERNAME/following/TARGET_USER

if the user follows the target user

Status: 204