Was this page helpful?

Contentful data model

Contentful organizes content into spaces, that allows you to group all the related resources for a project together, this includes content entries, media assets, and settings for localizing content into different languages.

Each space has a content model that represents the content types you create.

Content type properties

All content types have standard fields that contain basic information about the content type, its fields and meta data.

Field Type Description
sys Sys Common system properties.
name String Name of the content type.
description String Description of the content type.
fields [Field] List of fields.
displayField String ID of main field used for display.

Fields

Each content type consists of a set of up to 50 fields that you define, these fields can be one of the following, and correspond to a JSON type. There are differences between the fields you can create in the web app and the API.

Name API type JSON type Description Limits Example
Text (Short) Symbol String A short text field for titles and names. Maximum length is 256. "The title"
Text (Long)1 Text String A long text field for paragraphs of text. Filterable via full-text search. Maximum length is 50,000. "This is a post and ..."
Number (Integer) Integer Number A whole number Values from -2 53 to 2 53. 42
Number (Decimal) Number Number A decimal number. Values from -2 53 to 2 53. 3.14
Date and time 2 Date String A date and time in ISO 8601 format. "2015-11-06T09:45:27"
Location Location Object Coordinate values for storing the latitude and longitude of a location. {"lat": 52.5208, "lon": 13.4049}
Boolean Boolean Boolean For values that have two states, e.g. yes or no, true or false. true
Media Link Object A link to an asset. The type of the referenced item is defined by the linkType property. Read our links guide for more details.
Reference Link Object A link to another entry. The type of the referenced item is defined by the linkType property. Read our links guide for more details.
Array Array Array List of values. See array fields below. Limited by entry size. ["name1", "name2", ...]
JSON Object Object Object For storing any other types of objects you have defined. Limited by entry size. {"foo": "bar"}
  1. Text: Fields do not support ordering or strict equality.
  2. Date: Fields must be ISO8601 formatted, but do not require a time portion.

Add new field

Array fields

Fields can contain multiple values with the Array type. An array can contain symbols (strings up to 256 characters), or links to other entries or assets. The items property defines the allowed values in the array.

You define a field that contains symbols like this:

{
  "id": "tags",
  "type": "Array",
  "items": { "type": "Symbol" }
}

You define a field that contains links to assets like this:

{
  "id": "relatedImages",
  "type": "Array",
  "items": {
    "type": "Link",
    "linkType": "Asset"
  }
}

You define a field that contains links to items like this:

"reference_field": {
  "en-US": [
    {
      "sys": {
        "type": "Link",
        "linkType": "Asset",
        "id": "id1"
    }},
    {
      "sys": {
        "type": "Link",
        "linkType": "Asset",
        "id": "id2"
    }}
    ...
  ]
}

Individual fields also contain metadata, such as validations and widget appearance.

Contentful stores individual items of content as entries, which represent textual or structural information based on the content type used. Items can also be assets, which are binary files, such as images, videos or documents. Assets have three fixed fields, the name, description and attached file.

You can see how Contentful represents your content model in JSON by clicking the JSON preview tab next to the fields tab.

If you want to hide fields from appearing in JSON output, you can disable it by clicking the three dots to the right of the field.

Disable Field

This is useful for content information that is important to writers and editors, but not for public consumption.

Example - modeling a product catalogue

One of the template spaces in Contentful is for a product catalogue, it consists of:

  • A Category: What product type is it?
  • A Brand: Who made the product?
  • A Product: An item for sale that references a category and a brand.

And the Brand content type consists of the following fields:

  • Company Name: A text field that represents the title of the entry, it's required, with the Single line appearance setting.
  • Logo: A media field that references assets.
  • Description: Describes the brand, it's a longer text field with the Markdown editor enabled.
  • Website, Twitter, Email: Three text fields that hold the contact details for the brand. They have validation rules to ensure the correct contact information.
  • Phone #: Another text field, but one that allows a user to add a list of values.

Next steps

Not what you’re looking for? Try our FAQ.