# Content Type

A *Content Type* is the template (schema) that content follows. It defines which fields the content has and, for each field, its type, whether it is localized, whether it is required, and its validation rules. Take a "Product" in a clothing store as an example: a single *Content Type* "Product" defines the set of attributes such as product name, price, description, and photo, while each individual product is created as a *Content* that follows this template.

In CMA, a *Content Type* is a sub-resource of *Space*, and its path is based on `/spaces/{spaceId}/content-types`. Management operations such as create, update, and unpublish are performed on CMA, and the published snapshot is delivered through CDA. Note that a *Content Type* is **published automatically** on create and update, so unlike *Content* it reaches the `Published` status right away without a separate publish call (see [Status and automatic publishing](#status-and-automatic-publishing) below).

## Resource structure {#resource-structure}

The following is the single-read response for the *Content Type* "Product". Along with `sys` (system properties), it has body properties such as `name`, `displayField`, `publishWithAuthor`, and `fields`.

```json
{
  "sys": {
    "id": "3trmXRM3RqbgSnifyg7PAmlxvX4fGY",
    "type": "ContentType",
    "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
    "publish": {
      "version": 7,
      "at": "2026-06-18T03:05:11.453Z",
      "firstAt": "2026-06-17T16:22:01.081Z",
      "counter": 4,
      "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } }
    },
    "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
    "createdAt": "2026-06-17T16:22:01.047Z",
    "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
    "updatedAt": "2026-06-18T03:05:11.453Z",
    "version": 8,
    "status": "Published"
  },
  "name": "Product",
  "displayField": "productName",
  "publishWithAuthor": false,
  "fields": [
    { "id": "3hzbux8gsnb4h", "name": "Product Name", "apiName": "productName", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
    { "id": "4usptben4t1z", "name": "Price", "apiName": "price", "type": "Long", "localized": false, "required": false, "validations": [], "disabled": false },
    { "id": "21zuem8be6o6j", "name": "Description", "apiName": "description", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false },
    { "id": "2mr5ylgtheegr", "name": "Photo", "apiName": "photo", "type": "Refer", "localized": false, "required": false, "validations": [], "disabled": false, "targetType": "Media" },
    {
      "id": "5bpmiwo2woq8",
      "name": "Brand",
      "apiName": "brand",
      "type": "Refer",
      "localized": false,
      "required": false,
      "validations": [
        { "referContentType": [ { "sys": { "id": "3trmXRM3RqbgSnifyg7PLjv7PDSdHg", "type": "Refer", "targetType": "ContentType" } } ] }
      ],
      "disabled": false,
      "targetType": "Content"
    }
  ]
}
```

Key properties:

- `sys.id`: The unique identifier of the *Content Type*. It goes into `{contentTypeId}` in the single-read, update, and delete paths.
- `name`: The name of the *Content Type* (e.g. `Product`).
- `displayField`: The `apiName` of the field used to represent each *Content* in the content studio list (e.g. `productName`).
- `publishWithAuthor`: Whether to include author information (`sys.createdBy` and `sys.updatedBy`) in the publish snapshot when a *Content* is published. The default is `false`, in which case the snapshot delivered to CDA/ACDA carries no author. This value applies at publish time and is not retroactive, so even if you later change it to `true`, *Content* that has already been published must be published again for the author to be filled in. The drafts handled by the management APIs (CMA/ACMA) carry `sys.createdBy` regardless of this setting. To expose the author (byline) in a delivery response, or to evaluate a permission rule's `createdBy` filter (including `:self`) on CDA/ACDA, this value must be `true` (see the `createdBy` filter description in [SpaceRole](/api/reference/cma/space-role.md) and [ServiceUserRole](/api/reference/cma/service-user-role.md)).
- `fields`: The list of fields this template defines. The structure of each entry is described in [Fields](#fields) below.

The `photo` field has `type` `Refer` and `targetType` `Media`, so it points to an uploaded file asset. The `brand` field is `Refer` + `targetType: Content`, and the `referContentType` in `validations` restricts it to reference only *Content* of a specific *Content Type* (here, "Brand").

## System properties (sys) {#system-properties-sys}

Every *Content Type* carries common system properties and *Content Type* specific properties in the `sys` object. `space`, `createdBy`, and `updatedBy` are in the `Refer` shape (`{ "sys": { "id", "type": "Refer", "targetType" } }`).

| Property | Type | Description |
|---|---|---|
| `id` | string | Unique resource identifier. |
| `type` | string | Resource kind. For a *Content Type* this is always `"ContentType"`. |
| `space` | Refer&lt;Space&gt; | The *Space* this *Content Type* belongs to. |
| `createdBy` | Refer&lt;User&gt; | The user who created it. |
| `createdAt` | string (date-time) | Creation time. |
| `updatedBy` | Refer&lt;User&gt; | The user who last updated it. |
| `updatedAt` | string (date-time) | Last update time. |
| `version` | integer (≥1) | Resource version. It increases by 1 with every change such as create, update, publish, and unpublish. |
| `status` | string (enum) | Publish status. One of `Draft`, `Changed`, `Published`, `Archived`. |
| `publish` | object | Publish history. See the keys below. |

Keys of the `publish` object:

| Key | Type | Description |
|---|---|---|
| `version` | integer | The `sys.version` at the time of the last publish. |
| `at` | string (date-time) | Last publish time. |
| `firstAt` | string (date-time) | First publish time. Preserved even after unpublishing. |
| `counter` | integer | Cumulative publish count. |
| `by` | Refer&lt;User&gt; | The user who last published. |

When you unpublish (`DELETE .../publish`), `version`, `at`, and `by` are removed from `publish`, leaving only `firstAt` and `counter`.

A *Content Type*'s `sys` does not have the `contentType` (self-reference) property found in a *Content*'s `sys`, because a *Content Type* is itself the template. It also has no `archive` property.

## Fields {#fields}

`fields` is the list of fields this *Content Type* defines. Each entry has the following structure (FieldDefinition).

| Key | Type | Description |
|---|---|---|
| `id` | string (1-64) | The unique identifier of the field. Assigned automatically on creation. |
| `name` | string (1-50) | The field name shown in the content studio (e.g. `Product Name`). |
| `apiName` | string (1-64) | The key that refers to this field in the API. Pattern `^[a-zA-Z0-9][a-zA-Z0-9-_]*$` (starts with a letter or digit, then letters, digits, `-`, `_`). |
| `type` | string (enum) | The type of the field. See [Field types (type)](#field-types-type) below. |
| `localized` | boolean | Whether it can hold multilingual values. |
| `required` | boolean | Whether input is required. |
| `validations` | array | The list of validation rules applied to the value. An empty array `[]` if there are no rules. See [Validations (validations)](#validations) below. |
| `disabled` | boolean | Whether it is disabled. |
| `targetType` | string (enum) | Only when `type` is `Refer`. Whether the reference target is `Content` or `Media`. |
| `items` | object | Only when `type` is `Array`. The definition of the array elements (a `Refer` element or a `ShortText` element). |

### Field types (type) {#field-types-type}

`type` determines how the value is stored and retrieved. Some types behave differently in search.

| `type` | Meaning | Value limit | Notes |
|---|---|---|---|
| `ShortText` | Short single-line text. | 64 characters | Suited for exact keyword lookup. |
| `LongText` | Long body text. | 5,120 characters | Supports full-text similarity search. |
| `RichText` | Formatted body. | 204,800 characters | Not searchable; used for formatted presentation. |
| `Long` | Integer. | | Example: price `price`. |
| `Number` | Real number (including decimals). | Finite values only | Infinity and NaN are not accepted. |
| `Boolean` | True/false. | | |
| `Date` | Date and time. | | |
| `Json` | Arbitrary JSON structure. | 5,120 characters serialized | Numbers inside the structure must also be finite. |
| `Location` | Location (coordinates). | `latitude` -90 to 90, `longitude` -180 to 180 | |
| `Refer` | A reference pointing to another resource. | | Specify `Content` or `Media` with `targetType`. |
| `Array` | An array holding multiple values. | 64 elements | Accompanied by an element definition in `items`. |

In the "Product" example, `Product Name` is `ShortText`, `Price` is `Long`, `Description` is `RichText`, `Photo` is `Refer` (`targetType: Media`), and `Brand` is `Refer` (`targetType: Content`).

A value limit is the platform ceiling set by the type, and it is checked when a value is written to a *Content*, not when the *Content Type* is created. Even if you set a larger ceiling with `size` in `validations`, the platform ceiling applies first. The elements of an `Array` are subject to the same limit as their element type, so in an array whose `items.type` is `ShortText`, no single element may exceed 64 characters. Writing a *Content* with a value over the limit is rejected, and the code for that is in [Content errors](/api/reference/cma/content.md#errors).

### Validations (validations) {#validations}

`validations` is an array of rules to apply to the field value. Each entry holds one of the following keys.

| Key | Shape | Description |
|---|---|---|
| `size` | `{ "min", "max" }` | The minimum and maximum of text length or array size. |
| `unique` | boolean | Forbids duplicate values within the same *Content Type*. |
| `regexp` | `{ "pattern", "flags" }` | The value must match the regular expression pattern. `pattern` required. |
| `prohibitRegexp` | `{ "pattern", "flags" }` | Rejects the value if it matches the regular expression pattern. `pattern` required. |
| `in` | array | The list of allowed values. Only values in the list pass. |
| `range` | `{ "min", "max" }` | The minimum and maximum of a numeric value. |
| `dateRange` | `{ "min", "max", "after", "before" }` | The allowed range of a date value. |
| `mediaMimetypeGroup` | array | The list of file types allowed in a `Refer` (`Media`) field. See the enum below. |
| `mediaImageDimensions` | `{ "width", "height" }` | Pixel constraints on the width and height of an image. |
| `mediaFileSize` | `{ "min", "max" }` | The minimum and maximum of file size (bytes). |
| `referContentType` | array | The list of *Content Type*s allowed for reference in a `Refer` (`Content`) field. Each entry is in the `Refer<ContentType>` shape. |
| `message` | string | A custom message to show when validation fails. |

Values usable in `mediaMimetypeGroup` (12 of them): `Attachment`, `Plaintext`, `Image`, `Audio`, `Video`, `RichText`, `Presentation`, `Spreadsheet`, `PdfDocument`, `Archive`, `Code`, `Markup`.

The `brand` field in the "Product" example uses `referContentType` to restrict references to only the "Brand" *Content Type* (whose `sys.id` is `3trmXRM3RqbgSnifyg7PLjv7PDSdHg`).

## Status and automatic publishing {#status-and-automatic-publishing}

A *Content Type* is **published automatically on create, update, and partial update**. This differs from *Content*. A *Content* only enters the delivery path after a separate publish call following creation, whereas a *Content Type*'s create response comes back as `status: "Published"` right away.

`status` is one of the following four values.

| `status` | Meaning |
|---|---|
| `Draft` | Not yet published. |
| `Changed` | Has been published before, but later changes are not yet published. |
| `Published` | Published with no unpublished changes. |
| `Archived` | Archived. |

`sys.version` increases by 1 with every change. Because a *Content Type* is updated and published at once, a single update raises `version` by 2 (the update itself +1, the automatic publish +1). In the "Notice" example, `version` is 2 right after creation (create +1, automatic publish +1) and `publish.counter` is 1. After a subsequent update, `version` becomes 4 and `publish.counter` becomes 2.

The only path by which a *Content Type* becomes `Draft` is an explicit unpublish (`DELETE .../publish`). When you unpublish, `status` becomes `Draft`, and `version`, `at`, and `by` are removed from the `publish` object, leaving only `firstAt` and `counter`.

## Constraints {#constraints}

| Target | Constraint |
|---|---|
| `name` (*Content Type*) | 1-64 characters, required. |
| `description` | 128 characters or fewer, optional. |
| `fields` | 1-80. Create, update, and partial update must all stay within this range. |
| `name` (field) | 1-50 characters, required. |
| `apiName` (field) | 1-64 characters, pattern `^[a-zA-Z0-9][a-zA-Z0-9-_]*$`, required. |

**Delete guard:** Deletion must satisfy both conditions.
- If even one *Content* uses this *Content Type*, it cannot be deleted. Delete all such *Content* first. This check is evaluated first.
- A *Content Type* in a published state (`Published`/`Changed`) cannot be deleted directly. Unpublish it first (`DELETE .../publish`) to make it `Draft`, then delete it (an `Archived` *Content Type* can also be deleted).

## Errors {#errors}

These are the codes you meet when working with a *Content Type*. For codes that are common to every resource, see [common errors](/api/reference/common/errors.md).

| Code | Condition |
|---|---|
| `WGL422010` | The caller tried to delete a *Content Type* while *Content* that uses that *Content Type* still existed. Unpublishing runs the same check, so while such *Content* remains, even the unpublish call is rejected with this code. |
| `WGL422009` | The caller tried to delete a *Content Type* in a published state (`Published`/`Changed`) without unpublishing that *Content Type* first. |
| `WGL422006` | The caller tried to unpublish a *Content Type* that was not in a published state. |
| `WGL400002` | The `fields` array exceeds the allowed number of entries. Create, update, and partial update all run this check. |
| `WGL400045` | The value written in `displayField` matches no `apiName` among the `fields` of that *Content Type*. |
| `WGL400046` | A field that must carry a companion property does not have that property. `Array` requires `items`, and `Refer` requires `targetType`. |
| `WGL400040` | Two or more fields have the same `apiName`. |

## API {#api}

The base URL for all endpoints below is `https://cma.weegloo.com/v1`, and a Bearer token that authenticates against CMA is required in the `Authorization` header. Update, partial update, publish, and unpublish must also send the `X-Weegloo-Version` header (the current resource's `sys.version`) for optimistic concurrency control.

```api-endpoint
{
  "title": "List Content Types",
  "method": "GET",
  "path": "/spaces/{spaceId}/content-types",
  "description": "Reads the list of Content Types in a Space, page by page.",
  "responseStatus": 200,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true }
  },
  "queryParameterSchema": {
    "limit": { "type": "integer", "description": "Number of items to return per page (1-100)", "default": 15 },
    "skip": { "type": "integer", "description": "Number of items to skip", "default": 0 },
    "next": { "type": "string", "description": "Next page cursor (the value obtained from links.next in the previous response)" },
    "prev": { "type": "string", "description": "Previous page cursor (the value obtained from links.prev in the previous response)" },
    "order": { "type": "string", "description": "Sort criteria. Comma-separated for multi-level sorting (e.g. sys.createdAt,sys.id)" },
    "select": { "type": "string", "description": "Fields to include (sys.id,sys.createdAt) or exclude (-sys.id). Do not mix include and exclude." },
    "include": { "type": "integer", "description": "Related-resource inclusion level. 0=default, 1=related resources, 2=nested relations, 3=full", "default": 0 }
  },
  "additionalQueryParams": true,
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" }
  },
  "responseExample": {
    "sys": { "type": "TotalPageResponse" },
    "limit": 15,
    "totalCount": 3,
    "items": [
      {
        "sys": {
          "id": "3trmXRM3RqbgSnifyg7PAmlxvX4fGY",
          "type": "ContentType",
          "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
          "publish": { "version": 7, "at": "2026-06-18T03:05:11.453Z", "firstAt": "2026-06-17T16:22:01.081Z", "counter": 4, "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } } },
          "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
          "createdAt": "2026-06-17T16:22:01.047Z",
          "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
          "updatedAt": "2026-06-18T03:05:11.453Z",
          "version": 8,
          "status": "Published"
        },
        "name": "Product",
        "displayField": "productName",
        "publishWithAuthor": false,
        "fields": [
          { "id": "3hzbux8gsnb4h", "name": "Product Name", "apiName": "productName", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
          { "id": "4usptben4t1z", "name": "Price", "apiName": "price", "type": "Long", "localized": false, "required": false, "validations": [], "disabled": false },
          { "id": "21zuem8be6o6j", "name": "Description", "apiName": "description", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false },
          { "id": "2mr5ylgtheegr", "name": "Photo", "apiName": "photo", "type": "Refer", "localized": false, "required": false, "validations": [], "disabled": false, "targetType": "Media" },
          { "id": "5bpmiwo2woq8", "name": "Brand", "apiName": "brand", "type": "Refer", "localized": false, "required": false, "validations": [ { "referContentType": [ { "sys": { "id": "3trmXRM3RqbgSnifyg7PLjv7PDSdHg", "type": "Refer", "targetType": "ContentType" } } ] } ], "disabled": false, "targetType": "Content" }
        ]
      },
      {
        "sys": {
          "id": "3trmXRM3RqbgSnifyg7PLjv7PDSdHg",
          "type": "ContentType",
          "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
          "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
          "createdAt": "2026-06-18T01:57:26.377Z",
          "updatedAt": "2026-06-18T01:57:26.404Z",
          "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
          "version": 2,
          "publish": { "version": 1, "at": "2026-06-18T01:57:26.404Z", "firstAt": "2026-06-18T01:57:26.404Z", "counter": 1, "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } } },
          "status": "Published"
        },
        "name": "Brand",
        "displayField": "brandName",
        "fields": [
          { "id": "31byfj01w9fav", "name": "Brand name", "apiName": "brandName", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
          { "id": "1j6wqqeyg2jws", "name": "Description", "apiName": "brandIntro", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false }
        ],
        "publishWithAuthor": false
      }
    ],
    "links": { "self": "/v1/spaces/tcq4V2Xb/content-types" }
  }
}
```

```api-endpoint
{
  "title": "Create Content Type",
  "method": "POST",
  "path": "/spaces/{spaceId}/content-types",
  "description": "Creates a new Content Type in a Space. It is published automatically on creation, so the status comes back as Published.",
  "responseStatus": 201,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true }
  },
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" }
  },
  "requestBodySchema": {
    "type": "object",
    "required": ["name", "fields", "publishWithAuthor"],
    "properties": {
      "name": { "type": "string", "minLength": 1, "maxLength": 64, "description": "Content Type name" },
      "description": { "type": "string", "maxLength": 128, "description": "Description (optional)" },
      "displayField": { "type": "string", "description": "The apiName of the field to represent each entry in the content studio list (optional)" },
      "publishWithAuthor": { "type": "boolean", "description": "Whether to include author information when a Content is published. Default false" },
      "fields": {
        "type": "array",
        "minItems": 1,
        "maxItems": 80,
        "description": "List of field definitions",
        "items": {
          "type": "object",
          "required": ["name", "apiName", "type", "validations"],
          "properties": {
            "name": { "type": "string", "minLength": 1, "maxLength": 50, "description": "Content studio display name" },
            "apiName": { "type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-_]*$", "description": "The key used in the API" },
            "type": { "type": "string", "enum": ["ShortText", "LongText", "RichText", "Long", "Number", "Boolean", "Date", "Json", "Location", "Refer", "Array"], "description": "Field type" },
            "localized": { "type": "boolean", "description": "Whether multilingual values are supported" },
            "required": { "type": "boolean", "description": "Whether input is required" },
            "validations": { "type": "array", "description": "List of validation rules. An empty array if none" },
            "disabled": { "type": "boolean", "description": "Whether it is disabled" },
            "targetType": { "type": "string", "enum": ["Content", "Media"], "description": "The reference target when type is Refer" },
            "items": { "type": "object", "description": "The element definition when type is Array" }
          }
        }
      }
    },
    "example": {
      "name": "Notice",
      "description": "A template for store notices",
      "displayField": "title",
      "publishWithAuthor": false,
      "fields": [
        { "name": "Title", "apiName": "title", "type": "ShortText", "localized": true, "required": true, "validations": [] },
        { "name": "Body", "apiName": "body", "type": "RichText", "localized": true, "required": false, "validations": [] }
      ]
    }
  },
  "responseExample": {
    "sys": {
      "id": "3trmXRM3RqbgSnifyg7PObiKeO5yRQ",
      "type": "ContentType",
      "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
      "publish": { "version": 1, "at": "2026-06-18T04:28:04.772Z", "firstAt": "2026-06-18T04:28:04.772Z", "counter": 1, "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } } },
      "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "createdAt": "2026-06-18T04:28:04.749Z",
      "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "updatedAt": "2026-06-18T04:28:04.772Z",
      "version": 2,
      "status": "Published"
    },
    "name": "Notice",
    "displayField": "title",
    "description": "A template for store notices",
    "publishWithAuthor": false,
    "fields": [
      { "id": "2fyii4h1hvb24", "name": "Title", "apiName": "title", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
      { "id": "22smuhm2ughlq", "name": "Body", "apiName": "body", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false }
    ]
  }
}
```

```api-endpoint
{
  "title": "Read a single Content Type",
  "method": "GET",
  "path": "/spaces/{spaceId}/content-types/{contentTypeId}",
  "description": "Reads one Content Type by sys.id.",
  "responseStatus": 200,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true },
    "contentTypeId": { "type": "string", "description": "The sys.id of the Content Type", "required": true }
  },
  "queryParameterSchema": {
    "include": { "type": "integer", "description": "Related-resource inclusion level. 0=default, 1=related resources, 2=nested relations, 3=full", "default": 0 }
  },
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" }
  },
  "responseExample": {
    "sys": {
      "id": "3trmXRM3RqbgSnifyg7PAmlxvX4fGY",
      "type": "ContentType",
      "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
      "publish": { "version": 7, "at": "2026-06-18T03:05:11.453Z", "firstAt": "2026-06-17T16:22:01.081Z", "counter": 4, "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } } },
      "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "createdAt": "2026-06-17T16:22:01.047Z",
      "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "updatedAt": "2026-06-18T03:05:11.453Z",
      "version": 8,
      "status": "Published"
    },
    "name": "Product",
    "displayField": "productName",
    "publishWithAuthor": false,
    "fields": [
      { "id": "3hzbux8gsnb4h", "name": "Product Name", "apiName": "productName", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
      { "id": "4usptben4t1z", "name": "Price", "apiName": "price", "type": "Long", "localized": false, "required": false, "validations": [], "disabled": false },
      { "id": "21zuem8be6o6j", "name": "Description", "apiName": "description", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false },
      { "id": "2mr5ylgtheegr", "name": "Photo", "apiName": "photo", "type": "Refer", "localized": false, "required": false, "validations": [], "disabled": false, "targetType": "Media" },
      { "id": "5bpmiwo2woq8", "name": "Brand", "apiName": "brand", "type": "Refer", "localized": false, "required": false, "validations": [ { "referContentType": [ { "sys": { "id": "3trmXRM3RqbgSnifyg7PLjv7PDSdHg", "type": "Refer", "targetType": "ContentType" } } ] } ], "disabled": false, "targetType": "Content" }
    ]
  }
}
```

```api-endpoint
{
  "title": "Update Content Type (full replace)",
  "method": "PUT",
  "path": "/spaces/{spaceId}/content-types/{contentTypeId}",
  "description": "Replaces the entire Content Type. All fields must be included in the body, and it is published automatically along with the update.",
  "responseStatus": 200,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true },
    "contentTypeId": { "type": "string", "description": "The sys.id of the Content Type", "required": true }
  },
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" },
    "X-Weegloo-Version": { "type": "integer", "description": "The current resource's sys.version (optimistic concurrency control)" }
  },
  "requestBodySchema": {
    "type": "object",
    "required": ["name", "fields", "publishWithAuthor"],
    "properties": {
      "name": { "type": "string", "minLength": 1, "maxLength": 64, "description": "Content Type name" },
      "description": { "type": "string", "maxLength": 128, "description": "Description (optional)" },
      "displayField": { "type": "string", "description": "The apiName of the representative field (optional)" },
      "publishWithAuthor": { "type": "boolean", "description": "Whether to include author information when a Content is published. Default false" },
      "fields": {
        "type": "array",
        "minItems": 1,
        "description": "List of field definitions (full). Keep the id for existing fields, and set id to null or omit it for new fields",
        "items": {
          "type": "object",
          "required": ["name", "apiName", "type", "validations"],
          "properties": {
            "id": { "type": "string", "minLength": 1, "maxLength": 64, "description": "Keep for existing fields, null for new ones" },
            "name": { "type": "string", "minLength": 1, "maxLength": 50 },
            "apiName": { "type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[a-zA-Z0-9][a-zA-Z0-9-_]*$" },
            "type": { "type": "string", "enum": ["ShortText", "LongText", "RichText", "Long", "Number", "Boolean", "Date", "Json", "Location", "Refer", "Array"] },
            "localized": { "type": "boolean" },
            "required": { "type": "boolean" },
            "validations": { "type": "array" },
            "disabled": { "type": "boolean" },
            "targetType": { "type": "string", "enum": ["Content", "Media"] },
            "items": { "type": "object" }
          }
        }
      }
    },
    "example": {
      "name": "Notice",
      "description": "A template for store notices and event announcements",
      "displayField": "title",
      "publishWithAuthor": false,
      "fields": [
        { "id": "2fyii4h1hvb24", "name": "Title", "apiName": "title", "type": "ShortText", "localized": true, "required": true, "validations": [] },
        { "id": "22smuhm2ughlq", "name": "Body", "apiName": "body", "type": "RichText", "localized": true, "required": false, "validations": [] }
      ]
    }
  },
  "responseExample": {
    "sys": {
      "id": "3trmXRM3RqbgSnifyg7PObiKeO5yRQ",
      "type": "ContentType",
      "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
      "publish": { "version": 3, "at": "2026-06-18T04:28:15.308Z", "firstAt": "2026-06-18T04:28:04.772Z", "counter": 2, "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } } },
      "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "createdAt": "2026-06-18T04:28:04.749Z",
      "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "updatedAt": "2026-06-18T04:28:15.308Z",
      "version": 4,
      "status": "Published"
    },
    "name": "Notice",
    "displayField": "title",
    "description": "A template for store notices and event announcements",
    "publishWithAuthor": false,
    "fields": [
      { "id": "2fyii4h1hvb24", "name": "Title", "apiName": "title", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
      { "id": "22smuhm2ughlq", "name": "Body", "apiName": "body", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false }
    ]
  }
}
```

```api-endpoint
{
  "title": "Partially update Content Type (JSON Patch)",
  "method": "PATCH",
  "path": "/spaces/{spaceId}/content-types/{contentTypeId}",
  "description": "Updates only part of a Content Type using RFC 6902 JSON Patch. The request Content-Type header must be application/json-patch+json, and it is published automatically along with the update.",
  "responseStatus": 200,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true },
    "contentTypeId": { "type": "string", "description": "The sys.id of the Content Type", "required": true }
  },
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" },
    "Content-Type": { "type": "string", "description": "application/json-patch+json (RFC 6902 JSON Patch)" },
    "X-Weegloo-Version": { "type": "integer", "description": "The current resource's sys.version (optimistic concurrency control)" }
  },
  "requestBodySchema": {
    "type": "array",
    "description": "An array of RFC 6902 JSON Patch operations (op / path / value / from). path is an RFC 6901 JSON Pointer.",
    "items": {
      "type": "object",
      "required": ["op", "path"],
      "properties": {
        "op": { "type": "string", "enum": ["add", "remove", "replace", "move", "copy", "test"], "description": "Operation kind" },
        "path": { "type": "string", "description": "Target location (JSON Pointer). Example: /description" },
        "value": { "description": "The value used by add/replace/test" },
        "from": { "type": "string", "description": "The source location for move/copy" }
      }
    },
    "example": [
      { "op": "replace", "path": "/description", "value": "A template for store notices and event announcements" }
    ]
  },
  "responseExample": {
    "sys": {
      "id": "3trmXRM3RqbgSnifyg7PObiKeO5yRQ",
      "type": "ContentType",
      "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
      "publish": { "version": 3, "at": "2026-06-18T04:28:15.308Z", "firstAt": "2026-06-18T04:28:04.772Z", "counter": 2, "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } } },
      "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "createdAt": "2026-06-18T04:28:04.749Z",
      "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "updatedAt": "2026-06-18T04:28:15.308Z",
      "version": 4,
      "status": "Published"
    },
    "name": "Notice",
    "displayField": "title",
    "description": "A template for store notices and event announcements",
    "publishWithAuthor": false,
    "fields": [
      { "id": "2fyii4h1hvb24", "name": "Title", "apiName": "title", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
      { "id": "22smuhm2ughlq", "name": "Body", "apiName": "body", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false }
    ]
  }
}
```

```api-endpoint
{
  "title": "Delete Content Type",
  "method": "DELETE",
  "path": "/spaces/{spaceId}/content-types/{contentTypeId}",
  "description": "Deletes a Content Type. On success it responds with 204 No Content and no response body. If any Content uses this Content Type, it cannot be deleted and that Content must be deleted first; if it is in a published state, it cannot be deleted and must be unpublished first.",
  "responseStatus": 204,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true },
    "contentTypeId": { "type": "string", "description": "The sys.id of the Content Type", "required": true }
  },
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" }
  }
}
```

```api-endpoint
{
  "title": "Publish Content Type",
  "method": "PUT",
  "path": "/spaces/{spaceId}/content-types/{contentTypeId}/publish",
  "description": "Publishes a Content Type to set its status to Published. Since create and update publish automatically, this is normally used to republish a Content Type that was unpublished.",
  "responseStatus": 200,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true },
    "contentTypeId": { "type": "string", "description": "The sys.id of the Content Type", "required": true }
  },
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" },
    "X-Weegloo-Version": { "type": "integer", "description": "The current resource's sys.version (optimistic concurrency control)" }
  },
  "responseExample": {
    "sys": {
      "id": "3trmXRM3RqbgSnifyg7PObiKeO5yRQ",
      "type": "ContentType",
      "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
      "publish": { "version": 5, "at": "2026-06-18T04:28:21.697Z", "firstAt": "2026-06-18T04:28:04.772Z", "counter": 4, "by": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } } },
      "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "createdAt": "2026-06-18T04:28:04.749Z",
      "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "updatedAt": "2026-06-18T04:28:21.697Z",
      "version": 6,
      "status": "Published"
    },
    "name": "Notice",
    "displayField": "title",
    "description": "A template for store notices and event announcements",
    "publishWithAuthor": false,
    "fields": [
      { "id": "2fyii4h1hvb24", "name": "Title", "apiName": "title", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
      { "id": "22smuhm2ughlq", "name": "Body", "apiName": "body", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false }
    ]
  }
}
```

```api-endpoint
{
  "title": "Unpublish Content Type",
  "method": "DELETE",
  "path": "/spaces/{spaceId}/content-types/{contentTypeId}/publish",
  "description": "Unpublishes a Content Type to set its status to Draft. To delete a published Content Type, this call is required first. In the response, version, at, and by are removed from the publish object, leaving only firstAt and counter.",
  "responseStatus": 200,
  "baseUrl": "https://cma.weegloo.com/v1",
  "pathParameterSchema": {
    "spaceId": { "type": "string", "description": "The sys.id of the Space", "required": true },
    "contentTypeId": { "type": "string", "description": "The sys.id of the Content Type", "required": true }
  },
  "requestHeaderSchema": {
    "Authorization": { "type": "string", "description": "Bearer token (CMA authentication)" },
    "X-Weegloo-Version": { "type": "integer", "description": "The current resource's sys.version (optimistic concurrency control)" }
  },
  "responseExample": {
    "sys": {
      "id": "3trmXRM3RqbgSnifyg7PObiKeO5yRQ",
      "type": "ContentType",
      "space": { "sys": { "id": "tcq4V2Xb", "type": "Refer", "targetType": "Space" } },
      "publish": { "firstAt": "2026-06-18T04:28:04.772Z", "counter": 3 },
      "createdBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "createdAt": "2026-06-18T04:28:04.749Z",
      "updatedBy": { "sys": { "id": "3p4tcFbQRwz503VXdtHXNI5dZH5TVB", "type": "Refer", "targetType": "User" } },
      "updatedAt": "2026-06-18T04:28:18.624Z",
      "version": 5,
      "status": "Draft"
    },
    "name": "Notice",
    "displayField": "title",
    "description": "A template for store notices and event announcements",
    "publishWithAuthor": false,
    "fields": [
      { "id": "2fyii4h1hvb24", "name": "Title", "apiName": "title", "type": "ShortText", "localized": true, "required": true, "validations": [], "disabled": false },
      { "id": "22smuhm2ughlq", "name": "Body", "apiName": "body", "type": "RichText", "localized": true, "required": false, "validations": [], "disabled": false }
    ]
  }
}
```

## Related documents {#related-documents}

- [Content modeling](/getting-started/core-concepts/content/content-modeling.md): How to create a *Content Type* in the content studio.
- [Status and publishing](/getting-started/core-concepts/common/states-and-versions.md): What publishing and versions mean.
