Skip to content
Start here

List namespaces in catalog

client.r2DataCatalog.namespaces.list(stringbucketName, NamespaceListParams { account_id, page_size, page_token, 3 more } params, RequestOptionsoptions?): NamespaceListResponse { namespaces, details, namespace_uuids, next_page_token }
GET/accounts/{account_id}/r2-catalog/{bucket_name}/namespaces

Returns a list of namespaces in the specified R2 catalog. Supports hierarchical filtering and pagination for efficient traversal of large namespace hierarchies.

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
params: NamespaceListParams { account_id, page_size, page_token, 3 more }
account_id: string

Path param: Use this to identify the account.

page_size?: number

Query param: Maximum number of namespaces to return per page. Defaults to 100, maximum 1000.

maximum1000
minimum1
page_token?: string

Query param: Opaque pagination token from a previous response. Use this to fetch the next page of results.

parent?: string

Query param: Parent namespace to filter by. Only returns direct children of this namespace. For nested namespaces, use %1F as separator (e.g., "bronze%1Fanalytics"). Omit this parameter to list top-level namespaces.

return_details?: boolean

Query param: Whether to include additional metadata (timestamps). When true, response includes created_at and updated_at arrays.

return_uuids?: boolean

Query param: Whether to include namespace UUIDs in the response. Set to true to receive the namespace_uuids array.

ReturnsExpand Collapse
NamespaceListResponse { namespaces, details, namespace_uuids, next_page_token }

Contains the list of namespaces with optional pagination.

namespaces: Array<Array<string>>

Lists namespaces in the catalog.

details?: Array<Detail> | null

Contains detailed metadata for each namespace when return_details is true. Each object includes the namespace, UUID, and timestamps.

namespace: Array<string>

Specifies the hierarchical namespace parts as an array of strings. For example, ["bronze", "analytics"] represents the namespace "bronze.analytics".

namespace_uuid: string

Contains the UUID that persists across renames.

formatuuid
created_at?: string | null

Indicates the creation timestamp in ISO 8601 format.

formatdate-time
updated_at?: string | null

Shows the last update timestamp in ISO 8601 format. Null if never updated.

formatdate-time
namespace_uuids?: Array<string> | null

Contains UUIDs for each namespace when return_uuids is true. The order corresponds to the namespaces array.

next_page_token?: string | null

Use this opaque token to fetch the next page of results. A null or absent value indicates the last page.

List namespaces in catalog

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const namespaces = await client.r2DataCatalog.namespaces.list('my-data-bucket', {
  account_id: '0123456789abcdef0123456789abcdef',
});

console.log(namespaces.namespace_uuids);
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "success": true,
  "result": {
    "namespaces": [
      [
        "bronze",
        "analytics"
      ]
    ],
    "details": [
      {
        "namespace": [
          "bronze",
          "analytics"
        ],
        "namespace_uuid": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "created_at": "2019-12-27T18:11:19.117Z",
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "namespace_uuids": [
      "0199b999-6869-7383-bb1f-d30e059d5326",
      "0199b99b-2c88-73b3-8dbb-421e0e8f2757"
    ],
    "next_page_token": "MSYxNzU5NzU1NTc4NTA0MTk0JjAxOTliOTliLTJjODgtNzNiMy04ZGJiLTQyMWUwZThmMjc1Nw"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "messages": [
    {
      "code": 0,
      "message": "message"
    }
  ],
  "success": true,
  "result": {
    "namespaces": [
      [
        "bronze",
        "analytics"
      ]
    ],
    "details": [
      {
        "namespace": [
          "bronze",
          "analytics"
        ],
        "namespace_uuid": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "created_at": "2019-12-27T18:11:19.117Z",
        "updated_at": "2019-12-27T18:11:19.117Z"
      }
    ],
    "namespace_uuids": [
      "0199b999-6869-7383-bb1f-d30e059d5326",
      "0199b99b-2c88-73b3-8dbb-421e0e8f2757"
    ],
    "next_page_token": "MSYxNzU5NzU1NTc4NTA0MTk0JjAxOTliOTliLTJjODgtNzNiMy04ZGJiLTQyMWUwZThmMjc1Nw"
  }
}