---
title: "Contentstack Delivery .Net SDK"
description: "Documentation for Dot net Delivery SDK"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/dot-net/reference"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2025-09-15"
---

# Contentstack Delivery .Net SDK

## Contentstack - .NET Delivery SDK

## .NET SDK for Contentstack's Content Delivery API

Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest.

For more information, you can check out the GitHub page of our [.NET Delivery SDK](https://github.com/contentstack/contentstack-dotnet).

## Prerequisites

To get started with C#, you will need:

*   .Net platform
*   IDE (Visual Studio)
*   NuGet.

## SDK installation and setup

The .Net SDK provided by contentstack.io is available for .NET 10 applications. You can integrate Contentstack with your application by following these steps.

Open the terminal and install the contentstack module via 'Package Manager' command

```
PM> Install-Package contentstack.csharp
```

And via ‘.Net CLI’

```
dotnet add package contentstack.csharp
```

To use the module in your application, you need to first Add Namespace to your class

```
using Contentstack.Core; // ContentstackClient
using Contentstack.Core.Models; // Stack, Query, Entry, Asset, ContentType, ContentstackCollection
using Contentstack.Core.Configuration; // ContentstackOptions
```

## Quickstart in 5 mins

## Initialize SDK

You will need to specify the API key, Access token, and Environment Name of your stack to initialize the SDK:

```
// Initialize the Contentstack 
ContentstackClient client = new ContentstackClient("api_key", "delivery_token", "enviroment_name");
```

or:

```
ContentstackOptions options = new ContentstackOptions()
{
	ApiKey = "<api_key>",
	DeliveryToken = "<access_token>",
	Environment = "<environment>"
}
ContentstackClient client = new ContentstackClient(options);
```

Once you have initialized the SDK, you can start getting content in your app  
**For Setting other regions**:

Refer the below code if you want to use the Europe, Australia, Azure North America, Azure Europe, GCP North America, or GCP Europe region.

```
ContentstackOptions options = new ContentstackOptions()
{
	ApiKey = "<api_key>",
	DeliveryToken = "<delivery_token>",
	Environment = "<environment>",
	Region = ContentstackRegion.EU
}
ContentstackClient client = new ContentstackClient(options);
```

Once you have initialized the SDK, you can start getting content in your app.

**For Setting the Early Access Header:**

Integrating EarlyAccess headers into the ContentstackOptions grants access to features included in the early access program.

```
ContentstackOptions options = new ContentstackOptions() {
    ApiKey = "<api_key>",
    DeliveryToken = "<delivery_token>",
    Environment = "<environment>",
    Branch = "<branch>"
    EarlyAccess = new string [] {"Taxonomy", "Teams", "Terms", "LivePreview"}
};

ContentstackClient client = new ContentstackClient(options);
```

**Parameters:**

Name

Type

Description

EarlyAccess (Optional)

Array of Strings

Array of header strings for early access features.

## Basic Queries

#### Get a Single Entry

To retrieve a single entry from a content type, use the code snippet given below:

```
ContentstackClient client = new ContentstackClient("api_key", "delivery_token", "enviroment_name");Entry entry = client.ContentType("product").Entry("entry_uid");entry.Fetch<Product>().ContinueWith((t) => {     if (!t.IsFaulted) {         Console.WriteLine("entry:" + t.Result);      } });
```

#### Get Multiple Entries

To retrieve multiple entries of a particular content type, use the code snippet given below:

```
ContentstackClient client = new ContentstackClient("api_key", "delivery_token", "enviroment_name");Query query = client.ContentType("product").Query(); query.Where("title", "welcome"); query.IncludeSchema(); query.IncludeCount(); query.ToJSON(); query.Find<Product>().ContinueWith((t) => {     if (!t.IsFaulted) {         ContentstackCollection<Product> result = t.Result;         Console.WriteLine("result" + result.items);     } });
```

**Note:** By default, the limit for response details per request is 100, with the maximum limit set at 250.

## Paginating Responses

In a single instance, the[Get Multiple Entries](https://www.contentstack.com/docs/developers/dot-net/get-started-with-dot-net-delivery-sdk/#get-multiple-entries)query will **retrieve only the first 100 items**of the specified content type. You can paginate and retrieve the rest of the items in batches using the**skip**and**limit** parameters in subsequent requests.

```
ContentstackClient client = new ContentstackClient("api_key", "delivery_token", "enviroment_name");
Query query = client.ContentType("blog").Query();
query.Skip(20);
query.Limit(20); 
query.Find<Blog>().ContinueWith((t) => { 
    if (!t.IsFaulted) { 
         ContentstackCollection<Blog> result = t.Result; 
         Console.WriteLine("result" + result); 
    } 
});
```

## ContentstackOptions

Represents a set of options to configure a Stack.

## ContentstackOptions

The api key used when communicating with the Contentstack API.

The access token used when communicating with the Contentstack API.

The delivery token used when communicating with the Contentstack API.

The environment used when communicating with the Contentstack API.

The Branch used to set Branch for the Contentstack API.

The Host used to set host url for the Contentstack API.

The Region used to set region for the Contentstack API.

The Version number for the Contentstack API.

The Live preview configuration for the Contentstack API.

The api key used when communicating with the Contentstack API.

The access token used when communicating with the Contentstack API.

The delivery token used when communicating with the Contentstack API.

The environment used when communicating with the Contentstack API.

You can choose from seven regions namely, NA, EU, AU, Azure NA, Azure EU, GCP NA and GCP EU.

The Host used to set host url for the Contentstack API.

The Version number for the Contentstack API.

The Branch used to set Branch for the Contentstack API.

The Live preview configuration for the Contentstack API.

## ContentstackOptions | .NET Delivery SDK | Contentstack

ContentstackOptions represents the set of options used to configure a Stack in the .NET Delivery SDK before initialization.

## LivePreviewConfig

Configuration for enabled live preview to get live content data

## LivePreviewConfig

To enable live preview

Host for getting live preview content

Management Token for the stack to get content

To enable live preview

Host for getting live preview content

Preview Token for the stack to get content

## LivePreviewConfig | .NET Delivery SDK | Contentstack

LivePreviewConfig enables live preview in the .NET Delivery SDK so you can fetch real-time, unpublished content data while editing.

## ContentstackRegion

### Fields

Name

Description

EU

To specify the EU region.

US

To specify the US region.

AU

To specify the AU region.

AZURE\_NA

To specify the AZURE NA region

AZURE\_EU

To specify the AZURE EU region

GCP\_NA

To specify the GCP NA region

GCP\_EU

To specify the GCP EU region

## ContentstackRegion

## ContentstackRegion | .NET Delivery SDK | Contentstack

ContentstackRegion enumerates the available data center regions in the .NET Delivery SDK, letting you target EU, US, AU, Azure, or GCP endpoints.

## ContentstackCollection

## ContentstackCollection<T>

The total number of items available.

The System.Collections.Generic.IEnumerable<T> of items to be serialized from the API response.

The maximum number of items returned in this result.

The number of items skipped in this resultset.

The total number of items available.

The System.Collections.Generic.IEnumerable<T> of items to be serialized from the API response.

The maximum number of items returned in this result.

The number of items skipped in this resultset.

## ContentstackException

The ContentstackError class is abstraction of general exception class.

## ContentstackException

This is error message.

Set of errors in detail.

Contentstack error code.

Contentstack error message

Set of errors in detail.

## ContentstackException | .NET Delivery SDK | Contentstack

ContentstackException is the abstraction of the general exception class in the .NET Delivery SDK, used to surface errors from API requests.

## SyncStack

Represents the result of a sync operation.

## SyncStack

Readonly property contains all the Contents

Readonly property for paginating sync

Readonly property to delta sync.

Readonly property to check totalCount

Readonly property contains all the Contents

Readonly property for paginating sync

Readonly property to delta sync.

Readonly property to check totalCount

## SyncStack | .NET Delivery SDK | Contentstack

SyncStack represents the result of a sync operation in the .NET Delivery SDK, holding the synced items and pagination tokens.

## SyncType

The different types of items you can request a sync for.

### Fields

Name

Description

All

Only published entries and assets

AssetDeleted

Only deleted assets

AssetPublished

Only published assets

AssetUnpublished

Only unpublished assets

ContentTypeDeleted

Only deleted Content-Types entries

Default

This will bring all published entries and published assets

EntryDeleted

Only deleted entries

EntryPublished

Only published entries

EntryUnpublished

Only unpublished entries

## SyncType

## SyncType | .NET Delivery SDK | Contentstack

SyncType enumerates the kinds of items you can request during a sync in the .NET Delivery SDK, such as published entries or deleted assets.

## ContentstackClient

Initialize an instance of ‘Stack’

## ContentstackClient

Initializes an instance of the **ContentstackClient** class.

```
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
```

API Key of your stack on Contentstack.

Delivery token of your stack on Contentstack.

Environment from where you want to fetch content.

Specifies the base URL for the Contentstack API.

**Default**: cdn.contentstack.io

Specifies the database region for your stack. You can choose from the following: NA, EU, AU, Azure NA, Azure EU, and GCP NA.

**Default**: ContentstackRegion.US

Specifies the version of the Contentstack API to use.

**Default:** v3

```
var options = new ContentstackOptions()
 {
       ApiKey = "api_key",
       DeliveryToken = "delivery_token"
       Environment = "environment"
 }
ContentstackClient stack = new ContentstackClient(options);
```

used to get stack details via class ContentstackOptions to create client.

## GetVersion

Get url base version

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String url = stack.GetVersion();
```

## Asset

Represents a Asset. Creates Asset Instance.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = stack.Asset("asset_uid");
```

This is Asset Uid of an Asset.

## AssetLibrary

Represents a AssetLibrary. Creates AssetLibrary Instance.

```
using Contentstack.Core; 
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = stack.AssetLibrary();
```

## ContentType

Represents a ContentType. Creates ContenntType Instance.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentType = stack.ContentType("content_type_uid");
```

ContentType UID.

## GetApplicationKey

Get stack application key

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String apiKey = stack.GetApplicationKey();
```

## GetAccessToken

Get stack access token

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String accessToken = stack.GetAccessToken();
```

## GetEnvironment

Get stack environment

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String environment = stack.GetEnvironment();
```

## GetContentTypes

This method returns comprehensive information of all the content types of a particular stack in your account.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

var param = new Dictionary<string, object>();
param.Add("include_global_field_schema",true);
param.Add("limit", 10);
param.Add("skip", 10);
param.Add("include_count", "true");
var result = await stack.GetContentTypes(param);
```

dictionary of additional parameter

## LivePreviewQuery

To add live preview Query for Contentstack preview call

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
await client.LivePreviewQueryAsync(new System.Collections.Generic.Dictionary<string, string>()
{
	{"live_preview" , "live_preview_hash_from_url_query" },
	{"content_type_uid", "content_type_uid<span>_from_url_query</span>" },
	{"entry_uid", "entry_uid<span>_from_url_query</span>" }
});
```

Query parameter containing hash and content type UID

## RemoveHeader

Remove header key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
stack.RemoveHeader("custom_header_key")
```

key to be remove from header

## SyncToken

Syncs the token.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncToken("sync_token");
```

Sync token.

## SyncRecursive

Syncs the recursive language.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive();
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(SyncType: SyncType.AssetPublished);
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(ContentTypeUid: "source");
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(StartFrom:DateTime.Now);
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(SyncType: SyncType.EntryPublished, ContentTypeUid: "source");
```

Locale

Sync type.

Content type uid.

Start from.

## SyncPaginationToken

Syncs the pagination token.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await stack.SyncPaginationTokenn("pagination_token");
```

Pagination token.

## ContentstackClient

Gets or sets the settings that should be used for deserialization.

Gets or sets the options that should be used for deserialization.

## ContentstackClient | .NET Delivery SDK | Contentstack

ContentstackClient initializes an instance of Stack in the .NET Delivery SDK, providing the client used to fetch content.

## Asset

Creates an instance of Assets. Use a UID to fetch a specific asset, or use the AssetLibrary class to retrieve all assets.

## SetHeader

To set headers for Contentstack rest calls.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").SetHeader("custom_key", "custom_value").Fetch();
```

header name.

header value against given header name.

## RemoveHeader

Remove header key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").RemoveHeader("header_to_remove").Fetch();
```

key to be remove from header

## GetCreateAt

Get created at time.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").Fetch();
DateTime date = asset.GetCreateAt();
```

## GetCreatedBy

Get created by user uid

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").Fetch();
string createBy = asset.GetCreatedBy();
```

## GetUpdateAt

Get updated at time.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").Fetch();
DateTime date = asset.GetUpdateAt();
```

## GetUpdatedBy

Get Update by user uid

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").Fetch();
string createBy = asset.GetUpdatedBy();
```

## GetDeleteAt

Get deleted at time.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").Fetch();
DateTime date = asset.GetDeleteAt();
```

## GetDeletedBy

Get Deleted by user uid

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").fetch();
string createBy = asset.GetDeletedBy();
```

## IncludeBranch

Include branch for publish content.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").IncludeBranch().Fetch();
```

## IncludeFallback

Include fallback locale publish content, if specified locale content is not publish.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").IncludeFallback().Fetch();
```

## IncludeMetadata

The includeMetadata method will add the meta information to the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").IncludeMetadata().Fetch();
```

## Fetch

fetches the latest version of a specific asset of a particular stack.

```
using Contentstack.Core; 
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = await stack.Asset("asset_uid").Fetch();
```

## AssetFields

The assetFields method specifies which asset-related fields are included in the API response when fetching an entry or querying entries.

**Note:** The assetFields method is currently supported only in the North America (NA) region.

```
Returns the current instance to enable method chaining.
Request behavior: No request is made until Fetch() (single asset) or FetchAll() (multiple assets) is called.Query parameter: When the request runs, the specified asset fields are sent to the CDA as the asset_fields[] query parameter.Field Behavior
Determines which asset-related metadata the CDA returns.Used with stack.Asset(uid).AssetFields(...).Fetch() or stack.AssetLibrary().AssetFields(...).FetchAll().When provided, the SDK sends the selected fields as the asset_fields[] query parameter. Only the requested asset metadata is returned.Supported Values
user_defined_fieldsembedded_metadataai_generated_metadatavisual_markupsFetch a single asset with specific fields
using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;
var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};
var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));
var assetResponse = await stack
    .Asset("asset_uid")
    .AssetFields(
        "user_defined_fields",
        "embedded_metadata",
        "ai_generated_metadata",
        "visual_markups"
    )
    .Fetch();
