> ## Documentation Index
> Fetch the complete documentation index at: https://docs.servbase.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Object storage

> Create buckets, then upload, list, download and delete objects with the bucket API.

> [!NOTE]
>
> Object storage is in beta.

| Method | Path | Scope |
| - | - | - |
| `GET` | [`/storage/buckets`](#list-buckets) | `storage:read` |
| `POST` | [`/storage/buckets`](#create-a-bucket) | `storage:buckets` |
| `PATCH` | [`/storage/buckets/{name}`](#change-or-delete-a-bucket) | `storage:buckets` |
| `DELETE` | [`/storage/buckets/{name}`](#change-or-delete-a-bucket) | `storage:buckets` |
| `GET` | [`/bkt/{bucket_id}`](#get-a-bucket) | `storage:read` |
| `GET` | [`/bkt/{bucket_id}/objects`](#list-objects) | `storage:read` |
| `PUT` | [`/bkt/{bucket_id}/objects/{key}`](#upload-an-object) | `storage:write` |
| `GET` | [`/bkt/{bucket_id}/objects/{key}`](#download-an-object) | `storage:read` |
| `POST` | [`/bkt/{bucket_id}/delete`](#delete-objects) | `storage:delete` |

Each bucket has an **API endpoint**, `https://api.servbase.net/bkt/<bucket id>`, shown on the bucket page and returned as `api_endpoint`. Use it for objects. Bucket management (create, change, delete) uses the bucket's name.

> [!TIP]
>
> Connecting a bucket to an app from the app's settings adds its endpoint, bucket name and a key limited to that bucket to the app's variables, so your app needs no key from you.

## List buckets

`GET /storage/buckets`

```json Response theme={null}
{
  "buckets": [
    {
      "uid": "3c9e1f72-5a4b-4d18-9e06-b2a7c8d41f53",
      "name": "shop-uploads",
      "public": false,
      "api_endpoint": "https://api.servbase.net/bkt/3c9e1f72-5a4b-4d18-9e06-b2a7c8d41f53",
      "public_url": "https://bucket.servbase.site/sb3c9e1f725a4b4d189e06b2a7c8d41f53",
      "created_at": "2026-11-01T10:20:00",
      "objects": 128,
      "size": 52428800
    }
  ],
  "used": 52428800,
  "quota": 5368709120,
  "max_object": 471859200
}
```

`used`, `quota` (per workspace) and `max_object` (largest file) are in bytes.

## Create a bucket

`POST /storage/buckets`

**name** `string` *required*

3 to 63 characters: lowercase letters, digits and hyphens, starting and ending with a letter or digit.

**public** `boolean` (default: false)

When `true`, every object can be read by anyone at the bucket's `public_url`.

```bash theme={null}
curl -X POST https://api.servbase.net/storage/buckets \
  -H "Authorization: Bearer $SERVBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "shop-uploads", "public": false}'
```

Returns `201` with the bucket, in the same shape as an item of [List buckets](#list-buckets).

## Get a bucket

`GET /bkt/{bucket_id}` returns one bucket in the same shape.

## Change or delete a bucket

* `PATCH /storage/buckets/{name}` with `{"public": true}` or `{"public": false}` makes a bucket public or private.
* `DELETE /storage/buckets/{name}` deletes the bucket. Returns `{"success": true}`.

## Upload an object

`PUT /bkt/{bucket_id}/objects/{key}`

Send the file as the raw request body, with its `Content-Type`. An object with the same key is overwritten. Keys can contain `/` to group objects into folders.

```bash cURL theme={null}
curl -X PUT "https://api.servbase.net/bkt/$BUCKET_ID/objects/invoices/2026-11.pdf" \
  -H "Authorization: Bearer $SERVBASE_API_KEY" \
  -H "Content-Type: application/pdf" \
  --data-binary @2026-11.pdf
```

```javascript JavaScript (Node.js) theme={null}
import { readFile } from "node:fs/promises";

const res = await fetch(`https://api.servbase.net/bkt/${bucketId}/objects/invoices/2026-11.pdf`, {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.SERVBASE_API_KEY}`,
    "Content-Type": "application/pdf",
  },
  body: await readFile("2026-11.pdf"),
});
console.log(await res.json());
```

```python Python theme={null}
with open("2026-11.pdf", "rb") as f:
    res = requests.put(
        f"https://api.servbase.net/bkt/{bucket_id}/objects/invoices/2026-11.pdf",
        headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/pdf"},
        data=f,
        timeout=300,
    )
res.raise_for_status()
```

```json Response theme={null}
{ "key": "invoices/2026-11.pdf", "size": 84213, "etag": "9b2cf5...e41a", "content_type": "application/pdf" }
```

Uploads larger than `max_object`, or above the workspace quota, are refused with `413`.

## List objects

`GET /bkt/{bucket_id}/objects`

**prefix** `string`

Only keys that start with this, for example `invoices/`.

**delimiter** `string` (default: /)

Keys below the next delimiter are grouped into `folders`. Send an empty value to list every key.

**limit** `integer` (default: 100)

Up to 1000 entries per page.

**cursor** `string`

The `next_cursor` of the previous page.

```bash theme={null}
curl "https://api.servbase.net/bkt/$BUCKET_ID/objects?prefix=invoices/&limit=100" \
  -H "Authorization: Bearer $SERVBASE_API_KEY"
```

```json Response theme={null}
{
  "bucket": "shop-uploads",
  "prefix": "invoices/",
  "folders": ["invoices/archive/"],
  "objects": [
    { "key": "invoices/2026-11.pdf", "size": 84213, "content_type": "application/pdf", "etag": "9b2cf5...e41a", "updated_at": "2026-11-15T09:12:44" }
  ],
  "next_cursor": ""
}
```

List every object with the cursor:

```python theme={null}
cursor, keys = "", []
while True:
    page = requests.get(
        f"https://api.servbase.net/bkt/{bucket_id}/objects",
        params={"prefix": "invoices/", "delimiter": "", "limit": 1000, "cursor": cursor},
        headers={"Authorization": f"Bearer {API_KEY}"},
        timeout=30,
    ).json()
    keys += [o["key"] for o in page["objects"]]
    cursor = page["next_cursor"]
    if not cursor:
        break
```

## Download an object

`GET /bkt/{bucket_id}/objects/{key}`

Returns the file with its content type. Add `?download=true` to receive it as an attachment.

```bash theme={null}
curl -o 2026-11.pdf "https://api.servbase.net/bkt/$BUCKET_ID/objects/invoices/2026-11.pdf" \
  -H "Authorization: Bearer $SERVBASE_API_KEY"
```

Objects in a **public** bucket can also be read without a key at `public_url` followed by the key, for example `https://bucket.servbase.site/sb3c9e.../invoices/2026-11.pdf`.

## Delete objects

`POST /bkt/{bucket_id}/delete`

**keys** `string[]`

Up to 1000 keys to delete.

**prefix** `string`

Delete every object under this prefix, for example `tmp/`.

```bash theme={null}
curl -X POST "https://api.servbase.net/bkt/$BUCKET_ID/delete" \
  -H "Authorization: Bearer $SERVBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"keys": ["invoices/2026-10.pdf", "invoices/2026-09.pdf"]}'
```

```json Response theme={null}
{ "deleted": 2 }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.