---
title: "Stack"
description: "Stack"
url: "https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/typescript/reference/stack"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-06-09"
---

# Stack

## Stack

A [stack](/docs/developers/set-up-stack/about-stack) is a repository or a container that holds all the [entries](/docs/content-managers/author-content/about-entries)/[assets](/docs/content-managers/working-with-assets/about-assets) of your site. It allows multiple users to [create](/docs/content-managers/working-with-entries/create-an-entry), [edit](/docs/content-managers/working-with-entries/edit-an-entry), [approve](/docs/content-managers/use-workflows/send-an-entry-for-publish-or-unpublish-approval), and [publish](/docs/content-managers/publish-content) their content within a single space.

The stack function initializes an instance of the Stack. To initialize a stack execute the following code:

```
import contentstack from '@contentstack/delivery-sdk'const stack = contentstack.stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
```

## LivePreviewConfig

Configuration settings to enable live preview functionality and fetch real-time content data.

Specifies whether to enable the live preview feature.

Specifies the host domain used to retrieve live preview content.

Token required to fetch live preview content from the stack.

## Plugins

When creating custom plugins, through this request, you can pass the details of your custom plugins. This facilitates their utilization in subsequent requests when retrieving details.

To initializing a stack with plugins, refer to the code snippet below:

```
// custom class for pluginclass CrossStackPlugin {  onRequest (request) {    // add request modifications    return request  }  async onResponse (request, response, data) {    // add response modifications here    return response  }}const Stack = Contentstack.stack({  api_key,  delivery_token,  environment,  plugins: [    new CrossStackPlugin(),  ]});
```

## Asset

The Asset method by default creates an object for all assets of a stack. To retrieve a single asset, specify its UID.

```
Example:
const asset = stack.asset(); // For collection of asset
// OR
const asset = stack.asset('assetUid'); // For a single asset with uid 'assetUid'
```

UID of the asset

## ContentType

The ContentType method retrieves all the content types of a stack. To retrieve a single contenttype, specify its UID.

```
Example:
const contentType = stack.contentType(); // For collection of contentType
// OR
const contentType = stack.contentType('contentTypeUid'); // For a single contentType with uid 'contentTypeUid'
```

UID of the content type

## setLocale

The setLocale method sets the locale of the API server.

```
Example:
stack.setLocale('en-155');
```

Enter the locale code

## sync

The sync method syncs your Contentstack data with your app and ensures that the data is always up-to-date by providing delta updates.

```
Example:
For initializing sync:Stack.sync();For initializing sync with entries of a specific locale:Stack.sync({ 'locale': 'en-us'}); 
For initializing sync with entries published after a specific date:Stack.sync({ 'start_date': '2018-10-22'}); For initializing sync with entries of a specific content type:Stack.sync({ 'content_type_uid': 'session'}); For initializing sync with a specific type of content:
Stack.sync({ 'type': 'entry_published'});
//Use the type parameter to get a specific type of content. Supports 'asset_published', 'entry_published', 'asset_unpublished', 'entry_unpublished', 'asset_deleted', 'entry_deleted', 'content_type_deleted'For fetching the next batch of entries using pagination token:Stack.sync({'pagination_token': '<page_tkn>'}); For performing subsequent sync after initial sync:Stack.sync({'sync_token': '<sync_tkn>'});
```

An object that supports ‘locale’, ‘start\_date’, ‘content\_type\_uid’, and ‘type’ queries

Specifies if the sync should be recursive

API key of the stack

Delivery token to retrieve data from the stack

Environment name where content is published

The Live preview configuration for the Contentstack API

Name of the branch to fetch data from

Sets the host of the API server  
(example: "dev.contentstack.com")

Region of the stack. You can choose from five regions: NA, EU, Azure NA, Azure EU, GCP NA, and GCP EU.

Lets you specify which language to use as source content if the entry does not exist in the specified language.

Specifies the caching strategy. Accepts a string value from the Policy enum.

Defines where the cache is stored. Accepts localStorage or memoryStorage as string values.

Sets the maximum age (in milliseconds) before the cache expires.

Function to serialize data before storing it in the cache.

Function to deserialize data when retrieving it from the cache.

Set early access headers

Method to enable custom logging in the SDK

Add custom plugins to the SDK

## Stack | TypeScript Delivery SDK | Contentstack

The Stack class in the TypeScript Delivery SDK represents a content stack and serves as the main interface for retrieving entries, assets, and content types.