---
title: Update a Feature
slug: web-experimentation/api/update-a-feature
docTags: 
createdAt: 2026-10-02T13:15:18.296Z
---

{
  "id": "G_FrWn-bjspTYyISMnoWx",
  "type": "api-oas-v2",
  "data": {
    "method": "PATCH",
    "url": "https://api.optimizely.com/v2/features/{feature_id}",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/features/{feature_id}"
      }
    ],
    "name": "Update a Feature",
    "description": "Update a feature by ID.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "feature_id",
          "type": "integer<int64>",
          "description": "The unique identifier for the Feature",
          "format": "int64"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "A string in JSON format that includes all the fields you'd like to change for a Feature",
          "customType": "FeatureUpdate",
          "schema": [
            {
              "name": "archived",
              "kind": "optional",
              "type": "boolean",
              "description": "Whether the Feature has been archived"
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "A short description of this Feature"
            },
            {
              "name": "environments",
              "kind": "optional",
              "type": "map",
              "description": "<p>The configuration for this Feature's Rollout within each Environment, keyed by Environment key.</p>",
              "example": "",
              "customType": "map<string, FeatureEnvironment>",
              "schema": []
            },
            {
              "name": "key",
              "kind": "optional",
              "type": "string",
              "description": "Unique string identifier for this Feature within the Project",
              "example": "new_checkout_page",
              "maxLength": 64,
              "pattern": "^[a-zA-Z0-9_\\-]+$"
            },
            {
              "name": "name",
              "kind": "optional",
              "type": "string",
              "description": "Name of the Feature",
              "example": "the checkout feature"
            },
            {
              "name": "variables",
              "kind": "optional",
              "type": "array",
              "description": "<p>Variables define the dynamic configuration of a feature, and each variable can take on a different value on a per-variation basis within a feature test.</p>",
              "modelRef": "#/components/schemas/FeatureVariableUpdate",
              "customType": "FeatureVariableUpdate[]",
              "schema": [
                {
                  "name": "archived",
                  "kind": "optional",
                  "type": "boolean",
                  "description": "Whether or not this Feature Variable is archived",
                  "default": false
                },
                {
                  "name": "default_value",
                  "kind": "optional",
                  "type": "string",
                  "description": "The stringified default value for this Feature Variable. The default value is the value Optimizely SDKs will return when this Feature Variable is accessed by getFeatureVariableValue unless the Feature Variable's value is a part of a feature test variation.",
                  "example": "0.05"
                },
                {
                  "name": "description",
                  "kind": "optional",
                  "type": "string",
                  "description": "A short description of this Feature Variable"
                },
                {
                  "name": "id",
                  "kind": "optional",
                  "type": "integer<int64>",
                  "description": "The ID of this Feature Variable",
                  "format": "int64"
                },
                {
                  "name": "key",
                  "kind": "optional",
                  "type": "string",
                  "description": "Unique string identifier for this Feature Variable within the Feature"
                },
                {
                  "name": "type",
                  "kind": "optional",
                  "type": "string<boolean | string | double | integer | json>",
                  "description": "The datatype for this Feature Variable",
                  "enum": [
                    "boolean",
                    "string",
                    "double",
                    "integer",
                    "json"
                  ]
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/FeatureUpdate",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "<p>Write applications that authenticate with the REST API via OAuth 2.0. Or, to authenticate using a personal token, see <a href=\"https://docs.developers.optimizely.com/web/docs/personal-token\" target=\"_blank\">https://docs.developers.optimizely.com/web/docs/personal-token</a></p>",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Full access to your account"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successfully updated the Feature",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Feature",
            "schema": [
              {
                "name": "archived",
                "kind": "optional",
                "type": "boolean",
                "description": "Whether the Feature has been archived",
                "default": false
              },
              {
                "name": "created",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Time when the Feature was created",
                "format": "date-time"
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "description": "A short description of this Feature"
              },
              {
                "name": "environments",
                "kind": "optional",
                "type": "map",
                "description": "<p>The configuration for this Feature's Rollout within each Environment, keyed by Environment key</p>",
                "example": "",
                "customType": "map<string, FeatureEnvironment>",
                "schema": []
              },
              {
                "name": "id",
                "kind": "optional",
                "type": "integer<int64>",
                "readOnly": true,
                "description": "The ID of this Feature",
                "format": "int64"
              },
              {
                "name": "key",
                "kind": "required",
                "type": "string",
                "description": "Unique string identifier for this Feature within the Project",
                "example": "new_checkout_page",
                "maxLength": 64,
                "pattern": "^[a-zA-Z0-9_\\-]+$"
              },
              {
                "name": "last_modified",
                "kind": "optional",
                "type": "string<date-time>",
                "readOnly": true,
                "description": "Date last modified",
                "format": "date-time"
              },
              {
                "name": "name",
                "kind": "optional",
                "type": "string",
                "description": "Name of the Feature",
                "example": "the checkout feature"
              },
              {
                "name": "project_id",
                "kind": "required",
                "type": "integer<int64>",
                "description": "The ID of the Project this Feature belongs to",
                "format": "int64"
              },
              {
                "name": "variables",
                "kind": "optional",
                "type": "array",
                "description": "<p>Variables define the dynamic configuration of a feature, and each variable can take on a different value on a per-variation basis within a feature test.</p>",
                "modelRef": "#/components/schemas/FeatureVariable",
                "customType": "FeatureVariable[]",
                "schema": [
                  {
                    "name": "archived",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "Whether or not this Feature Variable is archived",
                    "default": false
                  },
                  {
                    "name": "default_value",
                    "kind": "required",
                    "type": "string",
                    "description": "The stringified default value for this Feature Variable. The default value is the value Optimizely SDKs will return when this Feature Variable is accessed by getFeatureVariableValue unless the Feature Variable's value is a part of a feature test variation.",
                    "example": "0.05"
                  },
                  {
                    "name": "id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "readOnly": true,
                    "description": "The ID of this Feature Variable",
                    "format": "int64"
                  },
                  {
                    "name": "key",
                    "kind": "required",
                    "type": "string",
                    "description": "Unique string identifier for this Feature Variable within the Feature"
                  },
                  {
                    "name": "type",
                    "kind": "required",
                    "type": "string<boolean | string | double | integer | json>",
                    "description": "The datatype for this Feature Variable",
                    "example": "double",
                    "enum": [
                      "boolean",
                      "string",
                      "double",
                      "integer",
                      "json"
                    ]
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/Feature",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid request body content",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Invalid credentials",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "You do not have permission to update specified Feature",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Feature not found",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "default",
        "description": "Unexpected error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "Error",
            "schema": [
              {
                "name": "code",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": ""
              },
              {
                "name": "messages",
                "kind": "optional",
                "type": "object",
                "description": "",
                "example": "",
                "schema": []
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string<uuid>",
                "description": "",
                "format": "uuid"
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "pCwHlEDtYWJDciJLK94tR",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url https://api.optimizely.com/v2/features/{feature_id} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "fUqOEja-kuH7sgKTfJ7VM",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'PATCH',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/v2/features/{feature_id}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "lex40KxyAfblSY-rjIoQE",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/features/{feature_id}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "-6YhbF_AoYQzvmmdAgm3e",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/features/{feature_id}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "pCwHlEDtYWJDciJLK94tR"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successfully updated the Feature\n{\n  \"archived\": false,\n  \"created\": \"\",\n  \"description\": \"\",\n  \"environments\": \"\",\n  \"id\": \"\",\n  \"key\": \"new_checkout_page\",\n  \"last_modified\": \"\",\n  \"name\": \"the checkout feature\",\n  \"project_id\": \"\",\n  \"variables\": [\n    {\n      \"archived\": false,\n      \"default_value\": \"0.05\",\n      \"id\": \"\",\n      \"key\": \"\",\n      \"type\": \"double\"\n    }\n  ]\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Invalid request body content\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Invalid credentials\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// You do not have permission to update specified Feature\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-4-404",
          "language": "404",
          "code": "// Feature not found\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        },
        {
          "id": "response-5-default",
          "language": "default",
          "code": "// Unexpected error\n{\n  \"code\": \"\",\n  \"message\": \"\",\n  \"messages\": {},\n  \"uuid\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}