Query multiple assets with asset fields
using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;
var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};
var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));
var result = await stack
    .AssetLibrary()
    .AssetFields("ai_generated_metadata", "visual_markups")
    .FetchAll();
```

Asset field names to include in the response.

## setLocale

The setLocale method sets the locale for fetching a single asset. The API returns the asset with localized metadata (for example, title and description), along with the locale and publish\_details.locale fields in the response.

```
Field Behavior
Specifies which locale’s metadata the API returns for the asset.Used with stack.Asset(uid).SetLocale(...).Fetch().When provided, the locale is sent as the locale query parameter.Response Impact
The response includes localized fields (for example, title and description) along with locale and publish_details.locale.
Fetch a single asset in a locale
using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;

var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};
var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));
var asset = await stack
    .Asset("asset_uid")
    .SetLocale("en-us")
    .Fetch();
// Access localized fields from the response
var title = asset.Title;           // Localized title
var locale = asset.Get("locale");  // e.g. "en-us"Fetch a single asset in a locale with a fallback
using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;
var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};
var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));
var asset = await stack
    .Asset("asset_uid")
    .SetLocale("en-us")
    .IncludeFallback()
    .Fetch();Note:
IncludeFallback() returns content from the fallback locale if the requested locale is not published for the single asset.SetLocale can be chained with IncludeFallback(), IncludeMetadata(), AssetFields(), and AddParam() when fetching a single asset.
```

Locale code used to fetch the asset.

## Asset

Asset uid

Asset URL

File Name for asset

File size for asset

Tags assign to asset

Asset uid

Asset URL

Asset Description

File name for Asset

File size of asset

Tags assign to asset

## Asset | .NET Delivery SDK | Contentstack

Asset creates an asset instance in the .NET Delivery SDK, letting you fetch a specific media file by UID or retrieve all assets via AssetLibrary.

## AssetLibrary

Get all asset from Stack

## SetHeader

To set headers for Contentstack rest calls.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> asset = await stack.AssetLibrary().SetHeader("custom_key", "custom_value").FindAll();
```

