> 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.

# Update a locale

PUT https://api.contentful.com/spaces/{space_id}/environments/{environment_id}/locales/{locale_id}
Content-Type: application/vnd.contentful.management.v1+json

Updates a locale in a space; include the current version in `X-Contentful-Version`. Changing a locale's `code` affects all future API responses and is not allowed on locales used as fallbacks.

Reference: https://contentful.com/developers/docs/references/content-management-api/locales/update-a-locale

## Authentication

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

## Request

### Path parameters

- `space_id` (string, required) — ID of the Space in form of a string
- `environment_id` (string, required) — ID of the environment in form of a string
- `locale_id` (string, required) — ID of the Locale in form of a string

### Headers

- `X-Contentful-Version` (string, required) — Version of the locale to update

### 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
{
  "code": "en-US",
  "fallbackCode": "en-US",
  "name": "English (United States)",
  "optional": false
}
```

**Response**

```json
{
  "code": "en-US",
  "contentDeliveryApi": true,
  "contentManagementApi": true,
  "default": false,
  "fallbackCode": "en-US",
  "name": "English (United States)",
  "optional": false,
  "sys": {
    "createdAt": "2025-07-13T03:17:24.000Z",
    "createdBy": {
      "sys": {
        "id": "7BslKh9TdKGOK41VmLDjFZ",
        "linkType": "User",
        "type": "Link"
      }
    },
    "environment": {
      "sys": {
        "id": "staging",
        "linkType": "Environment",
        "type": "Link"
      }
    },
    "id": "34N35DoyUQAtaKwWTgZs34",
    "space": {
      "sys": {
        "id": "yadj1kx9rmg0",
        "linkType": "Space",
        "type": "Link"
      }
    },
    "type": "Locale",
    "updatedAt": "2025-07-13T03:17:24.000Z",
    "updatedBy": {
      "sys": {
        "id": "4FLrUHftHW3v2BLi9fzfjU",
        "linkType": "User",
        "type": "Link"
      }
    },
    "version": 1
  }
}
```

**SDK Code**

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

client
    .locales()
    .async()
    .fetchOne(
        "<locale_id>",
        new CMACallback<CMALocale>() {
          @Override protected void onSuccess(CMALocale locale) {
            locale.setName("new name is new");

            client
                .locales()
                .async()
                .update(
                    locale,
                    new CMACallback<CMALocale>() {
                      @Override protected void onSuccess(CMALocale locale) {
                        new AlertDialog.Builder(context)
                            .setTitle("Contentful Error")
                            .setMessage("Updating successful. New locale: "
                                + locale)
                            .show();

                      }
                    }
                );
          }

          @Override protected void onFailure(RuntimeException exception) {
            // An error occurred! Inform the user.
            new AlertDialog.Builder(context)
                .setTitle("Contentful Error")
                .setMessage("Could not find a locale to be deleted." +
                    "\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();

final CMALocale locale = client
    .locales()
    .fetchOne("<locale_id>");

locale.setName(locale.getName() + " and a new name");

client
    .locales()
    .update(locale);
```

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

val locale = client
        .locales()
        .fetchOne("<locale_id>")

locale.name = locale.name + " and a new name"

client
        .locales()
        .update(locale)
```

```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.getSpace('<space_id>')
.then((space) => space.getEnvironment('<environment_id>'))
.then((environment) => environment.getLocale('<locale_id>'))
.then((locale) => {
  locale.name = 'New locale name'
  return locale.update()
})
.then((locale) => console.log(`Locale ${locale.sys.id} updated.`))
.catch(console.error)
```

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

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

let locale = await client.locale.get({
  spaceId: '<space_id>',
  environmentId: '<environment_id>',
  localeId: 'en-US',
});

locale = await client.locale.update(
  {
    spaceId: '<space_id>',
    environmentId: '<environment_id>',
    localeId: 'en-US',
  },
  {
    ...locale,
    name: 'English (US)',
  }
);
```

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

$environment = $client->getEnvironmentProxy('<space_id>', '<environment_id>');

$locale = $environment->getLocale('<locale_id>');

$locale->setName('New locale name');
$locale->update();
```

```ruby Ruby
require 'contentful/management'

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

locale = client.locales('<space_id>', '<environment_id>').find('<locale_id>')

locale.name = 'Engspan'
locale.save
```

```python Python
from contentful_management import Client

client = Client('<content_management_api_key>')

locale = client.locales('<space_id>', '<environment_id>').find('<locale_id>')
locale.name = 'Not so english'
locale.save()
```

```.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 localeToUpdate = await client.GetLocale("<locale_id>");
localeToUpdate.Name = "Updated!";

var locale = await client.UpdateLocale(localeToUpdate);
```