Environments
Clone an environment
Create a clone of an existing environment. We recommend you work with the new environment only after the cloning is finished. Check the environment's cloning progress using API to know when the new environment is ready.By default, the new environment is:
- Cloned with assets and content items. You can include version history of up to 50 versions in your new environment. For a faster cloning experience, you can omit assets and content items or the version history.
- Accessible to project managers and the person who initiated the cloning process. If you want to give other users access to the new environment, specify
roles_to_activatewhen initiating the cloning.
POST
https://manage.kontent.ai/v2/projects/{environment_id}/clone-environmentRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Body schema
Application/json
Specify the environment's name and the roles that should be active in the new environment.
namerequired · string · 1-200 chars
The new environment's name.
roles_to_activate[]array
The user roles to activate specified by role ID. These roles will be activated in addition to the users with the Project manager role.
copy_data_optionsobject
Specifies what content to clone from the source environment.
Show child attributes
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.cloneEnvironment()
.withData({
name: 'Develop',
roles_to_activate: ['ee483b59-5a24-4010-b277-ae224c34bc71'],
copy_data_options: {
content_items_assets: true,
content_item_version_history: false,
},
})
.toPromise();
Response
Status (200)
The environment cloning has started.
idrequired · string
The new environment's internal ID.
management_api_keyrequired · string · jwt
The API key you can use to manage the new environment. This is the same API key as the one used to initiate the cloning.
secured_delivery_api_keystring · nullable · jwt
Deprecated
To retrieve published content from your newly created environment, use a Delivery API key that’s scoped to the new environment.
delivery_preview_api_keystring · nullable · jwt
Deprecated
To preview content from your newly created environment, use a Delivery API key that’s scoped to the new environment.
Example responses
200
400
{
"id": "71386f85-cddb-4cb0-aa54-988566feb9a1",
"management_api_key": "ey...",
"secured_delivery_api_key": "ey...",
"delivery_preview_api_key": "ey..."
}Get status of environment cloning
Retrieve the cloning status of the specified environment.
GET
https://manage.kontent.ai/v2/projects/{environment_id}/environment-cloning-stateRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client.getEnvironmentCloningState().toPromise();
Response
Status (200)
The cloning status of the specified environment.
cloning_staterequired · string
Specifies whether the environment has been cloned successfully.
Example responses
200
{
"cloning_state": "done"
}Retrieve environment information
Retrieve the ID and display name of your project's environment. Using this endpoint, you can also validate your Management API key.
GET
https://manage.kontent.ai/v2/projects/{environment_id}Request
Path parameters
environment_idrequired · string
Identifies your environment.
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client.environmentInformation().toPromise();
Response
Status (200)
Information about the specified environment.
idstring · uuid
The environment's ID.
namestring
The project's display name.
environmentstring · 1-200 chars
The environment's display name.
is_productionboolean
Determines whether the project's environment is marked as production.
Example responses
200
403
{
"id": "8d20758c-d74c-4f59-ae04-ee928c0816b7",
"name": "Sample project",
"environment": "Production",
"is_production": true
}Mark environment as production
Marks the specified environment as production. This action effectively swaps the production environment with the specified non-production environment.
PUT
https://manage.kontent.ai/v2/projects/{environment_id}/mark-environment-as-productionRequest
Path parameters
environment_idrequired · string
Identifies your environment.
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.markEnvironmentAsProduction()
.withData({
enable_webhooks: false,
})
.toPromise();
Response
Status (204)
The environment was successfully marked as production.
Empty response
Example responses
400
{
"request_id": "4c3b488c74c18640",
"error_code": 232,
"message": "The environment 4a8b44fa-785c-00ae-4d5c-029de7428cab is already marked as production."
}Rename an environment
Change the display name of an environment.
PATCH
https://manage.kontent.ai/v2/projects/{environment_id}Request
Path parameters
environment_idrequired · string
Identifies your environment.
Body schema
Application/json
Specify the environment's name.
array · min. 1 items
Hide child attributes
oprequired · string
The operation's name. The allowed operation is
rename_environment.valuerequired · string
The environment's name.
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client
.modifyEnvironment()
.withData([
{
op: 'rename_environment',
value: 'My Little Production',
},
])
.toPromise();
Response
Status (200)
The environment was renamed.
idstring · uuid
The environment's ID.
namestring
The project's display name.
environmentstring · 1-200 chars
The environment's display name.
is_productionboolean
Determines whether the project's environment is marked as production.
Example responses
200
400
{
"id": "4a8b44fa-785c-00ae-4d5c-029de7428cab",
"name": "Production",
"is_production": true
}Delete an environment
Deletes an environment from your project. If an environment is marked as production, it cannot be deleted.
DELETE
https://manage.kontent.ai/v2/projects/{environment_id}Request
Path parameters
environment_idrequired · string
Identifies your environment.
Request samples
TypeScript
C#
cURL
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
import { ManagementClient } from '@kontent-ai/management-sdk';
const client = new ManagementClient({
environmentId: 'KONTENT_AI_ENVIRONMENT_ID',
apiKey: 'KONTENT_AI_MANAGEMENT_API_KEY',
});
const response = await client.deleteEnvironment().toPromise();
Response
Status (204)
The environment was deleted.
Empty response
Example responses
400
{
"request_id": "af1567cb33d85545",
"error_code": 233,
"message": "The production environment can’t be deleted."
}