header name.

header value against given header name.

## RemoveHeader

Remove header key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> asset = await stack.AssetLibrary("asset_uid").RemoveHeader("header_to_remove").FindAll();
```

key to be remove from header

## SortWithKeyAndOrderBy

Sorts the assets in the given order on the basis of the specified field.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> asset = await stack.AssetLibrary().SortWithKeyAndOrderBy("field_uid", "order").FindAll();
```

Field UID

ordering for sorting from key

## SetLocale

Sets the locale.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().SetLocale("en-us").FetchAll();
```

Locale to be fetch

## Skip

The number of objects to skip before returning any.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().Skip(20).FetchAll();
```

No of objects to skip from returned objects.

## Limit

A limit on the number of objects to return.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().Limit(20).FetchAll();
```

No of objects to limit.

## IncludeBranch

Include branch for publish content.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().IncludeBranch().FindAll();
```

## IncludeCount

This method also includes the total number of assets returned in the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().IncludeCount().FindAll();
```

## IncludeFallback

Include fallback locale publish content, if specified locale content is not publish.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().IncludeFallback().FindAll();
```

## IncludeMetadata

The includeMetadata method will add the meta information to the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().IncludeMetadata().FindAll();
```

## Except

Specifies list of field uids that would be excluded from the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = await stack.AssetLibrary().Except(new String[]{"name", "description"}).FetchAll();
```

