---
updatedAt: 2026-03-01T18:59:11.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/netstorage/llms.txt
---

# Modify a purge routine

Make changes to an automatic purge routine for a specific CP code.

# OpenAPI definition

```json
{
  "externalDocs": {
    "description": "See documentation for Akamai's NetStorage Configuration API",
    "url": "https://techdocs.akamai.com/netstorage/reference"
  },
  "info": {
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "title": "NetStorage CP codes",
    "version": "v1"
  },
  "openapi": "3.0.0",
  "paths": {
    "/cpcodes/{cpcodeId}/age-deletions": {
      "put": {
        "description": "Make changes to an automatic purge routine for a specific CP code.",
        "externalDocs": {
          "description": "See documentation for this operation in Akamai's NetStorage Configuration API",
          "url": "https://techdocs.akamai.com/netstorage/reference/put-cpcode-age-deletions"
        },
        "operationId": "put-cpcode-age-deletions",
        "parameters": [
          {
            "description": "This identifies a subdirectory to target for purging.",
            "in": "query",
            "name": "ageDeletionDirectoryPrefix",
            "schema": {
              "example": "assets",
              "type": "string"
            },
            "x-akamai": {
              "file-path": "parameters/age-deletion-directory-prefix-query.yaml"
            }
          },
          {
            "description": "For customers who manage more than one account, this [runs the operation from another account](https://techdocs.akamai.com/developer/docs/manage-many-accounts-with-one-api-client). The Identity and Access Management API provides a [list of available account switch keys](https://techdocs.akamai.com/iam-api/reference/get-client-account-switch-keys).",
            "in": "query",
            "name": "accountSwitchKey",
            "required": false,
            "schema": {
              "example": "1-5C0YLB:1-8BYUX",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "ageDeletionDays": 100,
                "ageDeletionDirectory": "/979672/file",
                "ageDeletionExclusionRegex": "*.pdf",
                "ageDeletionRecursivePurge": true,
                "ageDeletionSelectionRegex": "*.mp4",
                "ageDeletionSizeBytes": 100,
                "ageDeletionSizeUnit": "GB"
              },
              "schema": {
                "additionalProperties": false,
                "description": "Automatic purge routines perform a routine scan of a target directory, and once a specified capacity is reached, the system will begin to purge files that are older than a date you specify.",
                "properties": {
                  "ageDeletionDays": {
                    "description": "When the `ageDeletionSizeBytes` value is reached for the target directory, this number is subtracted from the current date to determine a timestamp. Files older than this timestamp are purged.",
                    "type": "integer"
                  },
                  "ageDeletionDirectory": {
                    "description": "The target directory for an Automatic Purge Routine.",
                    "type": "string"
                  },
                  "ageDeletionExclusionRegex": {
                    "description": "POSIX regular expression pattern matching the filenames to exclude from the purge.",
                    "type": "string"
                  },
                  "ageDeletionRecursivePurge": {
                    "default": "false",
                    "description": "Whether subdirectories within the target directory are also included in the purge. If `false`, only files within the target directory are purged.",
                    "type": "boolean"
                  },
                  "ageDeletionSelectionRegex": {
                    "description": "POSIX regular expression pattern matching the filenames to include in the purge.",
                    "type": "string"
                  },
                  "ageDeletionSizeBytes": {
                    "description": "Automatic purge occurs when the target directory reaches this size, in bytes.",
                    "type": "integer"
                  }
                },
                "type": "object",
                "x-akamai": {
                  "file-path": "schemas/automatic-purge-put.yaml"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {},
            "description": "Successful Response."
          }
        },
        "summary": "Modify a purge routine",
        "tags": [
          "CP codes"
        ]
      },
      "parameters": [
        {
          "description": "Uniquely identifies a Content Provider.",
          "in": "path",
          "name": "cpcodeId",
          "required": true,
          "schema": {
            "example": 7563521,
            "type": "integer"
          },
          "x-akamai": {
            "file-path": "parameters/cpcode-id-path.yaml"
          }
        }
      ],
      "x-akamai": {
        "file-path": "paths/age-deletions.yaml",
        "path-info": "/cpcodes/{cpcodeId}/age-deletions"
      }
    }
  },
  "servers": [
    {
      "url": "https://{hostname}/storage/v1"
    }
  ],
  "x-akamai": {
    "auth-type": "EDGE_GRID",
    "file-path": "01-cpcodes.yaml"
  },
  "x-readme": {
    "explorer-enabled": false,
    "samples-languages": [
      "curl",
      "python",
      "node"
    ]
  }
}
```

# Sibling pages

* [Create a CP code](https://techdocs.akamai.com/netstorage/reference/post-cpcodes.md)
* [List unused CP Codes](https://techdocs.akamai.com/netstorage/reference/get-cpcodes-unused.md)
* [List CP codes in use](https://techdocs.akamai.com/netstorage/reference/get-cpcodes-used.md)
* [Delete an automatic purge routine](https://techdocs.akamai.com/netstorage/reference/delete-cpcode-age-deletions.md)
* [View the automatic purge routine](https://techdocs.akamai.com/netstorage/reference/get-cpcode-age-deletions.md)