# Create agent avatar

```http
POST /projects/{project_reference}/agents/{agent_id}/avatar
```

Create agent avatar. Requires project.agents.write.

## Parameters

| Name                 | In    | Required | Description                                                     |
| -------------------- | ----- | -------- | --------------------------------------------------------------- |
| `project_reference`  | path  | Yes      | Project slug, UUID, or domain that identifies the project.      |
| `agent_id`           | path  | Yes      |                                                                 |
| `source_target_kind` | query |          | Source target: project or preview\_branch. Defaults to project. |
| `target_branch_id`   | query |          | Preview branch UUID, for a preview\_branch target.              |

## Request body

| Field    | Type    | Required | Description                                                                                                                                                                                      |
| -------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `assign` | boolean |          | Persist the generated avatar\_url onto the agent. Defaults to false; set true to assign it to an existing agent.                                                                                 |
| `config` | object  |          | Avatar configuration. Omit `seed` to generate a new avatar. With an explicit seed, omitted visual options use the existing avatar configuration if available. New agents use generator defaults. |

## Responses

| Status | Description                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------- |
| 200    | Agent avatar generated                                                                                      |
| 400    | Bad request                                                                                                 |
| 401    | Unauthorized                                                                                                |
| 403    | Forbidden                                                                                                   |
| 404    | Not found                                                                                                   |
| 409    | Conflict                                                                                                    |
| 500    | Server error                                                                                                |
| 503    | internal: authentication state is temporarily unavailable and the request was not processed; retry shortly. |
