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

# Entry

## Entry

An [Entry](/docs/headless-cms/about-entries) is the actual piece of content created using one of the defined content types. To work with a single entry, specify its UID.

**Example:**

```
import contentstack from '@contentstack/delivery-sdk'
import { BaseEntry } from '@contentstack/delivery-sdk'

const stack = contentstack.stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
interface BlogPostEntry extends BaseEntry {
  // custom entry types
}
async function fetchEntry() {
    try {
const result = await stack.contentType(contenttype_uid).entry(entry_uid).fetch<BlogPostEntry>();
      console.log('Entry: ', result);
//Add your statements
    } catch (error) {
      console.error('Error fetching entry:', error);
  }
}
fetchEntry();
```

## fetch

The fetch method retrieves the details of a specific entry.

```
Example:
import { BaseEntry } from '@contentstack/delivery-sdk'


interface BlogPostEntry extends BaseEntry {
  // custom entry types
}
const result = await stack
                      .contentType(contentType_uid)
                      .entry(entry_uid)
                      .fetch<BlogPostEntry>();
```

## includeBranch

The includeBranch method includes the branch details in the result.

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry(entry_uid)
                       .includeBranch()
                       .fetch<BlogPostEntry>();
```

## includeFallback

The includeFallback method retrieves the entry in its fallback language.

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry(entry_uid)
                       .includeFallback()
                       .fetch<BlogPostEntry>();
```

## locale

The locale method retrieves the entries published in that locale.

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry(entry_uid)
                       .locale('en-us')
                       .fetch<BlogPostEntry>();
```

Locale of the entry

## addParams

The addParam method adds a query parameter to the query.

```
Example:
import { BaseEntry, FindEntry } from '@contentstack/delivery-sdk'


interface BlogPostEntry extends BaseEntry {
  // custom entry types
}

const result = await stack
                       .contentType(contentType_uid)
                       .entry()
                       .addParams({"key": "value"})
                       .find<BlogPostEntry>();
```

Add key-value pairs

## except

The except method excludes specific field(s) of an entry.

```
Example:
const result = await stack
                       .contentType("contentTypeUid")
                       .entry()
                       .except("fieldUID")
                       .find<BlogPostEntry>();
```

UID of the field to exclude

## find

The find method retrieves the details of the specified entry.

```
Example:
const result = await stack.contentType("contentTypeUid").entry().find<BlogPostEntry>();
```

## skip

The skip method will skip a specific number of entries in the output.

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry()
                       .skip(5)
                       .find<BlogEntry>();
```

Enter the number of entries to be skipped.

## limit

The limit method will return a specific number of entries in the output.

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry()
                       .limit(5)
                       .find<BlogEntry>();
```

Enter the maximum number of entries to be returned.

## includeCount

The includeCount method retrieves the count and data of objects in the result.

```
Example:
const result = await stack
                       .contentType("contentTypeUid")
                       .entry()
                       .includeCount()
                       .find<BlogPostEntry>();
```

## only

The only method selects specific field(s) of an entry.

```
Example:
const result = await stack
                       .contentType("contentTypeUid")
                       .entry()
                       .only("fieldUID")
                       .find<BlogPostEntry>();
```

UID of the field to select

## orderByAscending

The orderByAscending sorts the results in ascending order based on the specified field UID.

```
Example:
const result = await stack
                       .contentType("contentTypeUid")
                       .entry()
                       .orderByAscending()
                       .find<BlogPostEntry>();
```

Field UID to sort the results

## orderByDescending

The orderByDescending sorts the results in descending order based on the specified field UID.

```
Example:
const result = await stack
                       .contentType("contentTypeUid")
                       .entry()
                       .orderByDescending()
                       .find<BlogPostEntry>();
```

Field UID to sort the results

## param

The param method adds query parameters to the URL.

```
Example:
const result = await stack
                       .contentType("contentTypeUid")
                       .entry()
                       .param("key", "value")
                       .find<BlogPostEntry>();
