---
title: Archive Approval
slug: feature-experimentation/api/archive-approval
docTags: 
createdAt: 2026-10-13T18:16:15.508Z
---

{
  "id": "HHwqhDqbsevUht6GUxjSK",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/archive",
    "servers": [
      {
        "url": "http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/archive",
        "description": "Local server"
      },
      {
        "url": "https://api.app.optimizely.com/flags-scheduling/projects/{project_id}/flags/{flag_key}/approval/{approval_id}/archive",
        "description": "Production server"
      }
    ],
    "name": "Archive Approval",
    "description": "Archive an Approval for a Flag.\n\nThis operation marks an approval as archived and updates its approval status and schedule job status if required.\n",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer",
          "description": "The id of the Project for which the Approval is scoped to."
        },
        {
          "kind": "required",
          "name": "flag_key",
          "type": "string",
          "description": "The key of the Flag for which the Approval is for."
        },
        {
          "kind": "required",
          "name": "approval_id",
          "type": "integer",
          "description": "The id of the Approval"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "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": "200",
        "description": "Approval archived successfully.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "400",
        "description": "Bad Request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"details\":\"Approval with id 123 is already archived\",\"status\":400}",
            "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": "401",
        "description": "Not Authenticated or Unauthorized",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"details\":\"Unauthorized\",\"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": "404",
        "description": "Approval Not Found",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"details\":\"Approval with id 123 not found\",\"status\":404}",
            "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": "oiuthBqT09kYLsVJXrVPV",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/archive \\\n     --header 'accept: application/json'"
        },
        {
          "id": "xmikoGt65RvamZpZTdMtV",
          "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: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/archive\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "e3A8BvYYdh6mJkm2bWCeU",
          "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}/archive\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "RkTGn3uBSkPsAJ39jBYFV",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"http://localhost:3002//projects/{project_id}/flags/{flag_key}/approval/{approval_id}/archive\"\n\npayload = {}\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": "oiuthBqT09kYLsVJXrVPV"
    },
    "results": {
      "languages": [
        {
          "id": "diJlPJWIXRHGLbsx7AHY5",
          "language": "200",
          "code": "// Approval archived successfully.\n"
        },
        {
          "id": "9CVaUxuOgR7sE_MTCrVcr",
          "language": "400",
          "code": "// Bad Request\n{\n  \"details\": \"\",\n  \"status\": 400\n}"
        },
        {
          "id": "Kdvvr0Pcfp9TLK8lAFglg",
          "language": "401",
          "code": "// Not Authenticated or Unauthorized\n{\n  \"details\": \"\",\n  \"status\": 400\n}"
        },
        {
          "id": "5VjQS10AQ1adw809PSkoK",
          "language": "404",
          "code": "// Approval Not Found\n{\n  \"details\": \"\",\n  \"status\": 400\n}"
        },
        {
          "id": "GVChyXp0_VokJnyJJyaCH",
          "language": "422",
          "code": "// Validation Error\n{\n  \"detail\": [\n    {\n      \"loc\": [\n        {}\n      ],\n      \"msg\": \"\",\n      \"type\": \"\"\n    }\n  ],\n  \"status\": 422\n}"
        }
      ],
      "selectedLanguageId": "diJlPJWIXRHGLbsx7AHY5"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}