# Get storage metrics

> Retrieve recorded additions and successful removals by storage and UTC date. Historical coverage depends on event retention.

```json
{
  "path": "/metrics/storage",
  "method": "get",
  "schema": {
    "description": "Retrieve recorded additions and successful removals by storage and UTC date. Historical coverage depends on event retention.",
    "operationId": "getStorageMetrics",
    "parameters": [
      {
        "description": "Response format. Defaults to JSON unless Accept requests CSV. Overrides Accept when supplied; errors remain JSON.",
        "in": "query",
        "name": "format",
        "required": false,
        "schema": {
          "enum": [
            "json",
            "csv"
          ],
          "type": "string"
        }
      },
      {
        "description": "Inclusive UTC start date, YYYY-MM-DD. Supply both dates for a custom range of at most 366 days. Omit both for the past 7 UTC calendar days including today.",
        "in": "query",
        "name": "from",
        "required": false,
        "schema": {
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "type": "string"
        }
      },
      {
        "description": "Exclusive UTC end date, YYYY-MM-DD. Must be after from and at most 366 days later.",
        "in": "query",
        "name": "to",
        "required": false,
        "schema": {
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "type": "string"
        }
      },
      {
        "description": "Filter to one persistent storage configuration in the authenticated project.",
        "in": "query",
        "name": "storage_id",
        "required": false,
        "schema": {
          "minLength": 1,
          "type": "string"
        }
      }
    ],
    "responses": {
      "200": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MetricsStorageResponse"
            }
          },
          "text/csv": {
            "example": "row_type,from,to,date,storage_id,asset_bytes_added,bytes_removed,net_bytes_change,source_bytes_added,static_rendition_bytes_added\r\nsummary,2026-10-01,2026-10-02,,stor_aws_example,0,0,0,0,0\r\ndaily,2026-10-01,2026-10-02,2026-10-01,stor_aws_example,0,0,0,0,0\r\n",
            "schema": {
              "type": "string"
            }
          }
        },
        "description": "The project report."
      },
      "400": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ResponseErrorValidation"
            }
          }
        },
        "description": "Invalid dates, incomplete range or a range longer than 366 days."
      },
      "401": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ResponseErrorAuthentication"
            }
          }
        },
        "description": "A valid Project token is required."
      },
      "403": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ResponseErrorForbidden"
            }
          }
        },
        "description": "The operation is not permitted."
      },
      "404": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ResponseErrorNotFound"
            }
          }
        },
        "description": "The persistent storage configuration was not found in this project."
      },
      "429": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ResponseErrorTooManyRequests"
            }
          }
        },
        "description": "The request rate limit was exceeded."
      },
      "500": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ResponseErrorUnexpected"
            }
          }
        },
        "description": "The report could not be read."
      }
    },
    "security": [
      {
        "ProjectAccessToken": []
      }
    ],
    "summary": "Get storage metrics",
    "tags": [
      "Metrics"
    ],
    "x-codeSamples": [
      {
        "lang": "typescript",
        "source": "import Chunkify from '@chunkify/chunkify';\n\nconst client = new Chunkify({\n  projectAccessToken: 'My Project Access Token',\n});\n\nconst report = await client.metrics.storage({\n  from: '2026-10-01',\n  to: '2026-10-02',\n});\n\nconsole.log(report);"
      },
      {
        "lang": "python",
        "source": "from chunkify import Chunkify\n\nclient = Chunkify(\n    project_access_token=\"My Project Access Token\",\n)\n\nreport = client.metrics.storage(\n    from_=\"2026-10-01\",\n    to=\"2026-10-02\",\n)\nprint(report)"
      },
      {
        "lang": "php",
        "source": "\u003c?php\n\nuse Chunkify\\Client;\n\n$client = new Client(\n    projectAccessToken: 'My Project Access Token',\n);\n\n$report = $client-\u003emetrics-\u003estorage(\n    from: '2026-10-01',\n    to: '2026-10-02',\n);\n\nvar_dump($report);"
      },
      {
        "lang": "golang",
        "source": "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/chunkifydev/chunkify-go\"\n\t\"github.com/chunkifydev/chunkify-go/option\"\n)\n\nfunc main() {\n\tclient := chunkify.NewClient(\n\t\toption.WithProjectAccessToken(\"My Project Access Token\"),\n\t)\n\treport, err := client.Metrics.Storage(\n\t\tcontext.TODO(),\n\t\tchunkify.MetricStorageParams{\n\t\t\tFrom: chunkify.String(\"2026-10-01\"),\n\t\t\tTo:   chunkify.String(\"2026-10-02\"),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", report)\n}\n"
      }
    ]
  }
}
```



