# Set an agent's avatar from a curated preset (preset_id, see list_avatar_presets) or an image (image_base64: PNG, JPEG, GIF or WebP, at least 64x64, at most 1 MB). Replaces the previous avatar and updates the icon of the agent's one-click Slack apps.

Source: <https://everruns.com/docs/api/operations/set_agent_avatar/>

POST

/v1/agents/{agent\_id}/avatar/set

Select code samplecURL (shell:curl)

```js
const url = 'https://app.everruns.com/api/v1/agents/example/avatar/set';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"content_type":"image/png","image_base64":"example","preset_id":"familiars-patch"}'
};


try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```sh
curl --request POST \
  --url https://app.everruns.com/api/v1/agents/example/avatar/set \
  --header 'Content-Type: application/json' \
  --data '{ "content_type": "image/png", "image_base64": "example", "preset_id": "familiars-patch" }'
```

* Production APIapp.everruns.com/api/v1/agents/{agent\_id}/avatar/set

## Parameters

### Path Parameters

**agent\_id**

required

string

Prefixed public identifier

## Request Bodyrequired

Media typeapplication/json

The avatar source: exactly one of `preset_id` or `image_base64`.

object

**content\_type**

MIME type of `image_base64`. Detected from the bytes when omitted.

string | null

##### Example

```plaintext
image/png
```

**image\_base64**

Image bytes as base64 (a `data:image/...;base64,` URI also works): PNG, JPEG, GIF or WebP, at least 64x64, at most 1 MB decoded. Center-cropped to a square.

string | null

**preset\_id**

Curated preset ID from `list_avatar_presets`. Pass this or `image_base64`, not both.

string | null

##### Example

```plaintext
familiars-patch
```

## Responses

### 200

Success

Media typeapplication/json

An agent’s avatar, pre-rendered as square and circular PNG presets.

URLs are relative to the API base URL, public, and immutable: a new upload gets a new `id`, so they can be cached forever. Any size in `sizes` can be substituted into a URL, e.g. `/v1/avatars/{id}/circle-64.png`; the uploaded square crop is at `/v1/avatars/{id}/source.png`.

object

**circle\_url**

required

Circular avatar (transparent corners), 256 px.

string

**id**

required

Prefixed public identifier. See [ID Schema](https://everruns.com/docs/advanced/id-schema/).

string

**sizes**

required

Edge lengths, in pixels, available for both shapes.

Array\<integer>

**url**

required

Square avatar, 256 px.

string

##### Example

```json
{
  "circle_url": "/v1/avatars/avatar_01933b5a000070008000000000000001/circle-256.png",
  "id": "avatar_01933b5a000070008000000000000001",
  "sizes": [
    32,
    64,
    128,
    256,
    512
  ],
  "url": "/v1/avatars/avatar_01933b5a000070008000000000000001/square-256.png"
}
```

### 400

Invalid preset or image

### 404

Agent not found