## Only

Specifies an array of 'only' keys in BASE object that would be 'included' in the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = await stack.AssetLibrary().Only(new String[]{"name", "description"}).FetchAll();
```

## IncludeRelativeUrls

This method includes the relative url of assets.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().IncludeRelativeUrls().FindAll();
```

## FetchAll

Execute a AssetLibrary and Caches its result (Optional)

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Asset> assets = await stack.AssetLibrary().FetchAll();
```

## Count

Total count of the asset in specified Stack

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = await stack.AssetLibrary().Count();
```

## Query

AssetLibrary Query allows you to retrieve assets that match specific query criteria, returning a comprehensive list of assets that meet the defined parameters.

```
Example:
using Contentstack.Core; 
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

JsonObject queryObject = new JsonObject
{
  { "filename", "image3.png" }
};

ContentstackCollection<Asset> assets = await stack.AssetLibrary().Query(queryObject).FetchAll();

Note:You can also include nested queries as needed, similar to those used in Content Delivery API QueriesJsonObject queryObject = new JsonObject
{
   { "bank_offers.card_type", new JsonObject { ["$ne"] = "Debit Card" } }
};
```

The query contains the parameters needed to fetch assets and supports nested structures when required.

## Tags

The tags method retrieves all assets associated with the specified tag

```
Example:

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = stack.AssetLibrary();
assetLibrary.Tags(new string[] {"banner"});
ContentstackCollection<Asset> assets = await assetLibrary.FetchAll();
```

An array of tag strings used to filter assets; returns assets matching any specified tag. If null or empty, no tag filtering is applied.

## AssetLibrary

## AssetLibrary | .NET Delivery SDK | Contentstack

AssetLibrary retrieves all assets from a stack in the .NET Delivery SDK, letting you fetch collections of media files from Contentstack.

## ContentType

ContentType provides Entry and Query instance.

## SetHeader

To set headers for Contentstack rest calls.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentType = stack.ContentType("content_type_uid").SetHeader("custom_key", "custom_value");
```

header name.

header value against given header name.

## RemoveHeader

Remove header key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentType = await stack.ContentType("content_type_uid").RemoveHeader("header_to_remove");
```

key to be remove from header

## Fetch

This method returns the complete information, of a specific content type.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
var param = new Dictionary<string, object>();
param.Add("include_global_field_schema",true);
var result = await stack.ContentType("content_Type_uid").Fetch(param);
```

Dictionary of additional parameter

## Entry

Represents a Entry. Create Entry Instance.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = stack.ContentType("content_Type_uid").Entry("entry_uid");
```

Set entry uid.

## Query

Represents a Query Create Query Instance.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Query query = stack.ContentType("content_Type_uid").Query();
```

## ContentType

Content type uid

Content type uid

## ContentType | .NET Delivery SDK | Contentstack

ContentType provides Entry and Query instances in the .NET Delivery SDK, serving as the entry point for fetching content of a content type.

## Entry

An initializer is responsible for creating Entry object.

## GetContentType

Get contentType name.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
string contentType = stack.ContentType("content_Type_uid").Entry("entry_uid").GetContentType();
```

## GetUid

Get entry uid

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
var uid = entry.GetUid();
```

## GetTitle

Get entry title

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
var title = entry.GetTitle();
```

## GetTags

Returns tags of this entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
var tags = entry.GetTags();
```

## GetMetadata

Get metadata of entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
var metadata = entry.GetMetadata();
```

## GetHTMLText

Get html text for markdown data type

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
var result = entry.GetHTMLText("markdownKey");
```

field\_uid as key.

## GetMultipleHTMLText

Get html text for markdown data type which is multiple true

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
List<string> metadata = entry.GetMultipleHTMLText("markdown_field_uid");
```

Field\_uid as key.

## GetCreateAt

Get value of creation time of entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
DateTime datetime = entry.GetCreateAt();
```

## GetCreatedBy

Get uid who created this entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
string createdBy = entry.GetCreatedBy();
```

## GetUpdateAt

Get value of updating time of entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
DateTime datetime = entry.GetUpdateAt();
```

## GetUpdatedBy

Get uid who updated this entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
string updatedBy = entry.GetUpdatedBy();
```

## GetDeletedAt

Get value of deleting time of entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
DateTime datetime = entry.GetDeletedAt();
```

## GetDeletedBy

Get uid who created this entry.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
string deletedBy = entry.GetDeletedBy();
```