```json #/components/schemas/ResponseErrorUnexpected
{
  "description": "Unexpected preview processing or storage failure.",
  "properties": {
    "error": {
      "properties": {
        "code": {
          "const": 500,
          "type": "integer"
        },
        "message": {
          "examples": [
            "Internal server error"
          ],
          "type": "string"
        },
        "type": {
          "const": "UnexpectedError",
          "type": "string"
        }
      },
      "required": [
        "type",
        "code",
        "message"
      ],
      "type": "object"
    },
    "status": {
      "const": "error",
      "type": "string"
    }
  },
  "required": [
    "status",
    "error"
  ],
  "type": "object"
}
```



```json #/components/schemas/MetricsStorageResponse
{
  "description": "Successful metrics response.",
  "properties": {
    "data": {
      "$ref": "#/components/schemas/MetricsStorage",
      "description": "Data contains the requested report."
    }
  },
  "required": [
    "data"
  ],
  "type": "object"
}
```



```json #/components/schemas/MetricsStorage
{
  "description": "Recorded additions and successful removals within event retention. Excludes external storage changes and does not measure current storage size.",
  "properties": {
    "from": {
      "description": "From specifies the inclusive UTC start date.",
      "examples": [
        "2026-10-01"
      ],
      "type": "string"
    },
    "storages": {
      "description": "Storages specifies persistent project storage configurations, including those without recorded activity. Chunkify temporary storage is excluded.",
      "items": {
        "$ref": "#/components/schemas/MetricsStorageEntry"
      },
      "type": "array"
    },
    "to": {
      "description": "To specifies the exclusive UTC end date.",
      "examples": [
        "2026-10-02"
      ],
      "type": "string"
    }
  },
  "required": [
    "from",
    "to",
    "storages"
  ],
  "type": "object"
}
```



```json #/components/schemas/MetricsStorageEntry
{
  "description": "Activity for one persistent storage configuration.",
  "properties": {
    "daily": {
      "description": "Daily specifies one record for each selected event day, oldest first.",
      "items": {
        "$ref": "#/components/schemas/MetricsStorageDay"
      },
      "type": "array"
    },
    "storage_id": {
      "description": "StorageId identifies the persistent storage configuration.",
      "examples": [
        "stor_aws_example"
      ],
      "type": "string"
    },
    "summary": {
      "$ref": "#/components/schemas/MetricsStorageValues",
      "description": "Summary specifies recorded activity in the selected period."
    }
  },
  "required": [
    "storage_id",
    "summary",
    "daily"
  ],
  "type": "object"
}
```



```json #/components/schemas/MetricsStorageDay
{
  "allOf": [
    {
      "$ref": "#/components/schemas/MetricsStorageValues"
    },
    {
      "properties": {
        "date": {
          "description": "Date specifies the UTC event day.",
          "examples": [
            "2026-10-01"
          ],
          "type": "string"
        }
      },
      "required": [
        "date"
      ],
      "type": "object"
    }
  ],
  "description": "Recorded storage activity grouped by event day."
}
```



```json #/components/schemas/MetricsStorageValues
{
  "description": "Recorded storage activity in bytes.",
  "properties": {
    "asset_bytes_added": {
      "description": "AssetBytesAdded specifies recorded Asset package additions.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    },
    "bytes_removed": {
      "description": "BytesRemoved specifies recorded successful file removals as a positive amount.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    },
    "net_bytes_change": {
      "description": "NetBytesChange specifies additions minus successful removals. This may be negative and is not bucket occupancy.",
      "format": "int64",
      "type": "integer"
    },
    "source_bytes_added": {
      "description": "SourceBytesAdded specifies recorded Source additions.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    },
    "static_rendition_bytes_added": {
      "description": "StaticRenditionBytesAdded specifies recorded static rendition additions.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "source_bytes_added",
    "asset_bytes_added",
    "static_rendition_bytes_added",
    "bytes_removed",
    "net_bytes_change"
  ],
  "type": "object"
}
```



```json #/components/schemas/MetricsStorageValues
{
  "description": "Recorded storage activity in bytes.",
  "properties": {
    "asset_bytes_added": {
      "description": "AssetBytesAdded specifies recorded Asset package additions.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    },
    "bytes_removed": {
      "description": "BytesRemoved specifies recorded successful file removals as a positive amount.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    },
    "net_bytes_change": {
      "description": "NetBytesChange specifies additions minus successful removals. This may be negative and is not bucket occupancy.",
      "format": "int64",
      "type": "integer"
    },
    "source_bytes_added": {
      "description": "SourceBytesAdded specifies recorded Source additions.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    },
    "static_rendition_bytes_added": {
      "description": "StaticRenditionBytesAdded specifies recorded static rendition additions.",
      "format": "int64",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "source_bytes_added",
    "asset_bytes_added",
    "static_rendition_bytes_added",
    "bytes_removed",
    "net_bytes_change"
  ],
  "type": "object"
}
```



