0

List Object Storage buckets

by
Published Oct 17, 2025

Returns a paginated list of all Object Storage buckets available in your account. > 📘 > > You can use an outside API, such as the [Ceph Object Gateway S3 API](https://docs.ceph.com/en/latest/radosgw/s3/serviceops/#list-buckets) 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
7
 * Returns a paginated list of all Object Storage buckets available in your account.
8

9
> 📘
10
>
11
> You can use an outside API, such as the [Ceph Object Gateway S3 API](https://docs.ceph.com/en/latest/radosgw/s3/serviceops/#list-buckets) 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(auth: Linode, apiVersion: "v4" | "v4beta") {
28
  const url = new URL(
29
    `https://api.linode.com/${apiVersion}/object-storage/buckets`,
30
  );
31

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