## Get

Get object value for key.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Entry>();
Object value = entry.Get("key");
```

Key to get value

## SetCachePolicy

To set cache policy using Entry instance.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").SetCachePolicy(CachePolicy.NetworkElseCache).Fetch<Entry>();
```

CachePolicy instance

## SetHeader

To set headers for Contentstack rest calls.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").SetHeader("custom_key", "custom_value").Fetch();
```

header name.

header value against given header name.

## RemoveHeader

Remove header key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").RemoveHeader("header_to_remove").Fetch();
```

key to be remove from header

## SetLocale

Sets the locale.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_type_uid").Entry("entry_uid").SetLocale("en-us").Fetch<Entry>();
```

Locale to fetch entry

## SetUid

Assigns a uid to current instance of an entry.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.Entry().SetUid("entry_uid").SetLocale("en-us").Fetch<Entry>();
```

Uid for entry to fetch

## SetTags

Assign a tag(s) for this Entry.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.Entry("entry_uid").SetTags(new List<string>() {
	"tag_1"
}).Fetch<Entry>();
```

Collection of tags.

## IncludeReferenceContentTypeUID

This method also includes the content type UIDs of the referenced entries returned in the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReferenceContentTypeUID().Fetch<Entry>();
```

## IncludeReference

Add a constraint that requires a particular reference key details.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReference(new String[]{"reference_uid_1", "reference_uid_2"}).Fetch<Entry>();
```

Array key that to be constrained.

## IncludeReference

Add a constraint that requires a particular reference key details.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReference("reference_uid_1").Fetch<Entry>();
```

Key that to be constrained.

## IncludeOnlyReference

Specifies an array of except keys that would be excluded in the response.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeOnlyReference(new String[]{"name", "description"},"referenceUid").Fetch<Entry>();
```

Array of the only reference keys to be included in response.

Key who has reference to some other class object.

## IncludeExceptReference

Specifies an array of except keys that would be excluded in the response.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeExceptReference(new String[]{"name", "description"},"referenceUid").Fetch<Entry>();
```

Array of the except reference keys to be excluded in response.

Key who has reference to some other class object.

## IncludeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeEmbeddedItems().Fetch<Entry>();
```

## IncludeFallback

Include fallback locale publish content, if specified locale content is not publish.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeFallback().Fetch<Entry>();
```

## IncludeMetadata

The includeMetadata method will add the meta information to the response.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeMetadata().Fetch<Entry>();
```

## IncludeBranch

Include branch for publish content.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeBranch().Fetch<Entry>();
```

## Only

Specifies an array of 'only' keys in BASE object that would be 'included' in the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = await stack.Entry().Only(new String[]{"name", "description"}).Fetch();
```

Array of the only reference keys to be included in response.

## Except

Specifies list of field uids that would be excluded from the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = await stack.Entry("entry_uid").Except(new String[]{"name", "description"}).Fetch();
```

Field uid which get excluded from the response.

## ToJson

Get key/value pairs in json of current instance.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Entry entry = await stack.ContentType("content_Type_uid").Entry("entry_uid").IncludeReferenceContentTypeUID().Fetch<Entry>();
JsonObject jObject = entry.ToJson();
```

## Fetch

Fetches the latest version of the entries from Contentstack.io content stack

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Product product = await stack.ContentType("content_Type_uid").Entry("entry_uid").Fetch<Product>();
```

## Variants

The variants method retrieves details of a specific entry variant or an array of entry variants based on the applied query.

When Personalize creates a variant in the CMS, it assigns a "Variant Alias" to identify that specific variant. When fetching entry variants using the Delivery API, you can pass variant aliases in place of variant UIDs in the x-cs-variant-uid header.

```
Example:
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

Entry entry = await stack
                    .ContentType("content_Type_uid")
                    .Entry("entry_uid")
                    .Variant(new String[]{"variant_uid1/variant_alias1", "variant_uid2/variant_alias2"})
                    .Fetch<Entry>();
```

List of variants

## assetFields

The assetFields method specifies which asset-related fields are included in the API response when fetching an entry or querying entries.

**Regional Behavior**

This method is currently supported only for stacks located in the **North America (NA)** region.

**For stacks in the Europe (EU) or Azure North America (Azure NA) regions:**

*   The API ignores the asset\_fields\[\] parameter.
*   The response returns the default asset metadata.
*   The system does not return an error or warning message if the parameter is used.

If you are working in these regions, ensure your application logic accounts for the full default metadata response rather than a filtered set of fields.

```
Returns the current Entry instance to enable method chaining. For example: Entry("id").AssetFields("...").Fetch<Entry>().
Request behavior: Calling AssetFields(...) only records the asset fields and does not make an API request.Execution: The HTTP request runs only when you call Fetch<T>() (single entry) or Find<T>() (multiple entries).Query parameter: The specified asset fields are sent as the asset_fields[] query parameter so that only those asset-related fields are returned in the response.Parameter Behavior
Specifies which asset-related metadata fields the CDA returns for assets referenced in the entry or entries.Applied when using stack.ContentType(uid).Entry(uid).AssetFields(...).Fetch<T>() or stack.ContentType(uid).Entry().AssetFields(...).Find<T>().When provided, the SDK sends the selected fields as the asset_fields[] query parameter. Only the requested asset metadata is returned in the API response.Supported Parameter Values
user_defined_fieldsembedded_metadataai_generated_metadatavisual_markupsNote: If AssetFields(...) is not called, or is called with no arguments, null, or an empty array, the SDK does not add the asset_fields[] query parameter. The CDA then returns the default asset metadata for referenced assets.
Fetch a single entry with specific fields
using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;

var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};

var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));

var entry = await stack
    .ContentType("blog_post")
    .Entry("entry_uid")
    .AssetFields("user_defined_fields", "embedded_metadata", "ai_generated_metadata")
    .Fetch<Entry>();Query multiple entries with asset fields
using Contentstack.Core;
using Contentstack.Core.Configuration;
using Contentstack.Core.Models;
using Microsoft.Extensions.Options;

var options = new ContentstackOptions
{
    ApiKey = "<API_KEY>",
    DeliveryToken = "<DELIVERY_TOKEN>",
    Environment = "<ENVIRONMENT>"
};

var stack = new ContentstackClient(new OptionsWrapper<ContentstackOptions>(options));

var result = await stack
    .ContentType("blog_post")
    .Entry()
    .AssetFields("user_defined_fields", "embedded_metadata")
    .Find<Entry>();
```

