Using curl and jq Utility With Wasabi Stats API

Prev Next

This article provides practical jq filters you can use to parse responses from the Wasabi Stats API, including:  

  • Extracting key utilization fields

  • Exporting results to CSV

  • Converting bytes to GiB (gibibytes) and GB (gigabytes)

  • Exporting all fields dynamically to CSV (even if the schema varies)

Prerequisites

  • curl installed

  • jq installed (recommended: v1.6+)

  • A Stats API response that contains a top-level Records array. (The JSON results for a stats API utilization by bucket name query run.)  

If you plan to run these commands on Windows, you'll need to use Git Bash or set up Ubuntu or another Linux-based distribution through Windows Subsystem for Linux (WSL). The curl and jq commands don't work correctly in Windows Command Prompt or PowerShell.

Example: Stats API Call (30 Days of Bucket Utilizations)

Use the following command to retrieve 30 days of utilization for a specific bucket name:

Tip: To immediately convert the API response to CSV or raw output, pipe the output into one of the jq commands below:

These commands can all be redirected to a file for future use; for example, CSV files can be opened in MS Excel.

Common jq Outputs for Stats API Responses

The following jq commands (and their outputs) are commonly used to process data returned by a Stats API.

Example 1: Extract key utilization fields (raw array output)

Use the following command to quickly view specific fields in a structured way (not CSV).

Example 2: Export key utilization fields to CSV (with header)

Use the following command to obtain clean CSV output.

Unit Conversions

The following examples show how units are converted when working with storage data.

Notes on Units

  • GiB (gibibytes) uses a base of 1024: GiB = bytes / (1024^3)

  • GB (gigabytes) uses a base of 1000: GB = bytes / (1000^3)

Example 3: CSV + convert bytes to GiB (rounded to 3 decimals)

Example 4: CSV + convert bytes to GiB (no rounding)

Example 5: CSV + convert bytes to GB (rounded to 3 decimals)

Example 6: CSV + convert bytes to GB (no rounding)

Export All Fields from a Stats API Response to CSV (Dynamic Columns)

Use the following command if the fields in Records vary or if you want all information in the output. It automatically builds a column list from all keys across all records.

RawStorageSizeBytes vs PaddedStorageSizeBytes

  • RawStorageSizeBytes = the actual bytes of all non-deleted (active and versioned) objects stored in the account or bucket. It is the true object-data total, without any minimum-size adjustment.

  • PaddedStorageSizeBytes = the bytes of all non-deleted (active and versioned) objects after applying Wasabi’s minimum object size billing rule for the plan, which the docs describe as a 4 KB minimum object size. So, very small objects are rounded up for billing or accounting purposes.

Pagination Notes

  • The maximum number of pages in a response is 100.

  • Querying by month should typically be adequate to stay within pagination limits.

  • Use the following command to check page info:

Troubleshooting Notes

  • If jq returns errors like "Cannot iterate over null," confirm that the response contains a Records array:

  • If the CSV output appears empty, verify that the expected field names are present in the response.

Example Bucket Utilization Chart

The chart below was generated in MS Excel from the CSV results run against a bucket named test bucket-1 using the commands above.