# dev.knotless.inviteToOrg

> Published by [lexicons.knotless.dev](https://lexicon.garden/identity/did:plc:yqsg7znbbhfmj3a2nrpnaerk)

✓ This is the authoritative definition for this NSID.

## Description

Invites an account to an organization as the account logged in to this appview's pages, or changes its role, as `knotless org add` does.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.inviteToOrg)
- [Documentation](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.inviteToOrg/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:yqsg7znbbhfmj3a2nrpnaerk/dev.knotless.inviteToOrg/examples)

## Definitions

### `dev.knotless.inviteToOrg`

**Type**: `procedure`

As the organization itself, or one of its admins, asks the organization's gateway to name the account in its records (dev.knotless.putOrgMember). The first invitation an account makes makes it an organization, through the gateway it delegated writes to. The account is a member once it joins. Requires the session cookie the pages' login sets: the appview acts with the session it keeps for that account. Clients holding their own session call the organization's gateway themselves.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `member` | `string` (at-identifier) | Yes | The account to invite, by DID or handle. |
| `org` | `string` (did) | Yes | The organization. |
| `role` | `string` | No | What it may do: an admin also invites and removes members. Member when absent. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `warning` | `string` | No | Set when the change was made only in part, saying what is left. |

#### Errors

- **InvalidRequest**: The change was refused: by the organization's gateway, or as the account may not make it.
- **AuthenticationRequired**: No account is logged in to the pages, or its session has ended.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "As the organization itself, or one of its admins, asks the organization's gateway to name the account in its records (dev.knotless.putOrgMember). The first invitation an account makes makes it an organization, through the gateway it delegated writes to. The account is a member once it joins. Requires the session cookie the pages' login sets: the appview acts with the session it keeps for that account. Clients holding their own session call the organization's gateway themselves.",
      "errors": [
        {
          "description": "The change was refused: by the organization's gateway, or as the account may not make it.",
          "name": "InvalidRequest"
        },
        {
          "description": "No account is logged in to the pages, or its session has ended.",
          "name": "AuthenticationRequired"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "member": {
              "description": "The account to invite, by DID or handle.",
              "format": "at-identifier",
              "type": "string"
            },
            "org": {
              "description": "The organization.",
              "format": "did",
              "type": "string"
            },
            "role": {
              "description": "What it may do: an admin also invites and removes members. Member when absent.",
              "knownValues": [
                "admin",
                "member"
              ],
              "maxLength": 64,
              "type": "string"
            }
          },
          "required": [
            "org",
            "member"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "warning": {
              "description": "Set when the change was made only in part, saying what is left.",
              "maxLength": 2000,
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "description": "Invites an account to an organization as the account logged in to this appview's pages, or changes its role, as `knotless org add` does.",
  "id": "dev.knotless.inviteToOrg",
  "lexicon": 1
}
```