```

Add any param to include in the response

Add the corresponding value of the param key

## query

The query method retrieves the details of the entry on the basis of the queries applied.

```
Example:
const query = stack.contentType("contentTypeUid").entry().query({ "price_in_usd": { "$lt": 600 }});
const result = await query.whereIn("brand").find<BlogPostEntry>();
```

Query in object format

## removeParam

The removeParam method removes a query parameter from the query.

```
Example:
const result = await stack
                       .contentType("contentTypeUid")
                       .entry()
                       .removeParam("query_param_key")
                       .find<BlogPostEntry>();
```

Specify the param key you want to remove

## where

The where method filters the results based on the specified criteria.

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry()
                       .query()
                       .where(
                         "field_UID", 
                         QueryOperation.IS_LESS_THAN, 
                         ["field1", "field2"])
                       .find<BlogPostEntry>();
```

Specify the field the comparison is made from

Specify the comparison criteria

Specify the field the comparison is made to

## includeMetadata

The includeMetadata method includes the metadata for getting metadata content for the entry.

```
Example:
const result = await stack
                       .contentType('contentType_uid')
                       .entry('entry_uid')
                       .includeMetadata()
                       .fetch<BlogEntry>();
```

## includeEmbeddedItems

The includeEmbeddedItems method includes embedded objects (Entry and Assets) along with entry details

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry('entry_uid')
                       .includeEmbeddedItems()
                       .fetch<BlogEntry>();
```

## includeContentType

The includeContentType method includes the details of the content type along with the Entry details.

```
Example:
const result = await stack
                       .contentType(contentType_uid)
                       .entry('entry_uid')
                       .includeContentType()
                       .fetch<BlogEntry>();
```

## includeReference

The includeReference method retrieves the content of the referred entries in your response.

```
Example:
const query = stack.contentType(contentType_uid).entry();
const result = await query
                      .includeReference("brand")
                      .find<BlogPostEntry>();To retrieve all referred entries, use the following code snippet:const result = await query.addParams({ include_all: true, include_all_depth: 2 }).find();Note: The maximum supported value for include_all_depth is 100.
```

UID of the reference field to include

## Variants

Variants are different versions of content designed to meet specific needs or target audiences. This feature allows content editors to create multiple variations of a single entry, each customized for a particular variant group or purpose.

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.

```
Single Variant: This method retrieves the details of a specific entry variant.

Example:
import contentstack from '@contentstack/delivery-sdk';

