---
title: "Create a space"
---

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

# Create a space

Path: CloudRaker Workspace API › Workspace Spaces

`POST /space-types/{spaceTypeId}/spaces`

Creates a space under the space type named in the path. Authorization: requires `spacetype:contribute` on the parent space type; organization administrators bypass this check. A caller lacking the grant gets 403. Body: `title` (1–120 chars); the space id is a server-generated uuid. Returns 201 `{ space }`; 404 if the parent space type does not exist.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceTypeId` (`createSpace.path.spaceTypeId`; string, required)

## Request body

_Required._

- `title` (`createSpace.title`; string, required)
  - minLength 1; maxLength 120; example `"Legal"`

## Example request

```json
{
  "title": "Legal"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/space-types/<spaceTypeId>/spaces' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "Legal"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/space-types/<spaceTypeId>/spaces';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({title: 'Legal'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/space-types/<spaceTypeId>/spaces"

payload = { "title": "Legal" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 201

The created space.

#### Example

```json
{
  "space": {
    "id": "string",
    "title": "Acme MSA",
    "spaceType": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "updatedAt": "2019-08-24T14:15:22Z",
    "createdBy": "string",
    "expiresAt": "2019-08-24T14:15:22Z"
  }
}
```

- `space` (`createSpace.response.201.space`; object, required)
  - `id` (`createSpace.response.201.space.id`; string, required)
  - `title` (`createSpace.response.201.space.title`; string, required)
    - example `"Acme MSA"`
  - `spaceType` (`createSpace.response.201.space.spaceType`; string, required) — Identifier of the parent space type.
  - `createdAt` (`createSpace.response.201.space.createdAt`; string, required)
    - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
  - `updatedAt` (`createSpace.response.201.space.updatedAt`; string, required)
    - format `date-time`; pattern `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$`
  - `expiresAt` (`createSpace.response.201.space.expiresAt`; any of, required) — Deadline of an API-managed (`/v1`) space, after which it is closed and its files deleted. `null` for a space created in the app, which never expires.
    - any of: `string`, `null`
  - `createdBy` (`createSpace.response.201.space.createdBy`; string, optional)

### 400

Validation Error

#### Example

```json
{
  "success": false,
  "error": [
    null
  ],
  "data": null
}
```

- `success` (`createSpace.response.400.success`; boolean, required)
  - one of `false`
- `error` (`createSpace.response.400.error`; array<unknown>, required)
- `data` (`createSpace.response.400.data`; unknown, required)

### 404

`not_found` — the parent space type does not exist.


Source: https://docs.cloudraker.com/workspace/api/workspace-spaces/create-space/index.md
