# dev.knotless.unprotectBranch

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

✓ This is the authoritative definition for this NSID.

## Description

Stops protecting a branch of a repository.

## Links

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

## Definitions

### `dev.knotless.unprotectBranch`

**Type**: `procedure`

Takes the branch out of the protected branches of the repository's dev.knotless.repo record, as `knotless unprotect` does. Only its owner, logged in to this appview's web pages, can: the appview writes with the session it keeps for that account, which the pages' session cookie names.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `branch` | `string` | Yes | The branch, without refs/heads/. |
| `repo` | `string` (at-uri) | Yes | The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `rules` | `array` | Yes | The protected branches now. |

#### Errors

- **NotFound**: No such repository.
- **InvalidRequest**: The branch is not protected.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.
- **Forbidden**: The account logged in is not the repository's owner.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Takes the branch out of the protected branches of the repository's dev.knotless.repo record, as `knotless unprotect` does. Only its owner, logged in to this appview's web pages, can: the appview writes with the session it keeps for that account, which the pages' session cookie names.",
      "errors": [
        {
          "description": "No such repository.",
          "name": "NotFound"
        },
        {
          "description": "The branch is not protected.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        },
        {
          "description": "The account logged in is not the repository's owner.",
          "name": "Forbidden"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "branch": {
              "description": "The branch, without refs/heads/.",
              "maxLength": 255,
              "type": "string"
            },
            "repo": {
              "description": "The repository's dev.knotless.repo record, as dev.knotless.getRepo takes it.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "repo",
            "branch"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "rules": {
              "description": "The protected branches now.",
              "items": {
                "ref": "dev.knotless.repo#rule",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "rules"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Stops protecting a branch of a repository.",
  "id": "dev.knotless.unprotectBranch",
  "lexicon": 1
}
```
