> 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 or update an environment alias PUT https://api.contentful.com/spaces/{space_id}/environment_aliases/{environment_alias_id} Content-Type: application/vnd.contentful.management.v1+json Creates a new environment alias or changes the environment it references. When updating, include the current alias version in `X-Contentful-Version`. Reference: https://contentful.com/developers/docs/references/content-management-api/environment-aliases/create-or-update-an-environment-alias ## 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 the form of a string - `environment_alias_id` (string, required) — ID of the environment alias in form of a string ### Headers - `X-Contentful-Version` (string, optional) — Version of the environment alias 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 { "environment": { "sys": { "id": "staging", "linkType": "Environment", "type": "Link" } } } ``` **Response** ```json { "environment": { "sys": { "id": "staging", "linkType": "Environment", "type": "Link" } }, "sys": { "id": "development", "space": { "sys": { "id": "yadj1kx9rmg0", "linkType": "Space", "type": "Link" } }, "type": "Environment Alias", "version": 2 } } ``` **SDK Code** ```android Android SDK currently doesn't implement this endpoint. ``` ```java Java SDK currently doesn't implement this endpoint. ``` ```kotlin Kotlin SDK currently doesn't implement this endpoint. ``` ```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.getEnvironmentAlias('')) .then((alias) => { alias.environment.sys.id = '' return alias.update() }) .then((alias) => console.log(`alias ${alias.sys.id} updated.`)) .catch(console.error) ``` ```javascript JavaScript import { createClient } from 'contentful-management' // Client init const client = contentful.createClient({ accessToken: '' }) const environmentAlias = await client.environmentAlias.createWithId( { spaceId: '', environmentAliasId: '', }, { environment: { sys: { type: 'Link', linkType: 'Environment', id: '', }, }, } ); ``` ```php PHP SDK currently doesn't implement this endpoint. ``` ```ruby Ruby SDK currently doesn't implement this endpoint. ``` ```python Python SDK currently doesn't implement this endpoint. ``` ```.net .NET SDK currently doesn't implement this endpoint. ```