> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://contentful.com/developers/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/developers/docs/_mcp/server.

# Create a space

POST https://api.contentful.com/spaces
Content-Type: application/vnd.contentful.management.v1+json

Create a new space, specifying attributes in the request body. You can optionally pass a `productId` to assign a specific product (from your organization's available licenses) to the new space.

Reference: https://contentful.com/developers/docs/references/content-management-api/spaces/create-a-space

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Headers

- `X-Contentful-Organization` (string, optional) — Organization ID to create the space under

### Body (application/vnd.contentful.management.v1+json)

This endpoint expects a map from string to any.

- `map from string to any`

## Response

### 201

Created - Resource created successfully

- `map from string to any`

## Examples

**Request**

```json
{
  "defaultLocale": "en",
  "name": "Example Space",
  "productId": "<product_id>"
}
```

**Response**

```json
{
  "name": "Contentful Example API",
  "sys": {
    "createdAt": "2025-06-04T11:58:18.000Z",
    "createdBy": {
      "sys": {
        "id": "7BslKh9TdKGOK41VmLDjFZ",
        "linkType": "User",
        "type": "Link"
      }
    },
    "id": "yadj1kx9rmg0",
    "organization": {
      "sys": {
        "id": "0D9ZC8rLWiw6x5qizZGiRs",
        "linkType": "Organization",
        "type": "Link"
      }
    },
    "type": "Space",
    "updatedAt": "2025-06-24T08:06:46.000Z",
    "updatedBy": {
      "sys": {
        "id": "4FLrUHftHW3v2BLi9fzfjU",
        "linkType": "User",
        "type": "Link"
      }
    },
    "version": 3
  }
}
```

**SDK Code**

```android Android
// Create the Contentful client.
final CMAClient client =
    new CMAClient
        .Builder()
        .setAccessToken("<access_token>")
        .setSpaceId("<space_id>")
        .setEnvironmentId("<environment_id>")
        .build();

// Create a new space on Contentful. Add an organization id,
// if you want to add it to a specific organization.
client
    .spaces()
    .async()
    .create(
        "My new space",
        new CMACallback<CMASpace>() {
          @Override protected void onSuccess(CMASpace space) {
            // Done.
            new AlertDialog.Builder(context)
                .setTitle("Contentful")
                .setMessage("Creation of a space was successful." +
                    "\n\nResult: " + space)
                .show();
          }

          @Override protected void onFailure(RuntimeException exception) {
            // An error occurred! Inform the user.
            new AlertDialog.Builder(context)
                .setTitle("Contentful Error")
                .setMessage("Could not create a space." +
                    "\n\nReason: " + exception.toString())
                .show();

            super.onFailure(exception);
          }
        });
```

```java Java
// Create the Contentful client.
final CMAClient client =
    new CMAClient
        .Builder()
        .setAccessToken("<access_token>")
        .setSpaceId("<space_id>")
        .setEnvironmentId("<environment_id>")
        .build();

// Create a new space on Contentful. Add an organization id,
// if you want to add it to a specific organization.
final CMASpace space = client
    .spaces()
    .create("My new space");
```

```kotlin Kotlin
// Create the Contentful client.
val client = CMAClient.Builder()
    .setAccessToken("<access_token>")
    .setSpaceId("<space_id>")
    .setEnvironmentId("<environment_id>")
    .build()

// Create a new space on Contentful. Add an organization id,
// if you want to add it to a specific organization.
val space = client
        .spaces()
        .create("My new space")
```

```swift Swift
We currently don't provide a CMA SDK for this platform.
```

```js-legacy JavaScript (legacy)
import { createClient } from 'contentful-management'

const client = createClient({
  accessToken: '<content_management_api_key>'
}, { type: 'legacy' })

client.createSpace({
  name: 'Name of new space'
})
.then((space) => console.log(space))
.catch(console.error)
```

```javascript JavaScript
import { createClient } from 'contentful-management'

// Client init
const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

const space = await client.space.create(
  {
    organizationId: '<organization_id>',
  },
  {
    name: 'New space',
  }
);
```

```php PHP
$client = new \Contentful\Management\Client('<content_management_api_key>');

$space = new \Contentful\Management\Resource\Space(
  'Name of new space',
  '<organization_id>',
  '<default_locale>' // Optional
);

$client->create($space);
```

```ruby Ruby
require 'contentful/management'

client = Contentful::Management::Client.new('<content_management_api_key>')

space = client.spaces.create(
  name: 'Name of new space',
  default_locale: '<default_locale>'
)
```

```python Python
from contentful_management import Client

client = Client('<content_management_api_key>')

space = client.spaces().create({
    'name': 'Name of new space',
    'defaultLocale': '<default_locale>'
})
```

```.net .NET
// This client should only be created once per application.
var httpClient = new HttpClient();

var client = new ContentfulManagementClient(httpClient, "<content_management_api_key>", "<space_id>");

var space = await client.CreateSpace("<space_name>", "<default_locale>", "<organization_id>");
```