Asset field names to include in the response.

## Entry

Set key/value attributes of Metadata.

Set key/value attributes of an current entry instance.

Set array of Tags

Title of an entry

This is Entry Uid of an entry.

Set key/value attributes of Metadata.

Set key/value attributes of an current entry instance.

Set array of Tags

Title of an entry

This is Entry Uid of an entry.

## Entry | .NET Delivery SDK | Contentstack

Entry creates and retrieves single entry objects in the .NET Delivery SDK, giving access to the content stored within a Contentstack entry.

## Global Fields

A Global field is a reusable field or group of fields that you define once and reuse across any content type in your stack. This helps you avoid recreating the same set of fields multiple times, saving time and effort.

## IncludeGlobalFieldSchema

The IncludeGlobalFieldSchema method fetches the complete schema of a specified Global Field, including all nested fields and configurations

```
Example:

using Contentstack.Core;
using Contentstack.Core.Configuration;

var options = new ContentstackOptions()
{
   ApiKey = "your_api_key",
   DeliveryToken = "your_delivery_token",
   Environment = "your_environment"
};

ContentstackClient stack = new ContentstackClient(options);
GlobalField globalField = stack.GlobalField("global_field_uid")
   .IncludeGlobalFieldSchema()
   .Fetch();
```

## SetHeader

The SetHeader method sets custom headers when fetching a Global Field, allowing you to pass additional information such as authentication tokens, localization settings, or custom metadata with the API request.

```
Example:
using Contentstack.Core;
using Contentstack.Core.Configuration;
var options = new ContentstackOptions()
{
   ApiKey = "your_api_key",
   DeliveryToken = "your_delivery_token",
   Environment = "your_environment"
};
ContentstackClient stack = new ContentstackClient(options);
GlobalField globalField = stack.GlobalField("global_field_uid");
globalField.SetHeader("custom_key", "custom_value");
var result = await globalField.Fetch();
```

## fetch

The fetch method retrieves the details of the specified global field.

```
Example:
using Contentstack.Core;
using Contentstack.Core.Configuration;

var options = new ContentstackOptions()
{
   ApiKey = "your_api_key",
   DeliveryToken = "your_delivery_token",
   Environment = "your_environment"
};

ContentstackClient stack = new ContentstackClient(options);
GlobalField globalField = stack.GlobalField("global_field_uid");
var result = await globalField.Fetch();
Console.WriteLine(result.ToString());
```

## Global Fields | .NET Delivery SDK | Contentstack

Global Fields are reusable fields you define once and reuse across content types in the .NET Delivery SDK, avoiding repeated field setup.

## Global Field Query

A Global field is a reusable field or group of fields that you define once and reuse across any content type in your stack. This helps you avoid recreating the same set of fields multiple times, saving time and effort.

## find

The find method retrieves all Global Fields from your stack using a Global Field query, providing access to the complete collection of Global Field data.

```
Example:
using Contentstack.Core;
using Contentstack.Core.Configuration;
var options = new ContentstackOptions()
{
   ApiKey = "your_api_key",
   DeliveryToken = "your_delivery_token",
   Environment = "your_environment"
};
ContentstackClient stack = new ContentstackClient(options);
GlobalFieldQuery query = stack.GlobalFieldQuery();
var result = await query.Find();
Console.WriteLine(result.ToString());
```

## IncludeGlobalFieldSchema

The IncludeGlobalFieldSchema method includes the complete schema for each Global Field when fetching all Global Fields using a query.

```
Example:
using Contentstack.Core;
using Contentstack.Core.Configuration;
var options = new ContentstackOptions()
{
   ApiKey = "your_api_key",
   DeliveryToken = "your_delivery_token",
   Environment = "your_environment"
};
ContentstackClient stack = new ContentstackClient(options);
var result = await stack.GlobalFieldQuery()
   .IncludeGlobalFieldSchema()
   .Find();
```

## Global Field Query | .NET Delivery SDK | Contentstack

Global Field Query retrieves reusable global fields in the .NET Delivery SDK, letting you query fields shared across multiple content types.

## Query

A class that defines a query that is used to query for Entry instance.

When Personalize creates a variant in the CMS, it assigns a "Variant Alias" to identify that specific variant. When fetching entry variants using the Delivery API, you can pass variant aliases in place of variant UIDs in thex-cs-variant-uidheader.

## AddQuery

Add a custom query against specified key.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().AddQuery("key", "value").Find<Entry>();
```

field uid.

field value

## IncludeCount

Retrieve count and data of objects in result.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().IncludeCount().Find<Entry>();
```

## IncludeBranch

Include branch for publish content.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().IncludeBranch().Find<Entry>();
```

## IncludeFallback

Include fallback locale publish content, if specified locale content is not publish.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_Type_uid").Query().IncludeFallback().Find<Entry>();
```

