> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Space

> Create a new community space

Creates a new space. The authenticated user is automatically added as an admin. Supports optional avatar and banner image upload via multipart form data.

## Body Parameters

**name** `string`

Display name for the space. Must be 3–100 characters.

**slug** `string`

Optional URL slug. Must be unique per project. Supports Unicode letters, numbers, hyphens, and underscores.

**description** `string`

Optional description. Up to 1,000 characters.

**readingPermission** `string`

Who may read content, for your app to enforce: `"anyone"` or `"members"`. Defaults to `"anyone"`. The v7 API reports it in `memberPermissions.canRead` but doesn't hide the content inside the space; see [Content inside a space](https://docs.sublay.io/v7/data-models/space.md#content-inside-a-space) and the [v8 rules](https://docs.sublay.io/v8/data-models/space.md#who-can-read-content).

**postingPermission** `string`

Who may post entities, for your app to enforce: `"anyone"`, `"members"`, or `"admins"`. Defaults to `"members"`. The v7 API reports it in `memberPermissions.canPost` but doesn't refuse entities that don't match it; see [Content inside a space](https://docs.sublay.io/v7/data-models/space.md#content-inside-a-space) and the [v8 rules](https://docs.sublay.io/v8/data-models/space.md#who-can-post-and-take-part).

**visibility** `string`

Who can find and see the space: `"public"`, `"unlisted"`, or `"private"`. Defaults to `"public"`. Independent of `readingPermission`. `"unlisted"` hides the space from discovery and search but keeps it reachable by direct link; `"private"` hides the space, and the spaces under it, from everyone except its active members — it answers `404` like a nonexistent space and can't be joined. The content inside it stays readable in v7; see [Content inside a space](https://docs.sublay.io/v7/data-models/space.md#content-inside-a-space) and the [v8 rules](https://docs.sublay.io/v8/data-models/space.md#who-can-read-content). See [Space visibility](https://docs.sublay.io/v7/data-models/space.md#visibility).

**requireJoinApproval** `boolean`

Whether new joins require approval. Defaults to `true`.

**metadata** `object`

Optional arbitrary key-value data. Up to 1 MB.

**parentSpaceId** `string`

Optional UUID of a parent space. The caller must be an admin of the parent space; when a service key creates the space for a user (`userId`), that user must be.

**avatarFile** `file`

Optional avatar image. Multipart form field. Requires `avatarFile.options` when provided.

**bannerFile** `file`

Optional banner image. Multipart form field. Requires `bannerFile.options` when provided.

## Response

Returns the created [Space](https://docs.sublay.io/v7/data-models/space.md) object with `membersCount`, `childSpacesCount`, and optional file associations.

## Error Responses

> [accordion] Auth Required — 401
>
> ```json theme={null}
> { "error": "Authentication required to create a space.", "code": "space/auth-required" }
> ```

> [accordion] Slug Taken — 409
>
> ```json theme={null}
> { "error": "A space with this slug already exists.", "code": "space/slug-taken" }
> ```

> [accordion] Parent Not Found — 404
>
> ```json theme={null}
> { "error": "Parent space not found.", "code": "space/parent-not-found" }
> ```

> [accordion] Parent Admin Required — 403
>
> ```json theme={null}
> { "error": "Only admins of the parent space can create child spaces.", "code": "space/parent-admin-required" }
> ```

> [accordion] Banned — 403
>
> The creator was banned in the parent space (or above) while the child space was being created.
>
> ```json theme={null}
> { "error": "You are banned from a parent of this space.", "code": "space/banned" }
> ```

> [accordion] Max Depth Exceeded — 400
>
> ```json theme={null}
> { "error": "Maximum nesting depth (10) exceeded.", "code": "space/max-depth-exceeded" }
> ```

> [accordion] File Too Large — 413
>
> ```json theme={null}
> { "code": "space/file-too-large", "message": "Avatar image exceeds 50MB limit." }
> ```

See also: [useCreateSpace](https://docs.sublay.io/v7/hooks/spaces/use-create-space.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.