> 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/_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 `, 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": "" } ``` **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("") .setSpaceId("") .setEnvironmentId("") .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() { @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("") .setSpaceId("") .setEnvironmentId("") .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("") .setSpaceId("") .setEnvironmentId("") .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: '' }, { 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: '' }) const space = await client.space.create( { organizationId: '', }, { name: 'New space', } ); ``` ```php PHP $client = new \Contentful\Management\Client(''); $space = new \Contentful\Management\Resource\Space( 'Name of new space', '', '' // Optional ); $client->create($space); ``` ```ruby Ruby require 'contentful/management' client = Contentful::Management::Client.new('') space = client.spaces.create( name: 'Name of new space', default_locale: '' ) ``` ```python Python from contentful_management import Client client = Client('') space = client.spaces().create({ 'name': 'Name of new space', 'defaultLocale': '' }) ``` ```.net .NET // This client should only be created once per application. var httpClient = new HttpClient(); var client = new ContentfulManagementClient(httpClient, "", ""); var space = await client.CreateSpace("", "", ""); ```