- Follow a user
- Unfollow a user
- List all accounts that follow a user
- List all accounts followed by a user
User follow and unfollow API
Tier: Free, Premium, Ultimate
Offering: GitLab.com, Self-managed, GitLab Dedicated
Use this API to perform follower actions for user accounts. For more information, see Follow users.
Follow a user
Follow a given user account.
POST /users/:id/follow
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
id
| integer | yes | ID of user account |
Example request:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/follow"
Example response:
{
"id": 1,
"username": "john_smith",
"name": "John Smith",
"state": "active",
"locked": false,
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
"web_url": "http://localhost:3000/john_smith"
}
Unfollow a user
Unfollow a given user account.
POST /users/:id/unfollow
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
id
| integer | yes | ID of user account |
Example request:
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/unfollow"
List all accounts that follow a user
Lists all users accounts that follow a given user.
GET /users/:id/followers
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
id
| integer | yes | ID of user account |
Example request:
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/followers"
Example response:
[
{
"id": 2,
"name": "Lennie Donnelly",
"username": "evette.kilback",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/7955171a55ac4997ed81e5976287890a?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/evette.kilback"
},
{
"id": 4,
"name": "Serena Bradtke",
"username": "cammy",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/a2daad869a7b60d3090b7b9bef4baf57?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/cammy"
}
]
List all accounts followed by a user
Lists all users accounts being followed by a given user.
GET /users/:id/following
Supported attributes:
Attribute | Type | Required | Description |
---|---|---|---|
id
| integer | yes | ID of user account |
Example request:
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/users/3/following"