avatar.md 1.49 KB
Newer Older
Imre's avatar
Imre committed
1 2
# Avatar API

3
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19121) in GitLab 11.0.
Imre's avatar
Imre committed
4 5 6

## Get a single avatar URL

7
Get a single [avatar](../user/profile/index.md#profile-settings) URL for a user with the given email address.
Imre's avatar
Imre committed
8

9 10 11 12 13 14 15 16 17 18
If:

- No user with the given public email address is found, results from external avatar services are
  returned.
- Public visibility is restricted, response will be `403 Forbidden` when unauthenticated.

NOTE: **Note:**
This endpoint can be accessed without authentication.

```text
Imre's avatar
Imre committed
19 20 21
GET /avatar?email=admin@example.com
```

22
Parameters:
Imre's avatar
Imre committed
23

24 25 26 27 28 29 30 31 32
| Attribute | Type    | Required | Description                                                                                                                             |
|:----------|:--------|:---------|:----------------------------------------------------------------------------------------------------------------------------------------|
| `email`   | string  | yes      | Public email address of the user.                                                                                                       |
| `size`    | integer | no       | Single pixel dimension (since images are squares). Only used for avatar lookups at `Gravatar` or at the configured `Libravatar` server. |

Example request:

```sh
curl https://gitlab.example.com/api/v4/avatar?email=admin@example.com&size=32
Imre's avatar
Imre committed
33 34 35 36 37 38
```

Example response:

```json
{
39
  "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=64&d=identicon"
Imre's avatar
Imre committed
40 41
}
```