---
title: "GlobalFields"
description: "GlobalFields"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/java/reference/globalfields"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-08"
---

# GlobalFields

## GlobalFields

A Global field is a reusable field (or group of fields) that you can define once and reuse in any content type within your stack. This eliminates the need (and thereby time and effort) to repeatedly create the same set of fields in multiple content types.

You can now pass the branch header in the API request to fetch or manage modules located within specific branches of the stack. You can also set the include\_branch query parameter to true to include the \_branch top-level key in the response. This key specifies the unique ID of the branch where the concerned Contentstack module resides.

A nested global field is a reusable set of sub-fields you can embed within other global fields or content types. It helps manage complex data structures more efficiently across your stack.

**Note:** To work with nested global fields, set api\_version to 3.2 in the request headers. This version is required for all CRUD operations to work correctly.

## create

The Create a global field request allows you to create a new global field in a particular stack of your Contentstack account. You can use this global field in any content type within your stack.

**Note**: Only the stack owner, administrator, and developer can create global fields.  
You need to use either the stack's Management Token or the user Authtoken (one of them is mandatory), along with the stack API key, to make a valid Content Management API request. Read more about [authentication](/docs/administration).

```
Example 1:
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
Call<ResponseBody> response = globalField.create(body).execute();
if(response.isSuccessful) {
    System.out.println("Response" + response);
}
Example 2:

 // For Nested global fields pass api_version param with value 3.2
import com.contentstack.cms.Contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
globalField.addHeader("api_version","3.2");
Response<ResponseBody> response = globalField.create(body).execute();
if(response.isSuccessful) {
    System.out.println("Response" + response);
} else {
    System.out.println("Error: "+ response.errorBody().string());
}
```

The request body.

## imports

The "Import global field" call imports global fields into Stack.

**Note**: You need to use either the stack's Management Token or the user Authtoken (one of them is mandatory), along with the stack API key, to make a valid Content Management API request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
Call<ResponseBody> response = globalField.imports(body).execute();
if(response.isSuccessful) {
    System.out.println("Response" + response);
}
```

The request body.

## export

This request is used to export a specific global field and its schema. The data is exported in JSON format.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
Call<ResponseBody> response = globalField.export().execute();
if(response.isSuccessful) {
    System.out.println("Response" + response);
}
```

The version of the content type you want to retrieve. If the version number is not specified, you will get the latest version of the content type.

## update

The "Update a global field" request allows you to update the schema of an existing global field.

When executing the API call, in the URI Parameters section, provide the unique ID of your global field.

**Note**: You need to use either the stack's Management Token or the user Authtoken (one of them is mandatory), along with the stack API key, to make a valid Content Management API request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
Call<ResponseBody> response = globalField.update(requestBody).execute();
if(response.isSuccessful) {
    System.out.println("Response" + response);
}
```

The request body.

## removeParam

Set header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
globalField.removeParam("key");
```

Removes query param using key of request.

## find

The "Get all global fields" call returns comprehensive information on all the global fields available in a particular stack in your account

**Note**: You need to use either the stack's Management Token or the user Authtoken (one of them is mandatory), along with the stack API key, to make a valid Content Management API request. Read more about [authentication](/docs/administration).

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
Call<ResponseBody> response = globalField.find().execute();
if(response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## fetch

The "Get a Single global field" request lets you fetch comprehensive details of a specific global field.

When executing the API call, in the URI Parameters section, provide the unique ID of your global field.

**Note**: You need to use either the stack's Management Token or the user Authtoken (one of them is mandatory), along with the stack API key, to make a valid Content Management API request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
GlobalField globalField = contentstack.stack().globalField();
Call<ResponseBody> response = globalField.fetch().execute();
if(response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## GlobalFields | Java Management SDK | Contentstack

GlobalFields lets you define a reusable field or group of fields once and use it across any content type in the Java Management SDK.