---
title: "Get avatar upload URL"
method: POST
path: "/agent/{id}/avatar/presigned-url"
tags: ["Agents"]
---

# Get avatar upload URL

`POST /agent/{id}/avatar/presigned-url`

Generates a pre-signed S3 upload URL for the agent's widget avatar image. Upload the image directly to S3 using the returned `presignedUrl`, then save `cdnUrl` as the agent's avatar via `PATCH /agent/{id}/widget-config`.

## Path parameters

- `id` string, required

## Request body

- object
  - `fileName` string, required — Original file name (used to construct the S3 key)
  - `contentType` string, required — MIME type — must start with `image/`
  - `fileSize` number, required — File size in bytes — must be > 0 and ≤ 2 MB (2,097,152 bytes)

## Response `200`

Pre-signed upload URL and CDN URL

- object
  - `success` boolean
  - `data` object
    - `presignedUrl` string — S3 pre-signed PUT URL (expires in 300 s)
    - `cdnUrl` string — Final public CDN URL to save on the agent after upload
    - `key` string — S3 object key

## Other responses

- `400` — Invalid input
- `401` — Unauthorized access
- `404` — Agent not found
- `500` — Internal server error

---

[API](https://skmtc.net/smallest-inc/apis/agent-management-api.md) · [All operations](https://skmtc.net/smallest-inc/apis/agent-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/smallest-inc/agent-management-api/versions/6d1036a76fbc/schema)
