---
title: Patch display template
slug: cms-13/api/patch-display-template
docTags: 
createdAt: 2026-08-28T15:24:16.532Z
---

{
  "id": "s4gPUSpPbxBP3CBTucOCC",
  "type": "api-oas-v2",
  "data": {
    "method": "PATCH",
    "url": "/_cms/v1/displaytemplates/{key}",
    "servers": [
      {
        "url": "/_cms/v1/displaytemplates/{key}",
        "description": "Optimizely CMS API"
      }
    ],
    "name": "Patch display template",
    "description": "Patch an existing display template.",
    "contentType": "application/merge-patch+json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "key",
          "type": "string",
          "description": "The key of the display template to patch."
        }
      ],
      "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[]"
        },
        {
          "kind": "optional",
          "name": "If-Match",
          "type": "string",
          "description": "<p>If provided, the PATCH request will only be considered if the value matches the RFC7232 ETag of the current resource. Weak ETags will always be ignored.</p>"
        },
        {
          "kind": "optional",
          "name": "If-Unmodified-Since",
          "type": "string<http-date>",
          "description": "<p>If provided, the PATCH request will only be considered if the resource has not been modified since the provided date. This parameter will be ignored if an 'If-Match' parameter is also provided.</p>",
          "format": "http-date"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "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": "200",
        "description": "OK",
        "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": "Preference-Applied",
            "description": ""
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Describes a display template that can be assigned to content.",
            "customType": "DisplayTemplate",
            "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 display template.",
                "minLength": 1,
                "maxLength": 255
              },
              {
                "name": "nodeType",
                "kind": "optional",
                "type": "string",
                "description": "The optional node type this display template is valid for.",
                "minLength": 2,
                "maxLength": 50,
                "pattern": "^[A-Za-z][_0-9A-Za-z]+$"
              },
              {
                "name": "baseType",
                "kind": "optional",
                "type": "string",
                "nullable": true,
                "description": "The optional base type this display template is valid for."
              },
              {
                "name": "contentType",
                "kind": "optional",
                "type": "string",
                "description": "The optional key of the content type this display template is valid for."
              },
              {
                "name": "isDefault",
                "kind": "optional",
                "type": "boolean",
                "description": "<p>If this is the default display template for the associated base type, node type or content type.</p>"
              },
              {
                "name": "created",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "A timestamp indicating when this display template was first created.",
                "format": "date-time"
              },
              {
                "name": "createdBy",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "The username of the user that created this display template."
              },
              {
                "name": "lastModified",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "A timestamp indicating when this display template was last modified.",
                "format": "date-time"
              },
              {
                "name": "lastModifiedBy",
                "kind": "optional",
                "type": "string",
                "readOnly": true,
                "description": "The username of the user that last modified this display template."
              },
              {
                "name": "settings",
                "kind": "optional",
                "type": "map",
                "description": "The available settings for this display template.",
                "example": "",
                "customType": "map<string, DisplaySetting>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/DisplayTemplate",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "204",
        "description": "No Content",
        "jsonExample": "",
        "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": "404",
        "description": "Not Found",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "412",
        "description": "Precondition Failed",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "Dp0os6vUeOPIEMDRmg-vG",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url /_cms/v1/displaytemplates/{key} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "_KhQP487OLHZMaDl_T-_b",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/merge-patch+json\");\n\nvar requestOptions = {\n   method: 'PATCH',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"/_cms/v1/displaytemplates/{key}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "IgmOQxkEog4Lz-wvGovLa",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"/_cms/v1/displaytemplates/{key}\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/merge-patch+json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "bWxVifQhFyNErVH-vUVcS",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"/_cms/v1/displaytemplates/{key}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/merge-patch+json'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "Dp0os6vUeOPIEMDRmg-vG"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// OK\n{\n  \"key\": \"\",\n  \"displayName\": \"\",\n  \"nodeType\": \"\",\n  \"baseType\": \"\",\n  \"contentType\": \"\",\n  \"isDefault\": false,\n  \"created\": \"\",\n  \"createdBy\": \"\",\n  \"lastModified\": \"\",\n  \"lastModifiedBy\": \"\",\n  \"settings\": \"\"\n}"
        },
        {
          "id": "response-1-204",
          "language": "204",
          "code": "// No Content\n"
        },
        {
          "id": "response-2-400",
          "language": "400",
          "code": "// Bad Request\n"
        },
        {
          "id": "response-3-401",
          "language": "401",
          "code": "// Unauthorized\n"
        },
        {
          "id": "response-4-403",
          "language": "403",
          "code": "// Forbidden\n"
        },
        {
          "id": "response-5-404",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "response-6-412",
          "language": "412",
          "code": "// Precondition Failed\n"
        },
        {
          "id": "response-7-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}