const Stack = contentstack.stack
({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack
                    .contentType('content_type_uid')
                    .entry('entry_uid')
                    .variants('variant_uid/variant_alias')
                    .fetch();

Layering variants: This method retrieves the details of entry variants based on the applied query

Example:
import contentstack from '@contentstack/delivery-sdk';

const Stack = contentstack.stack
({'api_key': 'api_key', 'delivery_token': 'delivery_token', 'environment': 'environment'});
const result = await Stack
                      .contentType('content_type_uid')
                      .entry('entry_uid')
                      .variants(['variant_uid1/variant_alias1','variant_uid2/variant_alias2'])
                      .fetch();
				
Note: By default you can add up to 3 variant UIDs or aliases. The limit can vary based on your organization plan. The variant UID or alias added first takes priority and will be applied to the base entry fields.
```

## assetFields

The assetFields method specifies the optional asset field groups to include for assets returned with an entry.

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

**Response Behavior:**

*   Retrieves only the required asset metadata, keeping the entry payloads smaller when entries reference assets.
*   Applies to published assets referenced or embedded on the entry. It applies to both single-entry and multi-entry responses.
*   Adds optional metadata fields to each asset in the response. It does not filter assets or control file types.
*   Requests optional metadata groups in addition to standard asset fields such as file MIME type (content\_type) and folder flag (is\_dir). It does not replace or modify core asset fields.

**Note:** On asset objects, content\_type represents the file’s MIME type, not a Contentstack CMS content type.

**Supported field groups (values):**

*   user\_defined\_fields: Includes stack-defined custom fields on the asset (author-managed key-value data).
*   embedded\_metadata: Includes metadata extracted from the file (e.g, EXIF or IPTC).
*   ai\_generated\_metadata: Includes AI-generated data (e.g., tags, descriptions, classifications).
*   visual\_markups: Includes annotation data (e.g., regions, notes, overlays)

```
Note: The SDK forwards invalid or empty field group strings without validating them. The API handles the errors.
Usage and Behavior:
Chain on a single entry or on an entry query, for example:stack.contentType('<CONTENT_TYPE_UID>').entry('<ENTRY_UID>').assetFields(...).fetch()
or
stack.contentType('<CONTENT_TYPE_UID>').entry().assetFields(...).find().
Multiple calls overwrite prior values. Calling with no arguments omits asset_fields[] from the request.Examples:
The following example fetches a single BlogEntry. Nested assets include the optional metadata. Asset fields and structure depend on your content type.
import contentstack, { BaseAsset, BaseEntry } from '@contentstack/delivery-sdk';

interface HeroAsset extends BaseAsset {
  user_defined_fields?: {
    photographer?: string;
    license?: string;
  };
  ai_generated_metadata?: {
    tags?: string[];
    description?: string;
  };
  // Visual annotation / overlay payload shape is app-specific; use `unknown` until you define a narrow interface.
  visual_markups?: unknown;
  // Binary-embedded file metadata (e.g. EXIF-style); structure varies by file type. Type narrowly or validate at runtime.
  embedded_metadata?: unknown;
}

interface BlogEntry extends BaseEntry {
  // Replace `hero_image` with your file-field UID; linked asset shape matches your stack.
  hero_image?: HeroAsset;
}

async function main() {
  try {
    const stack = contentstack.stack({
      apiKey: '<API_KEY>',
      deliveryToken: '<DELIVERY_TOKEN>',
      environment: '<ENVIRONMENT>',
    });
    const entryResponse = await stack
      .contentType('<CONTENT_TYPE_UID>')
      .entry('<ENTRY_UID>')
      .assetFields(
        'user_defined_fields',
        'embedded_metadata',
        'ai_generated_metadata',
        'visual_markups'
      )
      // Generic tells TypeScript the resolved entry shape (including nested asset field groups above).
      .fetch<BlogEntry>();
    console.log(entryResponse);
  } catch (error) {
    console.error(error);
  }
}This example runs an entry query with two asset field groups and reads results from entries on the find response.
import contentstack from '@contentstack/delivery-sdk';
async function main() {
  try {
    const stack = contentstack.stack({
      apiKey: '<API_KEY>',
      deliveryToken: '<DELIVERY_TOKEN>',
      environment: '<ENVIRONMENT>',
    });
    const result = await stack
      .contentType('<CONTENT_TYPE_UID>')
      .entry()
      .assetFields('ai_generated_metadata', 'visual_markups')
      .find();
    // Collection responses use `entries` on FindResponse (not `items`).
    console.log(result.entries);
  } catch (error) {
    console.error(error);
  }
}Data Retrieval Behavior:
Typing dynamic responses: Optional blocks returned for assetFields on nested assets are not part of the SDK’s BaseAsset type and vary by stack and field. Extend and compose BaseAsset in types that match your entry’s file fields, pass the entry type to .fetch<MyEntry>() or .find<MyEntry>(), then validate or narrow the payload before use.Pagination and execution: Terminal methods (.fetch(), .find()) trigger a single HTTP request. Control page size and offset using query modifiers (e.g., limit, skip), or the system falls back to API defaults.Additional Resources: For detailed API payload schemas and default behaviors, refer to Contentstack Delivery API Documentation.
```

Keys that specify asset field groups to retrieve for assets in the entry response. Provide them as arguments before .fetch() or .find().

UID of the entry

## Entry | TypeScript Delivery SDK | Contentstack

The Entry class in the TypeScript Delivery SDK retrieves a single content entry from your Contentstack stack, giving access to its fields and data.