# dev.knotless.uploadAvatar

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

Sets the picture of the account logged in to this appview's pages.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.uploadAvatar)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.uploadAvatar/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.uploadAvatar/examples)

## Definitions

### `dev.knotless.uploadAvatar`

**Type**: `procedure`

Uploads the body, a PNG, JPEG, WebP or GIF, as a blob of the account logged in to this appview's web pages, and names it as the picture of its dev.knotless.profile record, as `knotless profile --avatar` does: one that is not a PNG or JPEG, or is over 1,000,000 bytes, is drawn again as a JPEG that fits, at most 2000 pixels on its longest side. Requires the session cookie the pages' login sets: the appview writes with the session it keeps for that account.

#### Input

**Encoding**: `*/*`

#### Output

**Encoding**: `application/json`

#### Errors

- **InvalidRequest**: No picture, or one that is not a PNG, JPEG, WebP or GIF.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Uploads the body, a PNG, JPEG, WebP or GIF, as a blob of the account logged in to this appview's web pages, and names it as the picture of its dev.knotless.profile record, as `knotless profile --avatar` does: one that is not a PNG or JPEG, or is over 1,000,000 bytes, is drawn again as a JPEG that fits, at most 2000 pixels on its longest side. Requires the session cookie the pages' login sets: the appview writes with the session it keeps for that account.",
      "errors": [
        {
          "description": "No picture, or one that is not a PNG, JPEG, WebP or GIF.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        }
      ],
      "input": {
        "encoding": "*/*"
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "ref": "dev.knotless.getOwnProfile#ownProfile",
          "type": "ref"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Sets the picture of the account logged in to this appview's pages.",
  "id": "dev.knotless.uploadAvatar",
  "lexicon": 1
}
```
