{
  "$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
}
