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

# BranchModel

## BranchModel

BranchModel holds the details of a branch. To create a branch with the [Create](/docs/developers/sdks/content-management-sdk/dot-net/reference/branch#branch-create) method, set Uid, Source, and optionally PublishConfig. The API fills the other fields when it returns a branch.

**When to Use This Class:** Use this class to build the request for a new branch, or to read a fetched branch as a typed object.

**Conceptual Role:** Acts as the data model that the Branch class serializes under the branch key of a request.

**Returns:** BranchModel. The details of a branch.

## Properties

Name

Type

Required

Default

Description

Uid

string?

No

null

Branch UID. Lowercase, \_ between words, at most 15 characters. Serialized as uid.

Source

string?

No

null

UID of the branch to copy, for example main. Serialized as source.

CreatedBy

string?

No

null

UID of the user who created the branch. The API sets it. Serialized as created\_by.

UpdatedBy

string?

No

null

UID of the user who last updated the branch. The API sets it. Serialized as updated\_by.

CreatedAt

string?

No

null

Creation time as a string. The API sets it. Serialized as created\_at.

UpdatedAt

string?

No

null

Last update time as a string. The API sets it. Serialized as updated\_at.

Alias

List<BranchAliasModel>?

No

null

Aliases that point to the branch, as [BranchAliasModel](/docs/developers/sdks/content-management-sdk/dot-net/reference/branchaliasmodel) items. The API sets it. Serialized as alias.

PublishConfig

BranchPublishConfigModel?

No

null

Environments the new branch clones. null clones all environments. Serialized as publish\_config. Requires version 1.2.0 or later.

## Class-Level Notes

**Fields you send and fields the API sets.**

*   Create and CreateAsync leave every null property out of the request. Leave CreatedBy, UpdatedBy, CreatedAt, UpdatedAt, and Alias unset, so the body holds only uid, source, and publish\_config when you set it.
*   The Content Management API (CMA) reference requires a custom UID and the UID of a source branch in the create request.
*   Leave PublishConfig unset to clone all environments of the source branch. Set it to a [BranchPublishConfigModel](/docs/developers/sdks/content-management-sdk/dot-net/reference/branchpublishconfigmodel) to clone only the environments it lists, or none.

**Dates are strings.**

*   CreatedAt and UpdatedAt hold the timestamp string the API returns. Parse them with DateTimeOffset.Parse when you need a date value.

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

## Method Index

BranchModel has no methods. Set and read its properties directly, and pass the model to the [Create](/docs/developers/sdks/content-management-sdk/dot-net/reference/branch#branch-create) method of Branch.

## Class-Level Snippet

This snippet creates a branch, then reads an existing branch back into a second model.

```
using System;
using System.Text.Json;
using Contentstack.Management.Core;
using Contentstack.Management.Core.Exceptions;
using Contentstack.Management.Core.Models;

ContentstackClient client = new ContentstackClient("<AUTHTOKEN>");
Stack stack = client.Stack("<API_KEY>");

try
{
    BranchModel model = new BranchModel() { Uid = "<BRANCH_UID>", Source = "main" };
    stack.Branch().Create(model);

    ContentstackResponse response = stack.Branch("<EXISTING_BRANCH_UID>").Fetch();
    BranchModel? branch = response.OpenJsonObjectResponse()["branch"]?.Deserialize<BranchModel>();

    foreach (BranchAliasModel alias in branch?.Alias ?? new())
    {
        Console.WriteLine($"Alias {alias.Uid} points to {branch?.Uid}");
    }
}
catch (ContentstackErrorException e)
{
    Console.WriteLine($"Request failed: {(int)e.StatusCode} {e.ErrorCode} {e.ErrorMessage}");
}
```

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

BranchModel in the .NET Management SDK holds the details of a branch: the UID and source you send to create it, and the fields the API returns.