## IncludeMetadata

The includeMetadata method will add the meta information to the response.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_Type_uid").Query().IncludeMetadata().Find<Entry>();
```

## IncludeEmbeddedItems

Include Embedded Objects (Entries and Assets) along with entry/entries details.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_Type_uid").Query().IncludeEmbeddedItems().Find<Entry>();
```

## IncludeOnlyReference

Specifies an array of except keys that would be excluded in the response.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_Type_uid").Query().IncludeOnlyReference(new String[]{"name", "description"},"referenceUid").Find<Entry>();
```

Array of the only reference keys to be included in response.

Key who has reference to some other class object.

## IncludeExceptReference

Specifies an array of except keys that would be excluded in the response.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_Type_uid").Query().IncludeExceptReference(new String[]{"name", "description"},"referenceUid").Find<Entry>();
```

Array of the except reference keys to be excluded in response.

Key who has reference to some other class object.

## IncludeReference

Add a constraint that requires a particular reference key details.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_Type_uid").Query().IncludeReference("reference_uid_1").Find<Entry>();
```

Key that to be constrained.

## IncludeReferenceContentTypeUID

This method also includes the content type UIDs of the referenced entries returned in the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().IncludeReferenceContentTypeUID().Find<Entry>();
```

## IncludeReference

Add a constraint that requires a particular reference key details.

```
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().IncludeReference(new String[]{"reference_uid_1", "reference_uid_2"}).Find<Entry>();
```

Array key that to be constrained.

## ReferenceIn

Retrieve entries based reference in query

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentTypeObj = stack.ContentType("contentType_id");

Query query = contentTypeObj.Query();
query.Where("email_address","content@email.com");

ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().ReferenceIn("user", query).Find<Entry>();
```

They key to constraint on

Query object

## ReferenceNotIn

Retrieve entries based reference not in query

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentTypeObj = stack.ContentType("contentType_id");

Query query = contentTypeObj.Query();
query.Where("email_address","content@email.com");

ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().ReferenceNotIn("user", query).Find<Entry>();
```

The key to constraint on

Query object

## Regex

Add a regular expression constraint for finding string values that match the provided regular expression.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_type_uid").Query().Regex("name", "^browser").Find<Entry>();
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_type_uid").Query().Regex("name", "^browser", "i").Find<Entry>();
```

The key to be constrained.

The regular expression pattern to match.

Any of the following supported Regular expression modifiers.

*   use _i_ for case-insensitive matching.
*   use _m_ for making dot match newlines.
*   use _x_ for ignoring whitespace in regex

## RemoveQuery

Remove provided query key from custom query if exist.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_type_uid").Query().RemoveQuery("query_key").Find<Entry>();
```

Query name to remove.

## SetCachePolicy

To set cache policy using Query instance.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_type_uid").Query().SetCachePolicy(CachePolicy.NetworkElseCache).Find<Entry>();
```

CachePolicy instance

## SetLocale

Sets the locale.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_type_uid").Query().SetLocale("en-us").Find<Entry>();
```

Locale to fetch entry

## SetHeader

To set headers for Contentstack rest calls.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_type_uid").Query().SetHeader("custom_key", "custom_value").Find<Entry>();
```

header name.

header value against given header name.

## RemoveHeader

Remove header key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> entry = await stack.ContentType("content_type_uid").Query().RemoveHeader("header_to_remove").Find<Entry>();
```

key to be remove from header

## WhereTags

Include tags with which to search entries.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().WhereTags(new String[] {"tag_1", tag_2}).Find<Entry>();
```

Array of tags you want to match in the entries

## Skip

The number of objects to skip before returning any.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Skip(20).Find<Entry>();
```

No of objects to skip.

## Limit

A limit on the number of objects to return.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Limit(20).Find<Entry>();
```

No of objects to limit.

## Ascending

Sort the results in ascending order with the given key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Ascending("name").Find<Entry>();
```

The key to order by.

## Descending

Sort the results in descending order with the given key.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Descending("name").Find<Entry>();
```

The key to order by.

## And

Combines all the queries together using AND operator

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentTypeObj = stack.ContentType("contentType_id");

Query query1 = contentTypeObj.Query();
query1.Where("username","content");

Query query2 = contentTypeObj.Query();
query2.Where("email_address","content@email.com");

List<Query> queryList = new List<Query>();
queryList.Add(query1);
queryList.Add(query2);

ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().And(queryList).Find<Entry>();
```

List of Query instances on which AND query executes.

## Or

Add a constraint to fetch all entries which satisfy any queries.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentTypeObj = stack.ContentType("contentType_id");

Query query1 = contentTypeObj.Query();
query1.Where("username","content");

Query query2 = contentTypeObj.Query();
query2.Where("email_address","content@email.com");

List<Query> queryList = new List<Query>();
queryList.Add(query1);
queryList.Add(query2);

ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Or(queryList).Find<Entry>();
```

List of Query instances on which OR query executes.

## Except

Specifies list of field uids that would be excluded from the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Except(new String[] {"name", description }).Find<Entry>();
```

field uid which get excluded from the response.

## Only

Specifies an array of 'only' keys in BASE object that would be 'included' in the response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Only(new String[] {"name", description }).Find<Entry>();
```

Array of the 'only' keys to be included in response.

## Exists

Add a constraint that requires, a specified key exists in response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Exist("title").Find<Entry>();
```

The key to be constrained.

## NotExists

Add a constraint that requires, a specified key does not exists in response.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().NotExist("title").Find<Entry>();
```

The key to be constrained.

## NotEqualTo

Add a constraint to the query that requires a particular key's entry to be not equal to the provided value.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().NotEqualTo("title", "Demo").Find<Entry>();
```

