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

# Entry

## Entry

An entry is the actual piece of content created using one of the defined content types.

## removeHeader

Removes header using key

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
Entry entry = entry.removeHeader(key)
```

key of the header you want to remove

## getTags

Gets entry tags

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
Entry entry = entry.getTags()
```

## getContentType

Gets entry content type

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
Entry entry = entry.getContentType()
```

## getUid

Gets entry uid

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
Entry entry = entry.getUid()
```

## getLocale

Gets Language of the entry

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
Entry entry = entry.getLocale();
```

## setLocale

Sets locale of entry

```
import com.contentstack.sdk.*;
Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
Entry entry = entry.setLocale("locale_code");
```

language code

## except

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

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.except(new String[]{"name", "description"});
```

field uid which get excluded from the response.

## includeReference

Add a constraint that requires a particular reference key details.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.includeReference(new String[]{"referenceUid_A", "referenceUid_B"});
```

referenceFields array key that to be constrained

## only

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

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.only(new String[]{"name", "description"});
```

Array of the only reference keys to be included in response

## onlyWithReferenceUid

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

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
ArrayList<String> array = new ArrayList<String>();
array.add("description");
array.add("name");
entry.onlyWithReferenceUid(array, "referenceUid");
```

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

Key who has reference to some other class object

## exceptWithReferenceUid()

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

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.exceptWithReferenceUid()
ArrayList<String> array = new ArrayList<String>();
array.add("description");
array.add("name");
entry.onlyWithReferenceUid(array, "referenceUid");
```

Array of the except reference keys to be excluded in response

Key who has reference to some other class object

## fetch

fetch is used to get the entry response

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.fetch(new EntryResultCallBack() {
@Override public void onCompletion(ResponseType responseType, Error error) {
}
});}
```

EntryResultCallBack object to notify the application when the request has completed

## addParam

Adds query parameters in the entry request

These are the keys that can be passed for addParam.

Key

Value

Description

include\_fallback

boolean

Enter true to include published localized content from the fallback locale when the specified locale lacks published content.

locale

string

Enter the language code for which you want to include entries. Only published, localized entries will be displayed.

include\_branch

boolean

Set to true to include the \_branch top-level key in the response. This key indicates the unique ID of the branch where the specified Contentstack module resides.

version

number

Enter the latest version number. Providing a draft version number will result in an empty response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.addParam(key, value)
```

key of the header

value of the header

## includeReferenceContentTypeUID

Include Reference ContentType UID in the entry response

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.includeReferenceContentTypeUID()
```

## includeContentType

Include ContentType in the entry response

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.includeContentType()
```

## includeFallback

Include Fallback Language in the entry response

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.includeFallback()
```

## includeEmbeddedItems

Include Embedded Items in the entry response

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("contentType").entry("entryUid");
entry.includeEmbeddedItems()
```

## includeBranch

include branch in the entry response

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack.contentType("user").entry("entryUid");
entry.includeBranch();
```

## includeMetadata

Includes entry metadata along with response body.

```
Stack stack = Contentstack.stack("apiKey", "deliveryToken", environment_name);
Entry entry = stack.contentType("contentTypeUid").entry("entryUid")
entry.includeMetadata();
```

## 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-uidheader.

```
Example 1:
import com.contentstack.sdk.*;
Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack
                    .contentType("contentType")
                    .entry("entryUid")
                    .variants("variantUid/variantAlias");
 entry.fetch(new EntryResultCallBack() {
     @Override
     public void onCompletion(ResponseType responseType, Error error) {
              System.out.println(entry.toJSON());
         }
 });
Example 2:
import com.contentstack.sdk.*;
Stack stack = Contentstack.stack(apiKey, deliveryToken, environment);
final Entry entry = stack
                    .contentType("contentType")
                    .entry("entryUid")
                    .variants(new String[]{"variantUid1/variantAlias1","variantUid2/variantAlias2"});
 entry.fetch(new EntryResultCallBack() {
     @Override
     public void onCompletion(ResponseType responseType, Error error) {
              System.out.println(entry.toJSON());
         }
 });
```

Enter the UID/Alias of the variant

## assetFields

The assetFields method acts as a filter for the API response, ensuring you get exactly the asset metadata you need. It specifies the asset-related field groups to include in the API response when you fetch a single entry.

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

```
Supported values
user_defined_fields: Custom metadata and other user-defined asset fields for assets included with this entry.embedded: Embedded asset payload for assets referenced from this entryai_suggested: AI-suggested asset metadata where applicable for assets in this entry.visual_markups: Visual markup data for assets referenced from this entry.Behavior:
Multiple calls: The last call overrides previous values.No arguments or null: Omits the asset_fields[] parameter; the API returns default fields.Fetch a single entry with specific asset fields.
Use this when you know the entry UID and want to fetch its assets.
import com.contentstack.sdk.*;
Stack stack = Contentstack.stack("<API_KEY>", "<DELIVERY_TOKEN>", "<ENVIRONMENT>");
Entry entry = stack
    .contentType("blog_post")
    .entry("entry_uid")
    .assetFields("user_defined_fields", "embedded", "ai_suggested", "visual_markups");

entry.fetch(new EntryResultCallBack() {
    @Override
    public void onCompletion(ResponseType responseType, Error error) {
        if (error == null) {
            // Use entry data
        } else {
            // Handle error
        }
    }
});Query multiple entries with asset fields
Use this when fetching a list of entries (e.g., a blog feed) to ensure all returned entries include the specified asset metadata.
import com.contentstack.sdk.*;
Stack stack = Contentstack.stack("<API_KEY>", "<DELIVERY_TOKEN>", "<ENVIRONMENT>");
Query query = stack
    .contentType("blog_post")
    .query()
    .assetFields("user_defined_fields", "embedded");
query.find(new QueryResultsCallBack() {
    @Override
    public void onCompletion(ResponseType responseType, QueryResult queryResult, Error error) {
        if (error == null) {
            // Use queryResult.getResultObjects() for the list of entries
        } else {
            // Handle error
        }
    }
});
```

One or more asset field groups to include in the response.

## Config

## Entry | Java Delivery SDK | Contentstack

Entry represents a single piece of content created from a content type in the Java Delivery SDK, giving access to its field data.