# town.delve.membership.join

> Published by [delve.town](https://lexicon.garden/identity/did:plc:qzqct2rrq4u2gmy5g3mjxske)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:qzqct2rrq4u2gmy5g3mjxske/town.delve.membership.join)
- [Documentation](https://lexicon.garden/lexicon/did:plc:qzqct2rrq4u2gmy5g3mjxske/town.delve.membership.join/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:qzqct2rrq4u2gmy5g3mjxske/town.delve.membership.join/examples)

## Definitions

### `town.delve.membership.join`

**Type**: `procedure`

Join the town, or rejoin after withdrawing. An account hosted on the town's own PDS needs no code; any other account presents an invite code: either a town invite or a code a member took from Settings on the town's PDS, which the join then spends. Requires auth.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `inviteCode` | `string` | No |  |
| `revision` | `integer` | No | The membership revision the caller last saw; the join fails with MembershipChanged if it moved. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `membership` | `ref` → `town.delve.membership.defs#membership` | Yes |  |

#### Errors

- **InvalidInvite**: No valid invite for this account: missing, expired, spent, disabled, or bound to another account.
- **MembershipSuspended**
- **MembershipChanged**
- **MembershipDisabled**: This AppView does not admit accounts by membership.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Join the town, or rejoin after withdrawing. An account hosted on the town's own PDS needs no code; any other account presents an invite code: either a town invite or a code a member took from Settings on the town's PDS, which the join then spends. Requires auth.",
      "errors": [
        {
          "description": "No valid invite for this account: missing, expired, spent, disabled, or bound to another account.",
          "name": "InvalidInvite"
        },
        {
          "name": "MembershipSuspended"
        },
        {
          "name": "MembershipChanged"
        },
        {
          "description": "This AppView does not admit accounts by membership.",
          "name": "MembershipDisabled"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "inviteCode": {
              "maxLength": 128,
              "type": "string"
            },
            "revision": {
              "description": "The membership revision the caller last saw; the join fails with MembershipChanged if it moved.",
              "type": "integer"
            }
          },
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "membership": {
              "ref": "town.delve.membership.defs#membership",
              "type": "ref"
            }
          },
          "required": [
            "membership"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "town.delve.membership.join",
  "lexicon": 1
}
```
