> For the complete documentation index, see [llms.txt](https://navixy.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://navixy.com/docs/navixy-api/user-api/backend-api/resources/field-service/employee/avatar.md).

# Changing avatar

Avatars can't be changed through `/employee/update`, you must use either `assign` (to set avatar to one of preset icons), or `upload` (to upload your own image).

## API actions

API path: `/employee/avatar`.

### assign

Assign `icon_id` (from standard icon set) to this employee/driver.\
The `icon_id` can be `null` – this means that uploaded avatar should be used instead of icon.

**required sub-user rights**: `employee_update`.

#### Parameters

| name         | description                                             | type |
| ------------ | ------------------------------------------------------- | ---- |
| employee\_id | ID of the employee/driver to whom the icon will assign. | int  |
| icon\_id     | ID of the icon.                                         | int  |

#### Examples

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```sh
curl -X POST 'https://api.eu.navixy.com/v2/employee/avatar/assign' \
    -H 'Content-Type: application/json' \
    -d '{"hash": "22eac1c27af4be7b9d04da2ce1af111b", "employee_id": 2132, "icon_id": 3654}'
```

{% endcode %}
{% endtab %}

{% tab title="HTTP GET" %}
{% code overflow="wrap" %}

```http
https://api.eu.navixy.com/v2/employee/avatar/assign?hash=a6aa75587e5c59c32d347da438505fc3&employee_id=2132&icon_id=3654
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Response

```json
{ "success": true }
```

#### Errors

* 201 – Not found in the database - when employee/driver with `employee_id` not found.

### upload

Uploads avatar image for specified employee/driver.\
Then it will be available from /employee/avatars/\
e.g. `https://api.eu.navixy.com/v2/static/employee/avatars/abcdef123456789.png`.

**required sub-user rights**: `employee_update`.

**avatar\_file\_name** returned in response and will be returned from [/employee/list](/docs/navixy-api/user-api/backend-api/resources/field-service/employee/index.md#list).

**MUST** be a POST multipart request (multipart/form-data),\
with one of the parts being an image file upload (with the name `file`).

File part **mime** type must be one of:

* `image/jpeg`
* `image/pjpeg`
* `image/png`
* `image/gif`
* `image/webp`

#### Parameters

| name             | description                                                            | type   |
| ---------------- | ---------------------------------------------------------------------- | ------ |
| employee\_id     | ID of the employee/driver to whom the icon will assign.                | int    |
| file             | Image file.                                                            | string |
| redirect\_target | Optional. URL to redirect. If passed returns redirect to `?response=`. | string |

#### Response

```json
{
    "success": true,
    "value": "picture.png"
}
```

* `value` - string. Uploaded file name.

#### Errors

* 201 – Not found in the database - when employee/driver with `employee_id` not found.
* 233 – No data file - if `file` part not passed.
* 234 – Invalid data format - if passed `file` with unexpected `mime` type.
* 254 – Cannot save file - on some file system errors.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://navixy.com/docs/navixy-api/user-api/backend-api/resources/field-service/employee/avatar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
