# org.atgrp.requestJoin

> Request to join a group, optionally redeeming an invite. Admits the caller right away when the join policy is open or with a valid invite, and otherwise queues a request. Returns the caller's existing request or membership if they have one. Requires service auth.

- Kind: procedure
- Authority: atgrp.org
- Lexicon: 1
- Published by [lex.atgrp.org](https://lexicon.garden/identity/did:plc:4pt2cnpyvfgn5b7uxwn2shwv), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:4pt2cnpyvfgn5b7uxwn2shwv/org.atgrp.requestJoin)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:4pt2cnpyvfgn5b7uxwn2shwv/org.atgrp.requestJoin/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:4pt2cnpyvfgn5b7uxwn2shwv/org.atgrp.requestJoin/analytics)

## Procedure (`org.atgrp.requestJoin`)

Type: procedure · POST

### Input (application/json)

- `group` (string · did, required)
- `invite` (string · at-uri): An invite in the caller's inbox space.
- `message` (string): Shown to the group with the request.
  - Constraints: maxLength: 20000, maxGraphemes: 2000

### Output (application/json)

- `membership` (ref): Present when admitted.
  - Reference: `com.atproto.repo.strongRef#main`
- `request` (ref): Present when pending.
  - Reference: `org.atgrp.defs#joinRequest`
- `status` (string, required)
  - Constraints: knownValues: pending | admitted

### Errors

- `GroupNotFound`: No description in schema.
- `InvalidInvite`: No description in schema.
- `JoinClosed`: The group is invite-only.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Request to join a group, optionally redeeming an invite. Admits the caller right away when the join policy is open or with a valid invite, and otherwise queues a request. Returns the caller's existing request or membership if they have one. Requires service auth.",
      "errors": [
        {
          "name": "GroupNotFound"
        },
        {
          "name": "InvalidInvite"
        },
        {
          "description": "The group is invite-only.",
          "name": "JoinClosed"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "group": {
              "format": "did",
              "type": "string"
            },
            "invite": {
              "description": "An invite in the caller's inbox space.",
              "format": "at-uri",
              "type": "string"
            },
            "message": {
              "description": "Shown to the group with the request.",
              "maxGraphemes": 2000,
              "maxLength": 20000,
              "type": "string"
            }
          },
          "required": [
            "group"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "membership": {
              "description": "Present when admitted.",
              "ref": "com.atproto.repo.strongRef#main",
              "type": "ref"
            },
            "request": {
              "description": "Present when pending.",
              "ref": "org.atgrp.defs#joinRequest",
              "type": "ref"
            },
            "status": {
              "knownValues": [
                "pending",
                "admitted"
              ],
              "type": "string"
            }
          },
          "required": [
            "status"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "org.atgrp.requestJoin",
  "lexicon": 1
}
```
