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

# Config

## Config

Config class that exposes config instance, Where the user can provide other configurations on the stack

## earlyAccess

With the earlyAccess header support, you can access features that are part of the early access program.

```
Config config = new Config();
String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
config.setEarlyAccess(earlyAccess);
Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);
```

## getBranch

Get branch of the stack

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

Config config = new Config();
config.getBranch();
Stack stack = Contentstack.stack(apiKey, deliveryToken, environment, config);
```

## setBranch

Set branch for on the stack

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

Config config = new Config();
config.setBranch("branchName");
Stack stack = Contentstack.stack(apiKey, deliveryToken, environment, config);
```

branch you want to set

## setProxy

Sets custom proxy

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

java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
Config config = new Config();
config.setProxy(proxy);
```

Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object

## getProxy

Returns the Proxy instance

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

Config config = new Config();
config.getProxy();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

## connectionPool

Manages reuse of HTTP and HTTP/2 connections for reduced network latency. HTTP requests that \* share the same {@link okhttp3.Address} may share a {@link okhttp3.Connection}. This class implements the policy of which connections to keep open for future use.

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

Config config = new Config();
config.connectionPool(maxIdleConnections, keepAliveDuration, timeUnit);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

the maxIdleConnections default value is 5

the keepAliveDuration default value is 5

the timeUnit default value is TimeUnit.MINUTES

## getRegion

Get Region of the request url

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

Config config = new Config();
config.getRegion();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

## setRegion()

Sets Region of the database

```
import com.contentstack.sdk.*;
Config config = new Config();
config.setRegion(ContentstackRegion.EU);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

DB region for your stack. You can choose from six regions namely, NA, EU, Azure NA, Azure EU, GCP NA, and GCP EU.

## getHost()

Gets host of the request

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

Config config = new Config();
config.getHost();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

## setHost()

Set custom host of the request url

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

Config config = new Config();
config.sethost(hostname);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

The host

## getVersion()

Gets version of the request path

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

Config config = new Config();
config.getVersion();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

## enableLivePreview()

Enables Live Preview

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

Config config = new Config();
config.enableLivePreview(true);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

Provide true to enable the Live Preview

## setLivePreviewHost()

Sets Host to the Live Preview request url

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

Config config = new Config();
config.setLivePreviewHost(host);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

Host for Live Preview

## setManagementToken()

Adds Management Token to the stack header

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

Config config = new Config();
config.setManagementToken(managementToken);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);
```

The Management Token

## Config

## Config | Java Delivery SDK | Contentstack

Config exposes a configuration instance you can use to apply additional stack settings in the Contentstack Java Delivery SDK.