{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Host-level: create a new group on this host. Authenticated as the founder (service auth from their PDS). The founder and any listed stewards become its first admins. Mints the group DID, creates the meta and members spaces, writes the bootstrap records and, for a discoverable group, a declaration. Modality spaces are left to the apps that use them (createSpace).",
      "errors": [
        {
          "description": "The handle is not one label under this host's handle domain.",
          "name": "InvalidHandle"
        },
        {
          "name": "HandleTaken"
        },
        {
          "description": "The PLC directory did not take the group's new DID.",
          "name": "AccountCreationFailed"
        },
        {
          "description": "This host only lets the people it names start groups, and the caller isn't one.",
          "name": "NotAllowed"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "description": {
              "maxGraphemes": 2000,
              "maxLength": 20000,
              "type": "string"
            },
            "displayName": {
              "maxGraphemes": 64,
              "maxLength": 640,
              "type": "string"
            },
            "handle": {
              "format": "handle",
              "type": "string"
            },
            "joinPolicy": {
              "description": "Defaults to approval.",
              "ref": "fyi.opensocial.defs#joinPolicy",
              "type": "ref"
            },
            "metaReadableBy": {
              "description": "Defaults to ['public'].",
              "items": {
                "ref": "fyi.opensocial.defs#audience",
                "type": "ref"
              },
              "type": "array"
            },
            "stewards": {
              "description": "Accounts that run the group alongside the founder, as admins from the start.",
              "items": {
                "ref": "fyi.opensocial.defs#accountRef",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "handle",
            "displayName"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "did": {
              "format": "did",
              "type": "string"
            },
            "members": {
              "format": "space-ref",
              "type": "string"
            },
            "meta": {
              "format": "space-ref",
              "type": "string"
            }
          },
          "required": [
            "did",
            "meta",
            "members"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "fyi.opensocial.createGroup",
  "lexicon": 1
}
