# Update your public profile

> Change your handle, avatar or leaderboard_opt_in.

Source: https://docs.stxapp.io/api/rest/identity/update-your-public-profile/

Change your `handle`, `avatar` or `leaderboard_opt_in`. Every key is optional but at least one must be sent. A key of the wrong JSON type is a 400. A handle that is taken, reserved, blocked, malformed or changed again inside the 30-day window is a 422 whose `error` names the rule. Returns the same object as `GET /api/v1/me`. A bearer session may always call this; an API key needs `read_write`.

```http
PATCH /api/v1/me/profile
```

Send it with your own demo key: [Try it](/quick-start/?op=me_profile_patch#try-it).

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `avatar` | object | no | A new avatar. Any style/palette pairing renders; the seed selects the pattern. `null` is refused (`400`). |
| `avatar.palette` | string | **yes** | One of `ember`, `forest`, `ocean`, `grape`, `slate`, `mint`, `rose`, `gold`. |
| `avatar.seed` | string | **yes** | 1–32 characters. The same seed always renders the same image. |
| `avatar.style` | string | **yes** | One of `dots`, `rings`, `stripes`, `grid`. |
| `handle` | string | no | New public handle: 3–24 characters of lowercase letters, digits and inner `.` or `_`; case is folded. Must be unused, not a reserved word and not blocked. May be changed once every 30 days; re-sending your current handle is not a change. A blank handle is refused (`422`). |
| `leaderboard_opt_in` | boolean | no | Your consent to appear on public boards. `true` joins, `false` leaves; your own standing is unaffected. Each change is recorded with its time. Joining gives you a generated handle and avatar if you have none yet. |

## Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Success | object |
| `400` | A parameter was missing or invalid. | Error |
| `401` | No credential, a bad signature, or a bearer token that is expired, invalid or not a member's. With any signing header present the API-key rules apply and the body is &#123;"error":"Missing or invalid API key credentials"&#125;; otherwise &#123;"error":"Unauthorized"&#125;. | Error |
| `403` | This API key does not have write access. The account behind this key is not active, for example it is pending approval or suspended. Body: &#123;"error":"Your account is suspended. Contact support."&#125;, the message naming the account's status. | Error |
| `422` | The new value was refused: a handle that is taken, reserved, blocked, malformed or changed again inside the 30-day window. The body's `error` names the rule. | Error |

## Example

Request:

```bash
curl --request PATCH \
  --url 'https://demo.stxapp.io/api/v1/me/profile' \
  --header 'X-STX-ACCESS-KEY: <key-id>' \
  --header 'X-STX-ACCESS-TIMESTAMP: <unix-ms>' \
  --header 'X-STX-ACCESS-SIGNATURE: <base64-ed25519>' \
  --header 'Content-Type: application/json' \
  --data '{
  "avatar": {
    "palette": "ocean",
    "seed": "a1b2c3d4",
    "style": "dots"
  },
  "handle": "swift.fox12",
  "leaderboard_opt_in": true
}'
```

Response `200`:

```json
{
  "me": {
    "account_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
    "avatar_url": null,
    "first_name": null,
    "handle": null,
    "handle_changeable_at": null,
    "key_id": null,
    "last_name": null,
    "leaderboard_opt_in": false,
    "method": "api_key",
    "scope": null,
    "user_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
  }
}
```

### Response fields

| Field | Type | Description |
|---|---|---|
| `account_id` | uuid | Your account id. Trades, settlements and balances are scoped to it. |
| `avatar_url` | string | Path of your avatar, `/avatars/{handle}.svg`, relative to the API host. `null` when `handle` is `null`. |
| `first_name` | string | First name on the account, or `null` if no profile is loaded. |
| `handle` | string | Your public handle, shown on the leaderboard in place of your name. `null` until one is set. |
| `handle_changeable_at` | date-time | When you may next change your handle. `null` means now; otherwise the end of the 30-day window since the last change. |
| `key_id` | string | The id of the API key that signed this request: the value sent in the access-key header. `null` on a bearer request. |
| `last_name` | string | Last name on the account, or `null` if no profile is loaded. |
| `leaderboard_opt_in` | boolean | Whether you have consented to appear on public leaderboards. New accounts start with the jurisdiction's default; accounts from before the leaderboard start at `false`. Change it with `PATCH /api/v1/me/profile`. |
| `method` | string | How this request authenticated: `api_key` for a signed request, `bearer` for a session token. |
| `scope` | string | Access level granted to this key: `read_only`, or `read_write` for keys that may place and cancel orders. `null` on a bearer request. |
| `user_id` | uuid | Your user id. Substitute this into account channel topics such as `orders:{user_id}`. |
