---
title: "BranchPublishConfigModel"
description: "BranchPublishConfigModel"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/dot-net/reference/branchpublishconfigmodel"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-11-22"
---

# BranchPublishConfigModel

## BranchPublishConfigModel

BranchPublishConfigModel lists the environments a new branch clones. Assign it to BranchModel.PublishConfig before you call the [Create](/docs/developers/sdks/content-management-sdk/dot-net/reference/branch#branch-create) or [CreateAsync](/docs/developers/sdks/content-management-sdk/dot-net/reference/branch#branch-createasync) method.

**When to Use This Class:** Use this class when a new branch needs only some environments of its source branch, or none of them.

**Conceptual Role:** Acts as the data model that BranchModel serializes under the publish\_config key of a branch create request.

**Returns:** BranchPublishConfigModel. The environment settings of a branch.

**Note:** BranchPublishConfigModel requires version 1.2.0 or later of the .NET Management SDK.

## Properties

Name

Type

Required

Default

Description

Environments

List<string>?

No

null

Environment names the new branch clones, not environment UIDs. Serialized as environments.

## Class-Level Notes

**What the list does.**

*   A list of environment names clones only those environments.
*   An empty list clones no environments.
*   To clone all environments, leave BranchModel.PublishConfig unset. The SDK then leaves publish\_config out of the request.

**The API checks the names, not the SDK.**

*   The SDK sends the list unchanged and does not check the names or the list length.
*   The API rejects an environment name that does not exist in the stack, alone or mixed with valid names, with 422. The SDK throws that rejection as ContentstackErrorException, and the API creates no branch.
*   The API returns the environment list of the new branch under branch.publish\_config.environments in the create response.

**Additional Resource:** Refer to [Create a branch](/docs/developers/apis/content-management-api/branches#create-a-branch) for the publish\_config request body.

## Method Index

BranchPublishConfigModel has no methods. Set its Environments property and assign the model to BranchModel.PublishConfig.

## Class-Level Snippet

This snippet creates a branch that clones only the development and staging environments.

```
using System;
using System.Collections.Generic;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");

BranchModel model = new BranchModel()
{
    Uid = "<BRANCH_UID>",
    Source = "main",
    PublishConfig = new BranchPublishConfigModel()
    {
        Environments = new List<string> { "development", "staging" }
    }
};

try
{
    ContentstackResponse response = client.Stack("<API_KEY>").Branch().Create(model);
    Console.WriteLine(response.OpenJsonObjectResponse()["branch"]?["publish_config"]?.ToJsonString());
}
catch (ContentstackErrorException e)
{
    Console.WriteLine($"Request failed: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
}
```

## BranchPublishConfigModel \| .NET Management SDK \| Contentstack

BranchPublishConfigModel in the .NET Management SDK lists the environment names a new branch clones when you create it.