# social.colibri.beta.community.createInvitation

> 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.community.createInvitation)
- [Documentation](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.community.createInvitation/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:mprdjqjluoswa7awzggaggj3/social.colibri.beta.community.createInvitation/examples)

## Definitions

### `social.colibri.beta.community.createInvitation`

**Type**: `procedure`

Creates an invitation code for a community.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `maxUses` | `integer` | No | How many times the invitation may be redeemed, if limited. |
| `community` | `string` (did) | Yes | The community to create an invitation for. |
| `expiresAt` | `string` (datetime) | No | When the invitation stops being redeemable, if ever. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `invitation` | `ref` → `social.colibri.beta.community.defs#invitationView` | Yes | The newly created invitation. |

#### Errors

- **AuthRequired**: The request is missing, malformed, or unverifiable service auth.
- **Forbidden**: The requesting user lacks the invitation.create permission.
- **CommunityNotFound**: No community exists with that DID.

## Raw Schema

```json
{
  "id": "social.colibri.beta.community.createInvitation",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "community"
          ],
          "properties": {
            "maxUses": {
              "type": "integer",
              "minimum": 1,
              "description": "How many times the invitation may be redeemed, if limited."
            },
            "community": {
              "type": "string",
              "format": "did",
              "description": "The community to create an invitation for."
            },
            "expiresAt": {
              "type": "string",
              "format": "datetime",
              "description": "When the invitation stops being redeemable, if ever."
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "AuthRequired",
          "description": "The request is missing, malformed, or unverifiable service auth."
        },
        {
          "name": "Forbidden",
          "description": "The requesting user lacks the invitation.create permission."
        },
        {
          "name": "CommunityNotFound",
          "description": "No community exists with that DID."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "invitation"
          ],
          "properties": {
            "invitation": {
              "ref": "social.colibri.beta.community.defs#invitationView",
              "type": "ref",
              "description": "The newly created invitation."
            }
          }
        },
        "encoding": "application/json"
      },
      "description": "Creates an invitation code for a community."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
