Show examples in:
    Fork an existing environment

    Query parameters

    immediate_return  boolean  Optional

    Whether the call should immediately return a pending environment, or wait for the completion of the fork

    fast  boolean  Optional

    Performing a fast fork reduces processing time, but it also prevents writing to the source environment during the process

    force  boolean  Optional

    Force the start of fast fork, even if there are collaborators editing some records


    id  string  Required
    The ID of the forked environment


    Returns a environment resource object.


    Example code:
    import { buildClient } from '@datocms/cma-client-node';
    async function run() {
    const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
    const environmentId = 'main';
    const environment = await client.environments.fork(environmentId, {
    id: 'my-sandbox-env'
    }, {
    immediate_return: true,
    fast: true,
    force: true
    Returned output:
    id: 'main',
    meta: {
    status: 'ready',
    fork_completion_percentage: 95,
    read_only_mode: true,
    created_at: '2020-04-21T07:57:11.124Z',
    last_data_change_at: '2020-04-21T07:57:11.124Z',
    primary: true,
    forked_from: 'main'