# social.colibri.beta.thread.create

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

## Definitions

### `social.colibri.beta.thread.create`

**Type**: `procedure`

Opens a thread beside a text channel. This creates a space for the thread, then writes the thread's configuration record at key 'self' inside it. The anchor message is referenced rather than copied, so it stays in its author's repo in the channel where it was written.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `anchor` | `ref` → `social.colibri.beta.defs#spaceRecordRef` | No | The message to open the thread from. Absent opens a thread from scratch, which has no marker in the channel river and is reachable from the channel's thread list and the sidebar. |
| `channel` | `string` (space-ref) | Yes | The text channel to open the thread beside. |
| `community` | `string` (did) | Yes | The community the thread's channel belongs to. |
| `name` | `string` | Yes | The thread's title. |
| `visibleToMembers` | `array` | No | Members that may read this thread beyond visibleToRoles. |
| `visibleToRoles` | `array` | No | Roles that may read this thread. Empty means everyone who may read the channel may read the thread. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `thread` | `ref` → `social.colibri.beta.thread.defs#threadView` | Yes | The thread. |

#### Errors

- **AuthRequired**: The request has no valid service auth.
- **Forbidden**: The requesting user lacks the thread.create permission or may not post in the channel.
- **CommunityNotFound**: No community matches the given DID.
- **ChannelNotFound**: No channel matches the given space reference.
- **MessageNotFound**: The anchor message does not exist in the given channel.
- **RoleHierarchy**: The requesting user cannot grant a role that outranks their own.
- **InvalidRequest**: The arguments are inconsistent or malformed beyond schema validation.
- **CredentialsUnavailable**: The AppView cannot act as the community because its stored credentials are missing or unusable.
- **PdsUnavailable**: The community's PDS is unreachable or the AppView has no administrative access to it.
- **UpstreamFailure**: The community's PDS failed while creating the thread's space.

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Opens a thread beside a text channel. This creates a space for the thread, then writes the thread's configuration record at key 'self' inside it. The anchor message is referenced rather than copied, so it stays in its author's repo in the channel where it was written.",
      "errors": [
        {
          "description": "The request has no valid service auth.",
          "name": "AuthRequired"
        },
        {
          "description": "The requesting user lacks the thread.create permission or may not post in the channel.",
          "name": "Forbidden"
        },
        {
          "description": "No community matches the given DID.",
          "name": "CommunityNotFound"
        },
        {
          "description": "No channel matches the given space reference.",
          "name": "ChannelNotFound"
        },
        {
          "description": "The anchor message does not exist in the given channel.",
          "name": "MessageNotFound"
        },
        {
          "description": "The requesting user cannot grant a role that outranks their own.",
          "name": "RoleHierarchy"
        },
        {
          "description": "The arguments are inconsistent or malformed beyond schema validation.",
          "name": "InvalidRequest"
        },
        {
          "description": "The AppView cannot act as the community because its stored credentials are missing or unusable.",
          "name": "CredentialsUnavailable"
        },
        {
          "description": "The community's PDS is unreachable or the AppView has no administrative access to it.",
          "name": "PdsUnavailable"
        },
        {
          "description": "The community's PDS failed while creating the thread's space.",
          "name": "UpstreamFailure"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "anchor": {
              "description": "The message to open the thread from. Absent opens a thread from scratch, which has no marker in the channel river and is reachable from the channel's thread list and the sidebar.",
              "ref": "social.colibri.beta.defs#spaceRecordRef",
              "type": "ref"
            },
            "channel": {
              "description": "The text channel to open the thread beside.",
              "format": "space-ref",
              "type": "string"
            },
            "community": {
              "description": "The community the thread's channel belongs to.",
              "format": "did",
              "type": "string"
            },
            "name": {
              "description": "The thread's title.",
              "maxLength": 128,
              "minLength": 1,
              "type": "string"
            },
            "visibleToMembers": {
              "description": "Members that may read this thread beyond visibleToRoles.",
              "items": {
                "description": "A member.",
                "format": "did",
                "type": "string"
              },
              "type": "array"
            },
            "visibleToRoles": {
              "description": "Roles that may read this thread. Empty means everyone who may read the channel may read the thread.",
              "items": {
                "description": "A role.",
                "format": "record-key",
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "community",
            "channel",
            "name"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "thread": {
              "description": "The thread.",
              "ref": "social.colibri.beta.thread.defs#threadView",
              "type": "ref"
            }
          },
          "required": [
            "thread"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "social.colibri.beta.thread.create",
  "lexicon": 1
}
```