the key to be constrained.

The object that must not be equaled.

## Where

Add a constraint to the query that requires a particular key entry's value not be contained in the provided array.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Where("title", "Demo").Find<Entry>();
```

the key to be constrained.

Field value which get included from the response.

## NotContainedIn

Add a constraint to the query that requires a particular key entry's value not be contained in the provided array.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().NotContainedIn("title", new Object[]{ "Demo", "Welcome"}).Find<Entry>();
```

the key to be constrained.

The list of values the key object should not be.

## ContainedIn

Add a constraint to the query that requires a particular key's entry to be contained in the provided array.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().ContainedIn("title", new Object[]{ "Demo", "Welcome"}).Find<Entry>();
```

the key to be constrained.

The possible values for the key's object.

## LessThanOrEqualTo

Add a constraint to the query that requires a particular key entry to be less than or equal to the provided value.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().LessThanOrEqualTo("age", 20).Find<Entry>();
```

the key to be constrained.

The value that provides an upper bound or equal.

## LessThan

Add a constraint to the query that requires a particular key entry to be less than the provided value.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().LessThan("age", 20).Find<Entry>();
```

the key to be constrained.

The value that provides an upper bound.

## GreaterThanOrEqualTo

Add a constraint to the query that requires a particular key entry to be greater than or equal to the provided value.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().GreaterThanOrEqualTo("age", 20).Find<Entry>();
```

the key to be constrained.

The value that provides a lower bound or equal.

## GreaterThan

Add a constraint to the query that requires a particular key entry to be greater than the provided value.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().GreaterThan("age", 20).Find<Entry>();
```

the key to be constrained.

The value that provides an lower bound.

## Find

Execute a Query and Caches its result (Optional)

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Find<Entry>();
```

## FindOne

Execute a Query and Caches its result (Optional)

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().FindOne<Entry>();
```

## Count

Retrieve only count of entries in result.

```
using Contentstack.Core; 
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentstackCollection<Entry> collection = await stack.ContentType("content_Type_uid").Query().Count();
```

## Variants

The variants method retrieves details of a specific entry variant or an array of entry variants based on the applied query.

When Personalize creates a variant in the CMS, it assigns a "Variant Alias" to identify that specific variant. When fetching entry variants using the Delivery API, you can pass variant aliases in place of variant UIDs in the x-cs-variant-uid header.

```
Example:
using Contentstack.Core;
using Contentstack.Core.Models;

ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");

ContentstackCollection<Entry> collection = await stack
						.ContentType("content_Type_uid")
						.Query()
						.Variant(new String[]{"variant_uid1/variant_alias1", "variant_uid2/variant_alias2"})
						.Find<Entry>();
```

List of variants

## Query

## Query | .NET Delivery SDK | Contentstack

Query defines and runs queries for Entry instances in the .NET Delivery SDK, supporting filters and variant aliases for fetching content.

## Taxonomy

[Taxonomy](/docs/developers/taxonomy/about-taxonomy) helps you categorize pieces of content within your stack to facilitate easy navigation and retrieval of information.

**Note:** All methods in the Query section are applicable for taxonomy-based filtering as well.

## EqualAndBelow

The EqualAndBelow method retrieves all entries for a specific taxonomy that match a specific term and its descendant terms, requiring only the target term.

**Note:** This query is applicable for the stack.Taxonomies() and stack.ContentType('uid').Query() methods.

```
Example:
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Query csQuery = stack.Taxonomies();

csQuery.EqualAndBelow("taxonomies.taxonomy_uid", "term_uid", 3);
csQuery.Find<Product>().ContinueWith((queryResult) => {
	//Your callback code.
});
```

Enter the UID of the taxonomy

Enter the UID of the term

Enter the level

## Below

The Below method retrieves all entries for a specific taxonomy that match all of their descendant terms by specifying only the target term and a specific level.

**Note:** If you don't specify the level, the default behavior is to retrieve terms up to level 10.

```
Example:
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.Taxonomies();

csQuery.Below("taxonomies.taxonomy_uid", "term_uid", 3);
csQuery.Find<Product>().ContinueWith((queryResult) => {
	//Your callback code.
});
```

Enter the UID of the taxonomy

Enter the UID of the term

Enter the level

## EqualAndAbove

The EqualAndAbove method retrieves all entries for a specific taxonomy that match a specific term and all its ancestor terms, requiring only the target term and a specified level.

**Note:** If you don't specify the level, the default behavior is to retrieve terms up to level 10.

```
Example:
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Query csQuery = stack.Taxonomies();

csQuery.EqualAndAbove("taxonomies.taxonomy_uid", "term_uid", 3);
csQuery.Find<Product>().ContinueWith((queryResult) => {
	//Your callback code.
});
```

Enter the UID of the taxonomy

Enter the UID of the term

Enter the level

## Above

The Above method retrieves all entries for a specific taxonomy that match only the parent terms of a specified target term, excluding the target term itself and a specified level.

**Note:** If you don't specify the level, the default behavior is to retrieve terms up to level 10.

```
Example:
ContentstackClient stack = new ContentstackClinet("api_key", "delivery_token", "environment");
Query csQuery = stack.Taxonomies();

csQuery.Above("taxonomies.taxonomy_uid", "term_uid", 3);
csQuery.Find<Product>().ContinueWith((queryResult) => {
	//Your callback code.
});
```

Enter the UID of the taxonomy

Enter the UID of the term

Enter the level

## Taxonomy | .NET Delivery SDK | Contentstack

Taxonomy lets you categorize stack content in the .NET Delivery SDK, supporting taxonomy-based filtering for easy navigation and retrieval.