Skip to content
Start here

Get R2 catalog details

client.R2DataCatalog.Get(ctx, bucketName, query) (*R2DataCatalogGetResponse, error)
GET/accounts/{account_id}/r2-catalog/{bucket_name}

Retrieve detailed information about a specific R2 catalog by bucket name. Returns catalog status, maintenance configuration, and credential status.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Workers R2 Data Catalog WriteWorkers R2 Data Catalog Read
ParametersExpand Collapse
bucketName string

Specifies the R2 bucket name.

maxLength63
minLength3
query R2DataCatalogGetParams
AccountID param.Field[string]

Use this to identify the account.

ReturnsExpand Collapse
type R2DataCatalogGetResponse struct{…}

Contains R2 Data Catalog information.

ID string

Use this to uniquely identify the catalog.

formatuuid
Bucket string

Specifies the associated R2 bucket name.

Name string

Specifies the catalog name (generated from account and bucket name).

Status R2DataCatalogGetResponseStatus

Indicates the status of the catalog.

One of the following:
const R2DataCatalogGetResponseStatusActive R2DataCatalogGetResponseStatus = "active"
const R2DataCatalogGetResponseStatusInactive R2DataCatalogGetResponseStatus = "inactive"
CredentialStatus R2DataCatalogGetResponseCredentialStatusoptional

Shows the credential configuration status.

One of the following:
const R2DataCatalogGetResponseCredentialStatusPresent R2DataCatalogGetResponseCredentialStatus = "present"
const R2DataCatalogGetResponseCredentialStatusAbsent R2DataCatalogGetResponseCredentialStatus = "absent"
MaintenanceConfig R2DataCatalogGetResponseMaintenanceConfigoptional

Configures maintenance for the catalog.

Compaction R2DataCatalogGetResponseMaintenanceConfigCompactionoptional

Configures compaction for catalog maintenance.

State R2DataCatalogGetResponseMaintenanceConfigCompactionState

Specifies the state of maintenance operations.

One of the following:
const R2DataCatalogGetResponseMaintenanceConfigCompactionStateEnabled R2DataCatalogGetResponseMaintenanceConfigCompactionState = "enabled"
const R2DataCatalogGetResponseMaintenanceConfigCompactionStateDisabled R2DataCatalogGetResponseMaintenanceConfigCompactionState = "disabled"
TargetSizeMB R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB

Sets the target file size for compaction in megabytes. Defaults to "128".

One of the following:
const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB64 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "64"
const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB128 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "128"
const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB256 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "256"
const R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB512 R2DataCatalogGetResponseMaintenanceConfigCompactionTargetSizeMB = "512"
SnapshotExpiration R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationoptional

Configures snapshot expiration settings.

MaxSnapshotAge string

Specifies the maximum age for snapshots. The system deletes snapshots older than this age. Format: where unit is d (days), h (hours), m (minutes), or s (seconds). Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes). Defaults to "7d".

MinSnapshotsToKeep int64

Specifies the minimum number of snapshots to retain. Defaults to 100.

formatint64
minimum1
State R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationState

Specifies the state of maintenance operations.

One of the following:
const R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationStateEnabled R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationState = "enabled"
const R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationStateDisabled R2DataCatalogGetResponseMaintenanceConfigSnapshotExpirationState = "disabled"

Get R2 catalog details

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/r2_data_catalog"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  r2DataCatalog, err := client.R2DataCatalog.Get(
    context.TODO(),
    "my-data-bucket",
    r2_data_catalog.R2DataCatalogGetParams{
      AccountID: cloudflare.F("0123456789abcdef0123456789abcdef"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", r2DataCatalog.ID)
}
{
  "errors": [],
  "messages": [],
  "result": {
    "bucket": "analytics-bucket",
    "credential_status": "present",
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "maintenance_config": {
      "compaction": {
        "state": "enabled",
        "target_size_mb": "128"
      },
      "snapshot_expiration": {
        "max_snapshot_age": "7d",
        "min_snapshots_to_keep": 100,
        "state": "enabled"
      }
    },
    "name": "account123_analytics-bucket",
    "status": "active"
  },
  "success": true
}
Returns Examples
{
  "errors": [],
  "messages": [],
  "result": {
    "bucket": "analytics-bucket",
    "credential_status": "present",
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "maintenance_config": {
      "compaction": {
        "state": "enabled",
        "target_size_mb": "128"
      },
      "snapshot_expiration": {
        "max_snapshot_age": "7d",
        "min_snapshots_to_keep": 100,
        "state": "enabled"
      }
    },
    "name": "account123_analytics-bucket",
    "status": "active"
  },
  "success": true
}