Skip to content
Snippets Groups Projects

Add update avatar on user api

Files
5
+ 13
47
@@ -2546,15 +2546,17 @@ Example response:
## Upload a current user avatar
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/148130) in GitLab 17.0.
Upload an avatar to current user.
```plaintext
PUT /user/avatar
```
| Attribute | Type | Required | Description |
|-----------|-------------------|----------|-------------|
| `avatar` | string | Yes | The file to be uploaded. |
| Attribute | Type | Required | Description |
|-----------|-------------------|----------|-------------------------------------------------------------------------------------------------------------|
| `avatar` | string | Yes | The file to be uploaded. The ideal image size is 192 x 192 pixels. The maximum file size allowed is 200KiB. |
To upload an avatar from your file system, use the `--form` argument. This causes
cURL to post data using the header `Content-Type: multipart/form-data`. The
@@ -2565,55 +2567,19 @@ Example request:
```shell
curl --request PUT --header "Bearer: <your_access_token>" \
--form "avatar=@avatar.png" "https://gitlab.example.com/api/v4/user/avatar"
--form "avatar=@avatar.png" \
--url "https://gitlab.example.com/api/v4/user/avatar"
```
Returned object:
Returns `400 Bad Request` for file sizes greater than 200 KiB.
If successful, returns [`200`](rest/index.md#status-codes) and the following
response attributes:
```json
{
"id": 76,
"username": "group_33_bot_204e254b386e6445323593946ec746d5",
"name": "****",
"state": "active",
"locked": false,
"avatar_url": "http://gdk.test:3000/uploads/-/system/user/avatar/76/.dk.png",
"web_url": "http://gdk.test:3000/group_33_bot_204e254b386e6445323593946ec746d5",
"created_at": "2024-04-14T02:24:21.475Z",
"bio": "",
"location": "",
"public_email": null,
"skype": "",
"linkedin": "",
"twitter": "",
"discord": "",
"website_url": "",
"organization": "",
"job_title": "",
"pronouns": null,
"bot": true,
"work_information": null,
"followers": 0,
"following": 0,
"local_time": null,
"last_sign_in_at": null,
"confirmed_at": "2024-04-14T02:24:21.178Z",
"last_activity_on": "2024-04-14",
"email": "group_33_bot_204e254b386e6445323593946ec746d5@noreply.gdk.test",
"theme_id": 3,
"color_scheme_id": 1,
"projects_limit": 100000,
"current_sign_in_at": null,
"identities": [],
"can_create_group": true,
"can_create_project": true,
"two_factor_enabled": false,
"external": false,
"private_profile": false,
"commit_email": "group_33_bot_204e254b386e6445323593946ec746d5@noreply.gdk.test",
"shared_runners_minutes_limit": null,
"extra_shared_runners_minutes_limit": null,
"scim_identities": []
"avatar_url": "http://gdk.test:3000/uploads/-/system/user/avatar/76/avatar.png",
}
{
```
Loading