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

# ContentType

## ContentType

The content type defines the structure or schema of a page or a section of your web or mobile property. To create content for your application, you are required first to create a content type and then create entries using the content type.

You can now pass the branch header in the API request to fetch or manage modules located within specific branches of the stack. Additionally, 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.

## referenceIncludeGlobalField

The "Get all references of content type" call will fetch all the content types in which a specified content type is referenced.

**Note**: You must use either the stack's Management Token or the user Authtoken (anyone is mandatory), along with the stack API key, to make a valid Content Management API request. Read more about authentication. You need to use either the stack's Management Token or the user Authtoken (anyone is mandatory), along with the stack API key, to make a valid Content Management API request

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

## importOverwrite

The "Import a content type" call imports a content type into a stack by uploading a JSON file.

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

## fieldVisibilityRule

The "Set Field Visibility Rule for Content Type API request" lets you add Field Visibility Rules to existing content types. These rules allow you to show and hide fields based on the state or value of certain fields.

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

The request body.

## addParam

Sets header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ContentType contentType = contentstack.stack().contentType();
contentType.addParam("key", value);
```

Query parameter key for the request.

Query parameter value for the request.

## entry

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

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

The entry uid.

## create

The "Create a content type" call creates a new content type in a particular stack of your Contentstack account.

In the Body section, you need to provide the complete schema of the content type.

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

The request body.

## reference

The "Get all references of content type" call will fetch all the content types in which a specified content type is referenced.

**Note**: You must use either the stack's Management Token or the user Authtoken (anyone is mandatory), along with the stack API key, to make a valid Content Management API request. Read more about authentication. 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();
ContentType contentType = contentstack.stack().contentType();
Call<ResponseBody> response = contentType.reference(isIncludeGlobalField).execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

Include Global Field true/false

## imports

The "Import a content type" call imports a content type into a stack by uploading a JSON file.

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

## export

This call is used to export a specific content type and its schema. The data is exported in JSON format. However, please note that the entries of the specified content type are not exported through this call. The schema of the content type returned will depend on the version number provided.

**Note**: You must 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();
ContentType contentType = contentstack.stack().contentType();
Call<ResponseBody> response = contentType.export().execute();
if (response.isSuccessful) {
    System.out.println("Response" + response);
}
```

## find

The "Get all content types" call returns comprehensive information on all the content types 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.

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

## update

The "Update Content Type" call is used to update the schema of an existing content type.

**Note**: Whenever you update a content type, it will auto-increment the content type version.

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

The request body to update the Alias.

## fetch

The "Get a single content type" call returns information about a specific content type.

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

## delete

The "Delete Content Type" call deletes an existing content type and all the entries within it. When executing the API call, in the URI Parameters section, provide the UID of your content type.

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

## removeParam

Set header for the request.

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

Removes query parameters using the key of the request.

## addHeader

Sets header for the request.

```
import contentstack;
Contentstack contentstack = new Contentstack.Builder().build();
ContentType contentType = contentstack.stack().contentType();
contentType.addHeader("key", value)
```

Header key for the request.

Header value for the request.

## fetchAsPojo

The fetchAsPojo method fetches a single content type and deserializes the response into a POJO.

```
import contentstack; 

Contentstack contentstack = new Contentstack.Builder().build();
ContentType contentType = contentstack.stack().contentType(content_type_uid);
Response<ContentTypeResponse> response = contentType.fetchAsPojo().execute();
      if (response.isSuccessful() && response.body() != null) {
          ContentTypeResponse ctResponse = response.body();
          System.out.println("ContentType JSON: " + ctResponse.toString());
          if (ctResponse != null) {
           ContentTypePojo ctPojo = ctResponse.getContentPojo();
           System.out.println(" Content Type UID: " + ctPojo.uid);
           System.out.println(" Content Type Title: " + ctPojo.title);
     }
 }  else {
           System.out.println("Error: " + response.errorBody().string());
}
```

## findAsPojo

The findAsPojo method fetches a list of content types and deserializes them into POJOs.

```
import contentstack; 

Contentstack contentstack = new Contentstack.Builder().build();
Response<ContentTypesResponse> response = contentstack.stack().contentTypes().findAsPojo().execute();
if (response.isSuccessful() && response.body() != null) {
    ContentTypesResponse ctResponse = response.body();
    List<ContentTypePojo> contentTypes = ctResponse.getContentTypes();
    for (ContentTypePojo ct : contentTypes) {
        System.out.println(" Content Type UID: " + ct.uid);
        System.out.println(" Content Type Title: " + ct.title);
    }
} else {
    System.out.println("Error: " + response.errorBody().string());
}
```

## ContentType | Java Management SDK | Contentstack

ContentType defines the structure or schema of a page or section that you use to create entries in the Java Management SDK.