> 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 locale POST https://api.contentful.com/spaces/{space_id}/environments/{environment_id}/locales Content-Type: application/vnd.contentful.management.v1+json Use this endpoint to create a new locale for the specified space. You cannot create two locales with the same locale code. Reference: https://contentful.com/developers/docs/references/content-management-api/locales/create-a-locale ## 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 - `environment_id` (string, required) — ID of the environment in form of a string ### 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-09-21T13:03:32.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-09-21T13:03:32.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("") .setSpaceId("") .setEnvironmentId("") .build(); final CMALocale locale = new CMALocale() .setName("") .setId(""); client .locales() .async() .create( locale, new CMACallback() { @Override protected void onSuccess(CMALocale newLocale) { new AlertDialog.Builder(context) .setTitle("Contentful Success") .setMessage("New locale created." + "\n\nResult: " + newLocale) .show(); } @Override protected void onFailure(RuntimeException exception) { new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Could not create a new locale." + "\n\nReason: " + exception.toString()) .show(); super.onFailure(exception); } } ); ``` ```java Java // Create the Contentful client. final CMAClient client = new CMAClient .Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build(); final CMALocale locale = new CMALocale() .setCode("code") .setName("name"); final CMALocale newLocale = client .locales() .create(locale); // new locale created, do something with it ``` ```kotlin Kotlin // Create the Contentful client. val client = CMAClient.Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build() val locale = CMALocale() .setCode("code") .setName("name") val newLocale = client .locales() .create(locale) // new locale created, do something with it ``` ```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' }) // Create locale client.getSpace('') .then((space) => space.getEnvironment('')) .then((environment) => environment.createLocale({ name: 'German (Austria)', code: 'de-AT', fallbackCode: 'de-DE', optional: true })) .then((locale) => console.log(locale)) .catch(console.error) ``` ```javascript JavaScript import { createClient } from 'contentful-management' // Client init const client = contentful.createClient({ accessToken: '' }) const locale = await client.locale.create( { spaceId: '', environmentId: '', }, { name: 'German (Austria)', code: 'de-AT', fallbackCode: 'de-DE', optional: true, } ); ``` ```php PHP $client = new \Contentful\Management\Client(''); $environment = $client->getEnvironmentProxy('', ''); $locale = new \Contentful\Management\Resource\Locale( 'Italian', // Locale name 'it-IT', // Locale code 'en-US' // Fallback code ); $environment->create($locale); ``` ```ruby Ruby require 'contentful/management' client = Contentful::Management::Client.new('') locale = client.locales('', '').create( name: 'Spanglish', code: 'es-US' ) ``` ```python Python from contentful_management import Client client = Client('') locale = client.locales('', '').create({ 'name': 'Spanglish', 'code': 'es-EN', 'fallbackCode': 'en-US', 'optional': True, 'contentDeliveryApi': True, 'contentManagementApi': True }) ``` ```.net .NET // This client should only be created once per application. var httpClient = new HttpClient(); var client = new ContentfulManagementClient(httpClient, "", ""); var newLocale = new Local() { Name = "Swenglish", // The name of the locale Code = "en-SV", // The code of the locale, can be an arbitrary string FallbackCode = "en-GB", // The code of the locale to fallback to if this locale is missing a translation for a given field Optional = true, // Whether this locale allows for empty required fields, this is important to allow a locale to fallback to another locale if missing ContentDeliveryApi = true, // Whether this locale should be enabled in the API response for the delivery api ContentManagementApi = true // Whether this locale should be visible in the management api }; await client.CreateLocale(locale); ```