# dev.knotless.uploadImage

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

✓ This is the authoritative definition for this NSID.

## Description

Uploads a picture to show in a pull, an issue or a comment, as the account logged in to this appview's pages.

## Links

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

## Definitions

### `dev.knotless.uploadImage`

**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, as `knotless issue --image` does: one over 1,000,000 bytes is drawn again as a JPEG that fits, at most 2000 pixels on its longest side. Its PDS keeps it only once a record attaches it: give it as one of dev.knotless.createIssue's, createPull's, createComment's or editItem's `images`, with a body linking to `url`. Requires the session cookie the pages' login sets.

#### Input

**Encoding**: `*/*`

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `blob` | `blob` | Yes | The picture as uploaded, to attach. |
| `url` | `string` (uri) | Yes | Where its account's PDS serves it, for the body to link to. |

#### Errors

- **NotFound**: No such repository.
- **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, as `knotless issue --image` does: one over 1,000,000 bytes is drawn again as a JPEG that fits, at most 2000 pixels on its longest side. Its PDS keeps it only once a record attaches it: give it as one of dev.knotless.createIssue's, createPull's, createComment's or editItem's `images`, with a body linking to `url`. Requires the session cookie the pages' login sets.",
      "errors": [
        {
          "description": "No such repository.",
          "name": "NotFound"
        },
        {
          "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": {
          "properties": {
            "blob": {
              "accept": [
                "image/png",
                "image/jpeg",
                "image/webp",
                "image/gif"
              ],
              "description": "The picture as uploaded, to attach.",
              "maxSize": 1000000,
              "type": "blob"
            },
            "url": {
              "description": "Where its account's PDS serves it, for the body to link to.",
              "format": "uri",
              "type": "string"
            }
          },
          "required": [
            "blob",
            "url"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "repo": {
            "description": "The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it, whose pull, issue or comment will show it.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "repo"
        ],
        "type": "params"
      },
      "type": "procedure"
    }
  },
  "description": "Uploads a picture to show in a pull, an issue or a comment, as the account logged in to this appview's pages.",
  "id": "dev.knotless.uploadImage",
  "lexicon": 1
}
```
