0

List Object Storage buckets per region

by
Published Oct 17, 2025

Returns a list of buckets on your account, in the specified region. > 📘 > > You can use the [Ceph Object Gateway S3 API](https://docs.ceph.com/en/latest/radosgw/s3/bucketops/#get-bucket) for more options. > --- - __OAuth scopes__. ``` object_storage:read_only ``` [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * List Object Storage buckets per region
7
 * Returns a list of buckets on your account, in the specified region.
8

9
> 📘
10
>
11
> You can use the [Ceph Object Gateway S3 API](https://docs.ceph.com/en/latest/radosgw/s3/bucketops/#get-bucket) for more options.
12

13

14
>
15

16
---
17

18

19
- __OAuth scopes__.
20

21
    ```
22
    object_storage:read_only
23
    ```
24

25
    [Learn more...](https://techdocs.akamai.com/linode-api/reference/get-started#oauth)
26
 */
27
export async function main(
28
  auth: Linode,
29
  apiVersion: "v4" | "v4beta",
30
  regionId: string,
31
) {
32
  const url = new URL(
33
    `https://api.linode.com/${apiVersion}/object-storage/buckets/${regionId}`,
34
  );
35

36
  const response = await fetch(url, {
37
    method: "GET",
38
    headers: {
39
      Authorization: "Bearer " + auth.token,
40
    },
41
    body: undefined,
42
  });
43
  if (!response.ok) {
44
    const text = await response.text();
45
    throw new Error(`${response.status} ${text}`);
46
  }
47
  return await response.json();
48
}
49