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

# useCreateSpace

Hook to create a space.

## Imports

```ts theme={null}
import { useCreateSpace } from '@towns-protocol/react-sdk'
```

## Definition

```ts theme={null}
function useCreateSpace(
  config?: ActionConfig<Spaces["createSpace"]>,
): {
    data: {
        spaceId: string;
        defaultChannelId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    createSpace: (params: Partial<Omit<CreateSpaceParams, "spaceName">> & {
        spaceName: string;
    }, signer: Signer) => Promise<{
        spaceId: string;
        defaultChannelId: string;
    }>;
}
```

**Source:** [useCreateSpace](https://github.com/towns-protocol/towns/blob/main/packages/react-sdk/src/useCreateSpace.ts)

## Parameters

### config

* **Type:** `ActionConfig<Spaces["createSpace"]>`
* **Optional**

Configuration options for the action.

## Return Type

The `createSpace` action and its loading state.

```ts theme={null}
{
    data: {
        spaceId: string;
        defaultChannelId: string;
    } | undefined;
    error: Error | undefined;
    isPending: boolean;
    isSuccess: boolean;
    isError: boolean;
    createSpace: (params: Partial<Omit<CreateSpaceParams, "spaceName">> & {
        spaceName: string;
    }, signer: Signer) => Promise<{
        spaceId: string;
        defaultChannelId: string;
    }>;
}
```
