BucktDocs

Update bucket

PATCH/v1/buckets/{id}buckets:writeSDK: buckets.update

Patches one or more bucket settings. Only the fields you include are changed — everything else is left untouched. Settings that affect S3 (CORS, lifecycle, file-size limit) are applied to AWS as part of the same request.

The response confirms the bucket's id — call Get bucket to read the updated values.

Path parameters

NameTypeDefaultDescription
idrequiredstringThe bucket ID to update.

Body parameters

All fields are optional. Send only the ones you want to change.

NameTypeDefaultDescription
namestringDisplay name. 1–100 characters.
cachePreset"no-cache" | "short" | "standard" | "aggressive" | "immutable"CDN cache strategy applied to all objects.
cacheControlOverridestring | nullRaw Cache-Control header to send instead of the preset. Max 256 characters. null restores the preset.
corsOriginsstring[]Allow-listed origins for browser uploads. Up to 10 entries.
lifecycleTtlDaysnumber | nullAuto-delete objects this many days after upload. Range 1–3650. null disables expiry.
maxFileSizeBytesnumber | nullReject uploads larger than this size. null applies the default limit for your plan.
allowedMimeTypesstring[] | nullAllow-listed MIME patterns (e.g. "image/png", "image/*"). Up to 50 entries. null allows any type.
optimizationMode"none" | "light" | "balanced" | "maximum"Image optimization aggressiveness. Anything other than none requires a paid plan.

Example request

import { Buckt } from "@buckt/sdk";

const client = new Buckt({ apiKey: process.env.BUCKT_API_KEY });

await client.buckets.update("bkt_01H8XYZABCDEFGHJKMNPQRSTVW", {
  cachePreset: "aggressive",
  corsOrigins: ["https://app.example.com"],
});
// Returns: { object: "bucket", id: "bkt_01H8XYZABCDEFGHJKMNPQRSTVW" }

Responses

{
  "data": {
    "object": "bucket",
    "id": "bkt_01H8XYZABCDEFGHJKMNPQRSTVW"
  },
  "error": null,
  "meta": null
}