# dev.knotless.putSubscription

> Chooses what the asking account hears of a repository, a pull or an issue, as the appview keeps it for that account alone: no record is written. A choice counts from when it is made, and choosing the level it has already keeps it as of then. Requires authentication: a service token, or the session cookie the pages' login sets, from the pages themselves.

- Kind: procedure
- 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.putSubscription)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.putSubscription/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.putSubscription/analytics)

## Procedure (`dev.knotless.putSubscription`)

Type: procedure · POST

### Input (application/json)

- `level` (string, required): For a repository: `all` it does, its `releases` alone, or `ignore` it. For a pull or an issue: `subscribed` to every comment, or `muted`. Either way, `participating` forgets the choice, so the account hears as its part in it says; but for the account's own repository, which it hears all of until it chooses, `participating` is kept as a choice.
  - Constraints: maxLength: 64, knownValues: participating | all | releases | ignore | subscribed | muted
- `subject` (string · at-uri, required): A repository's dev.knotless.repo record, or a dev.knotless.pull or dev.knotless.issue.

### Output (application/json)

- `schema` (ref)
  - Reference: `dev.knotless.listSubscriptions#subscription`

### Errors

- `InvalidRequest`: A subject that is no repository, pull or issue, a level it cannot take, or more choices than the appview keeps for one account.
- `AuthenticationRequired`: No account asks.
- `NotFound`: No such repository the account can read, or this appview keeps no index.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Chooses what the asking account hears of a repository, a pull or an issue, as the appview keeps it for that account alone: no record is written. A choice counts from when it is made, and choosing the level it has already keeps it as of then. Requires authentication: a service token, or the session cookie the pages' login sets, from the pages themselves.",
      "errors": [
        {
          "description": "A subject that is no repository, pull or issue, a level it cannot take, or more choices than the appview keeps for one account.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account asks.",
          "name": "AuthenticationRequired"
        },
        {
          "description": "No such repository the account can read, or this appview keeps no index.",
          "name": "NotFound"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "level": {
              "description": "For a repository: `all` it does, its `releases` alone, or `ignore` it. For a pull or an issue: `subscribed` to every comment, or `muted`. Either way, `participating` forgets the choice, so the account hears as its part in it says; but for the account's own repository, which it hears all of until it chooses, `participating` is kept as a choice.",
              "knownValues": [
                "participating",
                "all",
                "releases",
                "ignore",
                "subscribed",
                "muted"
              ],
              "maxLength": 64,
              "type": "string"
            },
            "subject": {
              "description": "A repository's dev.knotless.repo record, or a dev.knotless.pull or dev.knotless.issue.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "subject",
            "level"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "ref": "dev.knotless.listSubscriptions#subscription",
          "type": "ref"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Chooses what the asking account hears of a repository, a pull or an issue.",
  "id": "dev.knotless.putSubscription",
  "lexicon": 1
}
```
