> 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. # Update a space name PUT https://api.contentful.com/spaces/{space_id} Content-Type: application/vnd.contentful.management.v1+json Updates a space; send attributes as a JSON payload and include `X-Contentful-Version`. `X-Contentful-Organization` is optional if the account belongs to only one organization. Reference: https://contentful.com/developers/docs/references/content-management-api/spaces/update-a-space-name ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `space_id` (string, required) — ID of the Space in form of a string ### Headers - `X-Contentful-Organization` (string, optional) — Organization ID to create the space under - `X-Contentful-Version` (string, required) — Version of the space to update ### Body (application/vnd.contentful.management.v1+json) This endpoint expects a map from string to any. - `map from string to any` ## Response ### 200 OK - Request successful - `map from string to any` ## Examples **Request** ```json { "name": "Hyper Space" } ``` **Response** ```json { "name": "Contentful Example API", "sys": { "createdAt": "2025-05-06T11:29:32.000Z", "createdBy": { "sys": { "id": "7BslKh9TdKGOK41VmLDjFZ", "linkType": "User", "type": "Link" } }, "id": "yadj1kx9rmg0", "organization": { "sys": { "id": "0D9ZC8rLWiw6x5qizZGiRs", "linkType": "Organization", "type": "Link" } }, "type": "Space", "updatedAt": "2025-07-02T20:20:11.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(); // First: Fetch a space from Contentful. client .spaces() .async() .fetchOne( "", new CMACallback() { @Override protected void onSuccess(CMASpace space) { // Second: Update name. space .setName( space.getName() + " Changed" ); // Third: Update Contentful. client .spaces() .async() .update( space, new CMACallback() { @Override protected void onSuccess(CMASpace result) { // Updated. new AlertDialog.Builder(context) .setTitle("Contentful") .setMessage("Update of a space was successful." + "\n\nResult: " + result) .show(); } @Override protected void onFailure(RuntimeException exception) { // An error occurred! Inform the user. new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Could not update a space." + "\n\nReason: " + exception.toString()) .show(); super.onFailure(exception); } } ); } @Override protected void onFailure(RuntimeException exception) { // An error occurred! Inform the user. new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Could not fetch 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(); // First: Fetch a space from Contentful. final CMASpace space = client .spaces() .fetchOne(""); // Second: Update name. space .setName( space.getName() + " Changed" ); // Third: Update Contentful. client .spaces() .update(space); ``` ```kotlin Kotlin // Create the Contentful client. val client = CMAClient.Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build() // First: Fetch a space from Contentful. val space = client .spaces() .fetchOne("") // Second: Update name. space.name = space.name + " Changed" // Third: Update Contentful. client .spaces() .update(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.getSpace('') .then((space) => { space.name = 'New name' return space.update() }) .then((space) => console.log(`Space ${space.sys.id} renamed.`)) .catch(console.error) ``` ```javascript JavaScript import { createClient } from 'contentful-management' // Client init const client = contentful.createClient({ accessToken: '' }) let space = await client.space.get({ spaceId: '', }); space = await client.space.update( { spaceId: '', }, { ...space.sys, name: 'New name' } ); ``` ```php PHP $client = new \Contentful\Management\Client(''); $space = $client->getSpace(''); $space->setName('New name'); $space->update(); ``` ```ruby Ruby require 'contentful/management' client = Contentful::Management::Client.new('') space = client.spaces.find('') space.name = 'New name' space.save ``` ```python Python from contentful_management import Client client = Client('') space = client.spaces().find('') space.name = 'New name' space.save() ``` ```.net .NET // This client should only be created once per application. var httpClient = new HttpClient(); var client = new ContentfulManagementClient(httpClient, "", ""); var version = 5; await client.UpdateSpaceName("", "", version); ```