# dev.knotless.getAttachment

> A blob a dev.knotless.pull, dev.knotless.issue or dev.knotless.comment record attaches, of any kind in its `attachments`, from its author's PDS, or for a private repository from their repo in its space: only one the record names. Served so that a browser never runs it as a page, with the type its record gives when that is one shown safely, and the same for good. dev.knotless.getThread's `html` shows its pictures from here. Anyone may ask for a public repository's, and the answer is the same for good. A private repository's is read as the account asking, by its session cookie or service token, or by a `token` in their place, as dev.knotless.defs#attachmentView's `url` carries one; read with a token, the answer is kept by no shared cache, nor by theirs past the token's life.

- Kind: query
- Authority: knotless.dev
- Lexicon: 1
- Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getAttachment)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getAttachment/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.getAttachment/analytics)

## Query (`dev.knotless.getAttachment`)

Type: query · GET

### Parameters (query string)

- `cid` (string · cid, required): The attached blob.
- `repo` (string · at-uri, required): The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.
- `token` (string): A token this appview signed for the account that asked dev.knotless.getThread, for this one blob of this record in this repository, standing in for that account's cookie or service token. Refused once expired, about an hour after, or once that account logs out here.
- `uri` (string · at-uri, required): The pull, issue or comment.

### Output (*/*)


### Errors

- `NotFound`: No such repository, record, or blob it attaches.
- `AuthenticationRequired`: The token is not one this appview signed for this blob, has expired, or its account has logged out here.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A blob a dev.knotless.pull, dev.knotless.issue or dev.knotless.comment record attaches, of any kind in its `attachments`, from its author's PDS, or for a private repository from their repo in its space: only one the record names. Served so that a browser never runs it as a page, with the type its record gives when that is one shown safely, and the same for good. dev.knotless.getThread's `html` shows its pictures from here. Anyone may ask for a public repository's, and the answer is the same for good. A private repository's is read as the account asking, by its session cookie or service token, or by a `token` in their place, as dev.knotless.defs#attachmentView's `url` carries one; read with a token, the answer is kept by no shared cache, nor by theirs past the token's life.",
      "errors": [
        {
          "description": "No such repository, record, or blob it attaches.",
          "name": "NotFound"
        },
        {
          "description": "The token is not one this appview signed for this blob, has expired, or its account has logged out here.",
          "name": "AuthenticationRequired"
        }
      ],
      "output": {
        "encoding": "*/*"
      },
      "parameters": {
        "properties": {
          "cid": {
            "description": "The attached blob.",
            "format": "cid",
            "type": "string"
          },
          "repo": {
            "description": "The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.",
            "format": "at-uri",
            "type": "string"
          },
          "token": {
            "description": "A token this appview signed for the account that asked dev.knotless.getThread, for this one blob of this record in this repository, standing in for that account's cookie or service token. Refused once expired, about an hour after, or once that account logs out here.",
            "type": "string"
          },
          "uri": {
            "description": "The pull, issue or comment.",
            "format": "at-uri",
            "type": "string"
          }
        },
        "required": [
          "repo",
          "uri",
          "cid"
        ],
        "type": "params"
      },
      "type": "query"
    }
  },
  "description": "Something a pull, an issue or a comment attaches, such as a picture its body shows.",
  "id": "dev.knotless.getAttachment",
  "lexicon": 1
}
```
