# social.colibri.beta.bridge.redeemPairing

> Published by [colibri.social](https://lexicon.garden/identity/did:plc:mprdjqjluoswa7awzggaggj3)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.bridge.redeemPairing)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.bridge.redeemPairing/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.bridge.redeemPairing/examples)

## Definitions

### `social.colibri.beta.bridge.redeemPairing`

**Type**: `procedure`

Connects a bridge to a community by redeeming its pairing code. Writes a registration with no linked channels.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `code` | `string` | Yes | The pairing code. |
| `community` | `string` (did) | Yes | The community to connect the bridge to. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `registration` | `ref` → `social.colibri.beta.bridge.defs#registrationView` | Yes | The registration. |

#### Errors

- **AuthRequired**: The request is missing, malformed, or unverifiable service auth.
- **Forbidden**: The caller lacks the community.manage permission.
- **CommunityNotFound**: No community exists at the given DID.
- **PairingNotFound**: The code does not exist, has expired, or was already used.
- **AlreadyRegistered**: This bridge is already connected to the same remote space in this community.
- **CredentialsUnavailable**: The AppView cannot act as the community because its stored credentials are missing or unusable.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Connects a bridge to a community by redeeming its pairing code. Writes a registration with no linked channels.",
      "errors": [
        {
          "description": "The request is missing, malformed, or unverifiable service auth.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller lacks the community.manage permission.",
          "name": "Forbidden"
        },
        {
          "description": "No community exists at the given DID.",
          "name": "CommunityNotFound"
        },
        {
          "description": "The code does not exist, has expired, or was already used.",
          "name": "PairingNotFound"
        },
        {
          "description": "This bridge is already connected to the same remote space in this community.",
          "name": "AlreadyRegistered"
        },
        {
          "description": "The AppView cannot act as the community because its stored credentials are missing or unusable.",
          "name": "CredentialsUnavailable"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "code": {
              "description": "The pairing code.",
              "maxLength": 32,
              "type": "string"
            },
            "community": {
              "description": "The community to connect the bridge to.",
              "format": "did",
              "type": "string"
            }
          },
          "required": [
            "community",
            "code"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "registration": {
              "description": "The registration.",
              "ref": "social.colibri.beta.bridge.defs#registrationView",
              "type": "ref"
            }
          },
          "required": [
            "registration"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.colibri.beta.bridge.redeemPairing",
  "lexicon": 1
}
```
