---
title: Unarchive Flags
slug: feature-experimentation/api/unarchive-flags
docTags: 
createdAt: 2026-08-28T15:54:06.731Z
---

{
  "id": "yTz3K7QRPx6O8RuBAosM6",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.optimizely.com/flags/v1//projects/{project_id}/flags/unarchived",
    "servers": [
      {
        "url": "https://api.optimizely.com/flags/v1//projects/{project_id}/flags/unarchived"
      }
    ],
    "name": "Unarchive Flags",
    "description": "<p>Unarchive one or more Flags in a project.</p>\n<p>This operation corresponds to the <code>unarchive_url</code> in a Flags response.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer",
          "example": 12345,
          "description": "The project identifier"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json",
            "application/problem+json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "example": "{\"keys\":[\"recurring_deposit\"]}",
          "description": "",
          "customType": "BulkOperationsRequestBody",
          "schema": [
            {
              "name": "keys",
              "kind": "optional",
              "type": "array",
              "description": "The list of resource keys to perform the desired operation",
              "example": "",
              "itemType": "string",
              "customType": "string[]",
              "itemExample": "",
              "itemDefault": ""
            }
          ],
          "modelRef": "#/components/schemas/BulkOperationsRequestBody",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "Write applications that authenticate with the REST API via OAuth 2.0.",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Grants all access"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Successful unarchive of Flags.</p>\n<p>The response includes RESTful JSON (<a href=\"https://restfuljson.org/\" target=\"_blank\">https://restfuljson.org/</a>) styled links. If a\nlink is not present in the response, it indicates a user is not authorized to access\nthe related resource.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"recurring_deposit\":{\"account_id\":12345,\"archive_url\":\"...\",\"archived\":false,\"created_time\":\"2019-05-08T00:00:00.000Z\",\"delete_url\":\"string\",\"description\":\"Flag used for driving customers to use recurring deposits by showing a graph of compound interest over time\",\"environments\":{\"development\":{\"disable_url\":\"...\",\"enable_url\":\"...\",\"enabled\":false,\"is_primary\":false,\"key\":\"development\",\"name\":\"Development\",\"priority\":2,\"rules_summary\":[{\"audience_ids\":[1],\"created_time\":\"2022-01-08T00:00:00.000Z\",\"days_running\":30,\"enabled\":true,\"key\":\"a/b\",\"name\":\"A/B Test\",\"primary_metric\":\"conversion_rate\",\"traffic_allocation\":100,\"type\":\"experiment\",\"updated_time\":\"2022-01-08T00:00:00.000Z\"}]},\"production\":{\"disable_url\":\"...\",\"enable_url\":\"...\",\"enabled\":false,\"key\":\"production\",\"name\":\"Production\",\"priority\":1,\"rules_detail\":[{\"audience_ids\":[1],\"created_time\":\"2022-01-08T00:00:00.000Z\",\"days_running\":30,\"enabled\":true,\"id\":123,\"key\":\"a/b\",\"name\":\"A/B Test\",\"primary_metric\":\"conversion_rate\",\"traffic_allocation\":100,\"type\":\"experiment\",\"updated_time\":\"2022-01-08T00:00:00.000Z\"}],\"rules_summary\":{\"a/b\":{\"keys\":[\"new_users\"]},\"targeted_delivery\":{\"keys\":[\"paid_users\",\"trial_users\"]}}}},\"id\":45633994,\"key\":\"recurring_deposit\",\"name\":\"Recurring Deposit\",\"outlier_filtering_enabled\":false,\"project_id\":12345,\"unarchive_url\":\"...\",\"update_url\":\"...\",\"updated_time\":\"2019-05-08T00:00:00.000Z\",\"url\":\"...\",\"urn\":\"flags.flag.optimizely.com::asdfsdf-2344-efadf03-343434-efrrr\",\"variable_definitions\":{\"advanced\":{\"default_value\":\"{\\n\\t\\\"hello\\\": 123\\n}\",\"description\":\"This variable is used to configure the advanced used for advanced purposes\",\"key\":\"advanced\",\"type\":\"json\"},\"amount\":{\"default_value\":\"0.0\",\"description\":\"This variable is used to configure the amount used for computing the discount\",\"key\":\"amount\",\"type\":\"double\"},\"message\":{\"default_value\":\"Use recurring deposits to compound interest\",\"description\":\"This variable is used to configure the message used for displaying the discount\",\"key\":\"message\",\"type\":\"string\"}}}}",
            "description": "Map of flags that include flag key as key and flag payload as value.",
            "customType": "FlagMap",
            "schema": [],
            "modelRef": "#/components/schemas/FlagMap",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Malformed requests and invalid parameter names and types",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "401",
        "description": "Invalid credentials",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Do not have permission to perform the operation",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Not found. No content",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "409",
        "description": "<p>The Flags cannot be unarchived in their current state. No Flag in the batch\nis unarchived.</p>\n<p>Two body shapes are possible. A failed precondition returns a\n<code>FlagConflictError</code> naming the Flags that blocked the request; its <code>error</code>\nfield says which precondition failed. Every other conflict returns a\n<code>ProblemDetail</code>.</p>\n<p>Discriminate on the presence of the <code>error</code> field rather than on the\nresponse's content type: a <code>ProblemDetail</code> may arrive as either\n<code>application/json</code> or <code>application/problem+json</code>.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "<p>Returned when an archive or unarchive request is rejected. When the rejection is\na failed precondition, <code>error</code>, <code>message</code> and <code>flag_keys</code> are all present and\nname the Flags that blocked the request. Any other conflict omits all three,\nand carries only <code>title</code> alongside the standard problem fields.</p>",
            "customType": "FlagConflictError",
            "schema": [
              {
                "name": "detail",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable explanation specific to this occurrence of the problem.</p>",
                "example": "Cannot modify flag as it is referenced by ruleset"
              },
              {
                "name": "error",
                "kind": "optional",
                "type": "string<PENDING_APPROVALS_EXIST>",
                "description": "<p>The reason the request was rejected.</p>\n<p><code>PENDING_APPROVALS_EXIST</code> — at least one Flag has an open approval request.\nCannot be overridden.</p>",
                "example": "PENDING_APPROVALS_EXIST",
                "enum": [
                  "PENDING_APPROVALS_EXIST"
                ]
              },
              {
                "name": "flag_keys",
                "kind": "optional",
                "type": "array",
                "description": "The keys of the Flags that blocked the request.",
                "example": "[\"checkout_redesign_2024\",\"recurring_deposit\"]",
                "itemType": "string",
                "customType": "string[]",
                "itemExample": "",
                "itemDefault": ""
              },
              {
                "name": "message",
                "kind": "optional",
                "type": "string",
                "description": "<p>A human-readable explanation of the conflict.</p>",
                "example": "Cannot archive flag(s) with pending approval requests"
              },
              {
                "name": "status",
                "kind": "optional",
                "type": "integer",
                "description": "The HTTP status code generated by the origin server for this occurrence of the problem.",
                "example": 409
              },
              {
                "name": "title",
                "kind": "required",
                "type": "string",
                "description": "<p>A short, human-readable summary of the problem type.</p>",
                "example": "Conflict"
              },
              {
                "name": "type",
                "kind": "optional",
                "type": "string",
                "description": "<p>A URI reference that identifies the problem type. Contains 'about</p><div></div>' if unspecified.<p></p>",
                "example": "about:blank"
              },
              {
                "name": "uuid",
                "kind": "optional",
                "type": "string",
                "description": "Error reference for customer support.",
                "example": "3f2b9c14-7a0e-4d55-9e21-6c8b0a7d4e13"
              }
            ],
            "modelRef": "#/components/schemas/FlagConflictError",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "bj7FSEDhtbmLgp5izmphr",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.optimizely.com/flags/v1//projects/{project_id}/flags/unarchived \\\n     --header 'accept: application/json'"
        },
        {
          "id": "i1gnaavyDB8Coxfn5ueZ6",
          "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(\"https://api.optimizely.com/flags/v1//projects/{project_id}/flags/unarchived\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "6YLjAG6Nmdh2De5EMe5I0",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/flags/v1//projects/{project_id}/flags/unarchived\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "QSae4HGFy5056M16E9agA",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/flags/v1//projects/{project_id}/flags/unarchived\"\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": "bj7FSEDhtbmLgp5izmphr"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful unarchive of Flags.\nThe response includes RESTful JSON (https://restfuljson.org/) styled links. If a\nlink is not present in the response, it indicates a user is not authorized to access\nthe related resource.\n{}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Malformed requests and invalid parameter names and types\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Invalid credentials\n"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Do not have permission to perform the operation\n"
        },
        {
          "id": "response-4-404",
          "language": "404",
          "code": "// Not found. No content\n"
        },
        {
          "id": "response-5-409",
          "language": "409",
          "code": "// The Flags cannot be unarchived in their current state. No Flag in the batch\nis unarchived.\nTwo body shapes are possible. A failed precondition returns a\nFlagConflictError naming the Flags that blocked the request; its error\nfield says which precondition failed. Every other conflict returns a\nProblemDetail.\nDiscriminate on the presence of the error field rather than on the\nresponse's content type: a ProblemDetail may arrive as either\napplication/json or application/problem+json.\n{\n  \"detail\": \"Cannot modify flag as it is referenced by ruleset\",\n  \"error\": \"PENDING_APPROVALS_EXIST\",\n  \"flag_keys\": [\n    \"\"\n  ],\n  \"message\": \"Cannot archive flag(s) with pending approval requests\",\n  \"status\": 409,\n  \"title\": \"Conflict\",\n  \"type\": \"about:blank\",\n  \"uuid\": \"3f2b9c14-7a0e-4d55-9e21-6c8b0a7d4e13\"\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}