---
title: Archive Reports
slug: feature-experimentation/api/archive-reports
docTags: 
createdAt: 2026-08-28T15:54:06.731Z
---

{
  "id": "JV2KOWym4m5hNc-RpE5Zs",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.optimizely.com/flags/v1//projects/{project_id}/environments/{environment_key}/reports/archived",
    "servers": [
      {
        "url": "https://api.optimizely.com/flags/v1//projects/{project_id}/environments/{environment_key}/reports/archived"
      }
    ],
    "name": "Archive Reports",
    "description": "<p>Archive one or more Reports in an Environment of a Project.</p>\n<p>This operation corresponds to the <code>archive_url</code> in a Reports response.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer",
          "example": 12345,
          "description": "The project identifier"
        },
        {
          "kind": "required",
          "name": "environment_key",
          "type": "string",
          "example": "production",
          "description": "The Environment identifier"
        }
      ],
      "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",
          "example": "{\"keys\":[\"landing_page_callout_N6JU6FJ2YiMdujucr6R6uf\"]}",
          "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 archive of Reports.</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": "{\"landing_page_callout_N6JU6FJ2YiMdujucr6R6uf\":{\"archived\":true,\"created_time\":\"2021-02-03T19:57:31.418350+00:00\",\"delete_url\":\"/projects/23004/environments/development/reports/landing_page_callout_kK2mpgdxRMRRXx6dZkFLsB\",\"description\":null,\"fetch_flag_url\":\"/projects/23004/flags/recurring_deposit\",\"fetch_results_api_url\":\"https://api.develrc-app.optimizely.com/experiments/9000000010001/results\",\"fetch_results_ui_url\":\"https://app.optimizely.test/v2/projects/23004/results/9000000010001/experiments/9000000010001\",\"flag_key\":\"recurring_deposit\",\"flag_name\":\"Recurring Deposit\",\"flag_state\":\"unarchived\",\"id\":1,\"key\":\"landing_page_callout_N6JU6FJ2YiMdujucr6R6uf\",\"name\":\"Landing Page Callout\",\"reset_results_url\":\"/projects/23004/environments/development/reports/landing_page_callout_kK2mpgdxRMRRXx6dZkFLsB/reset-results\",\"rule_key\":\"landing_page_callout\",\"rule_name\":\"Landing Page Callout\",\"rule_state\":\"enabled\",\"start_time\":\"2021-02-03T21:52:58.603598+00:00\",\"type\":\"a/b\",\"unarchive_url\":\"/projects/23004/environments/development/reports/unarchived\",\"updated_time\":\"2021-02-03T21:53:01.735777+00:00\",\"url\":\"/projects/23004/environments/development/reports/landing_page_callout_kK2mpgdxRMRRXx6dZkFLsB\",\"urn\":\"reports.flags.optimizely.com::1\"}}",
            "description": "Map of reports that include report key as key and report payload as value.",
            "customType": "ReportMap",
            "schema": [],
            "modelRef": "#/components/schemas/ReportMap",
            "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": "Conflicting resource state with requested action",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "T6xyvObWy1QXDdQKZ5Oep",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.optimizely.com/flags/v1//projects/{project_id}/environments/{environment_key}/reports/archived \\\n     --header 'accept: application/json'"
        },
        {
          "id": "2rHfE8CsZhQhiRoPfweRx",
          "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}/environments/{environment_key}/reports/archived\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "ymHLMtCZPazw5E4Zoj71V",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/flags/v1//projects/{project_id}/environments/{environment_key}/reports/archived\")\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": "GxT4gv8Zt2arCJa5Hxpb7",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/flags/v1//projects/{project_id}/environments/{environment_key}/reports/archived\"\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": "T6xyvObWy1QXDdQKZ5Oep"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful archive of Reports.\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": "// Conflicting resource state with requested action\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}