```json #/components/schemas/ResponseErrorValidation
{
  "properties": {
    "error": {
      "properties": {
        "code": {
          "const": 400,
          "description": "Code is the HTTP status code",
          "examples": [
            400
          ],
          "type": "integer"
        },
        "message": {
          "description": "Message is a human-readable error description",
          "examples": [
            "Invalid request parameters"
          ],
          "type": "string"
        },
        "type": {
          "const": "ValidationError",
          "description": "Type indicates the error category",
          "enum": [
            "ValidationError"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "code",
        "message"
      ],
      "type": "object"
    },
    "status": {
      "const": "error",
      "description": "Status indicates the response status \"error\"",
      "type": "string"
    }
  },
  "required": [
    "status",
    "error"
  ]
}
```



```json #/components/schemas/ResponseErrorAuthentication
{
  "description": "Error response",
  "properties": {
    "error": {
      "description": "Error response details",
      "properties": {
        "code": {
          "const": 401,
          "description": "Code is the HTTP status code",
          "examples": [
            401
          ],
          "type": "integer"
        },
        "message": {
          "description": "Message is a human-readable error description",
          "examples": [
            "Authentication error: invalid token or subscription inactive"
          ],
          "type": "string"
        },
        "type": {
          "const": "AuthenticationError",
          "description": "Type indicates the error category",
          "enum": [
            "AuthenticationError"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "code",
        "message"
      ],
      "type": "object"
    },
    "status": {
      "const": "error",
      "description": "Status indicates the response status \"error\"",
      "type": "string"
    }
  },
  "required": [
    "status",
    "error"
  ],
  "type": "object"
}
```



```json #/components/schemas/ResponseErrorForbidden
{
  "properties": {
    "error": {
      "description": "Error response details",
      "properties": {
        "code": {
          "const": 403,
          "description": "Code is the HTTP status code",
          "examples": [
            403
          ],
          "type": "integer"
        },
        "message": {
          "description": "Message is a human-readable error description",
          "examples": [
            "Unauthorized to perform this action"
          ],
          "type": "string"
        },
        "type": {
          "const": "ForbiddenError",
          "description": "Type indicates the error category",
          "enum": [
            "ForbiddenError"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "code",
        "message"
      ],
      "type": "object"
    },
    "status": {
      "const": "error",
      "description": "Status indicates the response status \"error\"",
      "type": "string"
    }
  },
  "required": [
    "status",
    "error"
  ]
}
```



```json #/components/schemas/ResponseErrorNotFound
{
  "description": "Error response",
  "properties": {
    "error": {
      "description": "Error response details",
      "properties": {
        "code": {
          "const": 404,
          "description": "Code is the HTTP status code",
          "examples": [
            404
          ],
          "type": "integer"
        },
        "message": {
          "description": "Message is a human-readable error description",
          "examples": [
            "Ressource not found"
          ],
          "type": "string"
        },
        "type": {
          "const": "NotFoundError",
          "description": "Type indicates the error category",
          "enum": [
            "NotFoundError"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "code",
        "message"
      ],
      "type": "object"
    },
    "status": {
      "const": "error",
      "description": "Status indicates the response status \"error\"",
      "type": "string"
    }
  },
  "required": [
    "status",
    "error"
  ],
  "type": "object"
}
```



```json #/components/schemas/ResponseErrorTooManyRequests
{
  "description": "Error response",
  "properties": {
    "error": {
      "description": "Error response details",
      "properties": {
        "code": {
          "const": 429,
          "description": "Code is the HTTP status code",
          "examples": [
            429
          ],
          "type": "integer"
        },
        "message": {
          "description": "Message is a human-readable error description",
          "examples": [
            "Rate limit exceeded"
          ],
          "type": "string"
        },
        "type": {
          "const": "TooManyRequestsError",
          "description": "Type indicates the error category",
          "enum": [
            "TooManyRequestsError"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "code",
        "message"
      ],
      "type": "object"
    },
    "status": {
      "const": "error",
      "description": "Status indicates the response status \"error\"",
      "type": "string"
    }
  },
  "required": [
    "status",
    "error"
  ],
  "type": "object"
}
```