---
title: Create content type
slug: cms-13/api/create-content-type
docTags: 
createdAt: 2026-08-28T15:24:16.532Z
---

{
  "id": "1XKeBBUlYo6GRfp7PKajx",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "/_cms/v1/contenttypes",
    "servers": [
      {
        "url": "/_cms/v1/contenttypes",
        "description": "Optimizely CMS API"
      }
    ],
    "name": "Create content type",
    "description": "Create a new content type.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        },
        {
          "kind": "optional",
          "name": "Prefer",
          "type": "array",
          "example": "[\"return=representation\"]",
          "description": "<p>Indicates client preference for the response content as per IETF RFC7240. Currently only supports 'return=representation' which can be used to indicate a preference to receive a representation of the resource that has been altered in the response.</p>",
          "schema": [],
          "itemType": "string",
          "customType": "string[]"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "The content type that should be created.",
          "customType": "ContentType",
          "schema": [
            {
              "name": "key",
              "kind": "optional",
              "type": "string",
              "description": "<p>The unique identifier (key) of the resource.</p>",
              "minLength": 2,
              "maxLength": 255,
              "pattern": "^[A-Za-z][_0-9A-Za-z]+$"
            },
            {
              "name": "displayName",
              "kind": "required",
              "type": "string",
              "description": "The display name of this ContentType.",
              "minLength": 1,
              "maxLength": 255
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "A description of this ContentType.",
              "maxLength": 255
            },
            {
              "name": "baseType",
              "kind": "optional",
              "type": "string",
              "nullable": true,
              "description": "<p>The base type of this ContentType. Ignored for contracts; required for all other content types.</p>"
            },
            {
              "name": "isContract",
              "kind": "optional",
              "type": "boolean",
              "description": "Specifies if the ContentType is a contract type."
            },
            {
              "name": "sortOrder",
              "kind": "optional",
              "type": "integer<int32>",
              "description": "A value that is used to when sorting ContentType instances.",
              "format": "int32"
            },
            {
              "name": "mayContainTypes",
              "kind": "optional",
              "type": "array",
              "description": "Provides a set of content types that can be created in containers of this type",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "mediaFileExtensions",
              "kind": "optional",
              "type": "array",
              "description": "Provides a set of media file extensions that this content type can handle.",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "compositionBehaviors",
              "kind": "optional",
              "type": "array",
              "description": "Provides a set of composition behaviors specifying how this content type can be used within compositions. Currently this can only be assigned when baseType is 'component'.",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "contracts",
              "kind": "optional",
              "type": "array",
              "description": "Provides a set of contract content types that this content type is bound to.",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            },
            {
              "name": "properties",
              "kind": "optional",
              "type": "map",
              "description": "Dictionary with all custom properties of this ContentType.",
              "example": "",
              "customType": "map<string, ContentTypeProperty>",
              "schema": []
            },
            {
              "name": "accessRights",
              "kind": "optional",
              "type": "array",
              "nullable": true,
              "description": "<p>The access rights assigned to this content type that defines who can create content of this type. If no access rights are assigned, everyone will be able to create content of this type. An empty array means that no new content of this type can be created.</p>",
              "modelRef": "#/components/schemas/SecurityIdentity",
              "customType": "SecurityIdentity[]",
              "schema": [
                {
                  "name": "name",
                  "kind": "required",
                  "type": "string",
                  "description": "<p>The unique name of the user, role or application that this identifier references.</p>",
                  "minLength": 1,
                  "maxLength": 255
                },
                {
                  "name": "type",
                  "kind": "optional",
                  "type": "string<user | role | application>",
                  "description": "The type of the security entity that this identifier references. Will default to 'role' if not specified.",
                  "enum": [
                    "user",
                    "role",
                    "application"
                  ]
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/ContentType",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiAuth",
          "name": "apiAuth",
          "kind": "optional",
          "type": "oauth2",
          "description": "Use this scheme to generate an access token that can be used to access the API.",
          "oauth2Flows": {
            "clientCredentials": {
              "tokenUrl": "/_cms/v1/oauth/token",
              "scopes": {
                "api:admin": "Grants full administrative access to the API"
              }
            }
          },
          "requiredScopes": [
            "api:admin"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Created",
        "jsonExample": "",
        "isExpanded": true,
        "headers": [
          {
            "kind": "optional",
            "name": "ETag",
            "type": "string",
            "description": "<p>The RFC7232 ETag header field in a response provides the current entity-tag for the resource. An entity-tag is an opaque identifier for different versions of a resource over time, regardless whether multiple versions are valid at the same time.</p>"
          },
          {
            "kind": "optional",
            "name": "Last-Modified",
            "type": "string<http-date>",
            "description": "The date and time at which the resource was last modified.",
            "format": "http-date"
          },
          {
            "kind": "optional",
            "name": "Location",
            "type": "string",
            "description": "<p>Indicates the URL of the newly-created resource.</p>"
          },
          {
            "kind": "optional",
            "name": "Preference-Applied",
            "description": ""
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Represents a content type definition.",
            "customType": "ContentType",
            "schema": [
              {
                "name": "key",
                "kind": "optional",
                "type": "string",
                "description": "<p>The unique identifier (key) of the resource.</p>",
                "minLength": 2,
                "maxLength": 255,
                "pattern": "^[A-Za-z][_0-9A-Za-z]+$"
              },
              {
                "name": "displayName",
                "kind": "required",
                "type": "string",
                "description": "The display name of this ContentType.",
                "minLength": 1,
                "maxLength": 255
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "description": "A description of this ContentType.",
                "maxLength": 255
              },
              {
                "name": "baseType",
                "kind": "optional",
                "type": "string",
                "nullable": true,
                "description": "<p>The base type of this ContentType. Ignored for contracts; required for all other content types.</p>"
              },
              {
                "name": "isContract",
                "kind": "optional",
                "type": "boolean",
                "description": "Specifies if the ContentType is a contract type."
              },
              {
                "name": "source",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "A string that indicates the source of this content type. Can be used to distinguish content types created by the system from types coming from model classes in the CMS solution."
              },
              {
                "name": "sortOrder",
                "kind": "optional",
                "type": "integer<int32>",
                "description": "A value that is used to when sorting ContentType instances.",
                "format": "int32"
              },
              {
                "name": "mayContainTypes",
                "kind": "optional",
                "type": "array",
                "description": "Provides a set of content types that can be created in containers of this type",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "mediaFileExtensions",
                "kind": "optional",
                "type": "array",
                "description": "Provides a set of media file extensions that this content type can handle.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "compositionBehaviors",
                "kind": "optional",
                "type": "array",
                "description": "Provides a set of composition behaviors specifying how this content type can be used within compositions. Currently this can only be assigned when baseType is 'component'.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "contracts",
                "kind": "optional",
                "type": "array",
                "description": "Provides a set of contract content types that this content type is bound to.",
                "example": "",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "created",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "A timestamp indicating when this resource was first created.",
                "format": "date-time"
              },
              {
                "name": "createdBy",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "The name of the user or application that created this resource."
              },
              {
                "name": "lastModified",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Indicates the last time this resource was modified.",
                "format": "date-time"
              },
              {
                "name": "lastModifiedBy",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "The name of the user or application that last modified this resource."
              },
              {
                "name": "properties",
                "kind": "optional",
                "type": "map",
                "description": "Dictionary with all custom properties of this ContentType.",
                "example": "",
                "customType": "map<string, ContentTypeProperty>",
                "schema": []
              },
              {
                "name": "accessRights",
                "kind": "optional",
                "type": "array",
                "nullable": true,
                "description": "<p>The access rights assigned to this content type that defines who can create content of this type. If no access rights are assigned, everyone will be able to create content of this type. An empty array means that no new content of this type can be created.</p>",
                "modelRef": "#/components/schemas/SecurityIdentity",
                "customType": "SecurityIdentity[]",
                "schema": [
                  {
                    "name": "name",
                    "kind": "required",
                    "type": "string",
                    "description": "<p>The unique name of the user, role or application that this identifier references.</p>",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  {
                    "name": "type",
                    "kind": "optional",
                    "type": "string<user | role | application>",
                    "description": "The type of the security entity that this identifier references. Will default to 'role' if not specified.",
                    "enum": [
                      "user",
                      "role",
                      "application"
                    ]
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/ContentType",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Unauthorized",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "409",
        "description": "Conflict",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "sqD964x9-tpzZHNB0-bVI",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url /_cms/v1/contenttypes \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"displayName\": \"\",\n     \"accessRights\": [\n     {\n     \"name\": \"\"\n     }\n     ]\n     }'"
        },
        {
          "id": "XQAK2VgUnderl_FJrEJqe",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"displayName\": \"\",\n   \"accessRights\": [\n      {\n         \"name\": \"\"\n      }\n   ]\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"/_cms/v1/contenttypes\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "VnT41Law5kvJUNsreYmfo",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/_cms/v1/contenttypes\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"displayName\": \"\",\n   \"accessRights\": [\n      {\n         \"name\": \"\"\n      }\n   ]\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "PSqgs_jY_rl5op1ANzAz9",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/_cms/v1/contenttypes\"\n\npayload = json.dumps({\n   \"displayName\": \"\",\n   \"accessRights\": [\n      {\n         \"name\": \"\"\n      }\n   ]\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "sqD964x9-tpzZHNB0-bVI"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// Created\n{\n  \"key\": \"\",\n  \"displayName\": \"\",\n  \"description\": \"\",\n  \"baseType\": \"\",\n  \"isContract\": false,\n  \"source\": \"\",\n  \"sortOrder\": \"\",\n  \"mayContainTypes\": [\n    \"\"\n  ],\n  \"mediaFileExtensions\": [\n    \"\"\n  ],\n  \"compositionBehaviors\": [\n    \"\"\n  ],\n  \"contracts\": [\n    \"\"\n  ],\n  \"created\": \"\",\n  \"createdBy\": \"\",\n  \"lastModified\": \"\",\n  \"lastModifiedBy\": \"\",\n  \"properties\": \"\",\n  \"accessRights\": [\n    {\n      \"name\": \"\",\n      \"type\": \"\"\n    }\n  ]\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized\n"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Forbidden\n"
        },
        {
          "id": "response-4-409",
          "language": "409",
          "code": "// Conflict\n"
        },
        {
          "id": "response-5-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}