---
title: Update approval status for a flag in an environment
slug: feature-experimentation/api/update-approval-status-for-a-flag-in-an-environment
docTags: 
createdAt: 2026-10-13T18:16:15.508Z
---

{
  "id": "mV1IX0pk-Psccd0Fqo2XQ",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/status",
    "servers": [
      {
        "url": "http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/status",
        "description": "Local server"
      },
      {
        "url": "https://api.app.optimizely.com/flags-scheduling/projects/{project_id}/flags/{flag_key}/approval/{approval_id}/status",
        "description": "Production server"
      }
    ],
    "name": "Update approval status for a flag in an environment",
    "description": "Update approval status for a flag in an environment\n\nThe schedule change contains a set of actions to update the flag in that environment at a specific time\n",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer",
          "description": ""
        },
        {
          "kind": "required",
          "name": "flag_key",
          "type": "string",
          "description": ""
        },
        {
          "kind": "required",
          "name": "approval_id",
          "type": "integer",
          "description": ""
        }
      ],
      "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": "",
          "customType": "ApprovalStatusUpdateRequest",
          "schema": [
            {
              "name": "status",
              "kind": "required",
              "type": "string<accepted | rejected | withdrawn>",
              "description": "Approval update statuses",
              "enum": [
                "accepted",
                "rejected",
                "withdrawn"
              ]
            },
            {
              "name": "reason",
              "kind": "required",
              "type": "string",
              "description": ""
            }
          ],
          "modelRef": "#/components/schemas/ApprovalStatusUpdateRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "BearerAuth",
          "name": "BearerAuth",
          "kind": "optional",
          "type": "http",
          "description": "<p>To get 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>",
          "scheme": "bearer"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "201",
        "description": "Successful Response",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "ScheduledChange",
            "schema": [
              {
                "name": "id",
                "kind": "required",
                "type": "integer",
                "description": "The unique identifier for the schedule."
              },
              {
                "name": "account_id",
                "kind": "required",
                "type": "integer",
                "description": "The account the Project is associated with."
              },
              {
                "name": "project_id",
                "kind": "required",
                "type": "integer",
                "description": "The id of the project for which the schedule is set."
              },
              {
                "name": "flag_key",
                "kind": "required",
                "type": "string",
                "description": "The Flag identifier"
              },
              {
                "name": "environment",
                "kind": "required",
                "type": "string",
                "description": "The Environment of the flag"
              },
              {
                "name": "actions",
                "kind": "required",
                "type": "array",
                "description": "Schedule actions.",
                "modelRef": "#/components/schemas/ScheduleAction",
                "customType": "ScheduleAction[]",
                "schema": [
                  {
                    "name": "subject",
                    "kind": "required",
                    "type": "object",
                    "description": "The entity this action will apply to",
                    "example": "",
                    "schema": [
                      {
                        "name": "key",
                        "kind": "optional",
                        "type": "string",
                        "description": "The identifier of the subject"
                      },
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string<flag | rule>",
                        "description": "The type of subject. Can be a flag or a rule of the flag",
                        "enum": [
                          "flag",
                          "rule"
                        ]
                      }
                    ]
                  },
                  {
                    "name": "changed_element",
                    "kind": "required",
                    "type": "string<status | percentage_included | audience_conditions>",
                    "description": "",
                    "enum": [
                      "status",
                      "percentage_included",
                      "audience_conditions"
                    ]
                  },
                  {
                    "name": "value",
                    "kind": "required",
                    "type": "object",
                    "description": "Value of the action. Can be of any type.",
                    "modelRef": "#/components/schemas/ActionValue",
                    "customType": "ActionValue",
                    "schema": [],
                    "complexType": "anyOf",
                    "complexItems": [
                      {
                        "name": "object",
                        "description": "",
                        "schema": []
                      },
                      {
                        "name": "object",
                        "description": "",
                        "schema": []
                      }
                    ]
                  }
                ]
              },
              {
                "name": "schedule",
                "kind": "required",
                "type": "object",
                "description": "Schedule details.",
                "complexType": "allOf",
                "complexItems": [
                  {
                    "name": "ScheduledTimeWithUTC",
                    "description": "",
                    "modelRef": "#/components/schemas/ScheduledTimeWithUTC",
                    "schema": [
                      {
                        "name": "time",
                        "kind": "required",
                        "type": "string",
                        "description": "<p>The schedule will run at this time. Expected format: hh</p><div></div> (24 hour)<p></p>",
                        "example": "07:02"
                      },
                      {
                        "name": "time_zone",
                        "kind": "required",
                        "type": "string",
                        "description": "The timezone information for the scheduled time. Must be an IANA timezone.",
                        "example": "Etc/UTC"
                      },
                      {
                        "name": "date",
                        "kind": "required",
                        "type": "string",
                        "description": "<p>The schedule will run at this date. Expected format: yyyy-mm-dd.</p>",
                        "example": "2023-07-30"
                      },
                      {
                        "name": "utc_time",
                        "kind": "required",
                        "type": "string",
                        "description": "The utc timestamp when the scheduled job will be executed.",
                        "example": "2023-07-30T07:02:00+0000"
                      }
                    ]
                  }
                ],
                "schema": []
              },
              {
                "name": "status",
                "kind": "required",
                "type": "string",
                "description": "The status of the scheduled job."
              },
              {
                "name": "approval_status",
                "kind": "optional",
                "type": "string<pending | accepted | rejected | withdrawn>",
                "nullable": true,
                "description": "<p>The current approval status for a change-request-backed schedule. Present only when approval is required; null for non-gated or pure-legacy schedules.</p>",
                "enum": [
                  "pending",
                  "accepted",
                  "rejected",
                  "withdrawn"
                ]
              },
              {
                "name": "completed_at",
                "kind": "required",
                "type": "string<date-time>",
                "nullable": true,
                "description": "The UTC timestamp when the schedule is completed.",
                "example": "2023-04-15T20:14+0000",
                "format": "date-time"
              },
              {
                "name": "updated_at",
                "kind": "required",
                "type": "string<date-time>",
                "description": "The UTC timestamp when the schedule is updated.",
                "example": "2023-04-15T20:14+0000",
                "format": "date-time"
              },
              {
                "name": "created_at",
                "kind": "required",
                "type": "string<date-time>",
                "description": "The UTC timestamp when the schedule is created.",
                "example": "2023-04-15T20:14+0000",
                "format": "date-time"
              },
              {
                "name": "updated_by",
                "kind": "required",
                "type": "string",
                "description": "The user who updated the schedule."
              },
              {
                "name": "created_by",
                "kind": "required",
                "type": "string",
                "description": "The user who created the schedule."
              }
            ],
            "modelRef": "#/components/schemas/ScheduledChange",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Not Authenticated",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"details\":\"Not authenticated\",\"status\":401}",
            "description": "",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "details",
                "kind": "required",
                "type": "string",
                "description": "Details of Error."
              },
              {
                "name": "status",
                "kind": "required",
                "type": "integer",
                "description": "Status code of the response.",
                "example": 400
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "422",
        "description": "Validation Error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "HTTPValidationError",
            "schema": [
              {
                "name": "detail",
                "kind": "optional",
                "type": "array",
                "description": "",
                "modelRef": "#/components/schemas/ValidationError",
                "customType": "ValidationError[]",
                "schema": [
                  {
                    "name": "loc",
                    "kind": "required",
                    "type": "array",
                    "description": "Path to the invalid value",
                    "example": "",
                    "itemType": "object",
                    "customType": "object[]",
                    "itemExample": "",
                    "itemDefault": ""
                  },
                  {
                    "name": "msg",
                    "kind": "required",
                    "type": "string",
                    "description": "Error message"
                  },
                  {
                    "name": "type",
                    "kind": "required",
                    "type": "string",
                    "description": "Error type"
                  }
                ]
              },
              {
                "name": "status",
                "kind": "optional",
                "type": "integer",
                "description": "Status code of the response.",
                "example": 422
              }
            ],
            "modelRef": "#/components/schemas/HTTPValidationError",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "k3r7U5JFJB0F8RFBo_hhR",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/status \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"status\": \"\",\n     \"reason\": \"\"\n     }'"
        },
        {
          "id": "lOlJLIPsxGq8qItrHunIb",
          "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   \"status\": \"\",\n   \"reason\": \"\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/status\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "H-yPtJFqbTKa5YcrsLpnk",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/status\")\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   \"status\": \"\",\n   \"reason\": \"\"\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "xTgGlBRNku2M7tLx3eXpW",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/status\"\n\npayload = json.dumps({\n   \"status\": \"\",\n   \"reason\": \"\"\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": "k3r7U5JFJB0F8RFBo_hhR"
    },
    "results": {
      "languages": [
        {
          "id": "BlC1X7He0kEQLpToOQN2v",
          "language": "201",
          "code": "// Successful Response\n{\n  \"id\": 0,\n  \"account_id\": 0,\n  \"project_id\": 0,\n  \"flag_key\": \"\",\n  \"environment\": \"\",\n  \"actions\": [\n    {\n      \"subject\": {\n        \"key\": \"\",\n        \"type\": \"\"\n      },\n      \"changed_element\": \"\",\n      \"value\": {}\n    }\n  ],\n  \"schedule\": {},\n  \"status\": \"\",\n  \"approval_status\": \"\",\n  \"completed_at\": \"2023-04-15T20:14+0000\",\n  \"updated_at\": \"2023-04-15T20:14+0000\",\n  \"created_at\": \"2023-04-15T20:14+0000\",\n  \"updated_by\": \"\",\n  \"created_by\": \"\"\n}"
        },
        {
          "id": "TXkl35bZ8Tn1QWxyNZU_k",
          "language": "401",
          "code": "// Not Authenticated\n{\n  \"details\": \"\",\n  \"status\": 400\n}"
        },
        {
          "id": "vMGxXjVfO4QYWN67d0qnn",
          "language": "422",
          "code": "// Validation Error\n{\n  \"detail\": [\n    {\n      \"loc\": [\n        {}\n      ],\n      \"msg\": \"\",\n      \"type\": \"\"\n    }\n  ],\n  \"status\": 422\n}"
        }
      ],
      "selectedLanguageId": "BlC1X7He0kEQLpToOQN2v"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}