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

# Bucket settings

> Versioning, lifecycle rules, bucket policies and CORS for Pxxl Storage buckets.

Each bucket has settings that control how long objects live, who can read them, and which websites can use them. Change them on the bucket's **Settings** tab, through the REST API, or with the standard S3 calls from any S3 tool.

| Setting | Dashboard | REST API | S3 API |
| - | - | - | - |
| Versioning | **Settings > Versioning** | `PUT /storage/buckets/{id}/settings/versioning` | `PutBucketVersioning` |
| Lifecycle | **Settings > Lifecycle** | `PUT …/settings/lifecycle` | `PutBucketLifecycleConfiguration` |
| Policy | **Settings > Policy** | `PUT …/settings/policy` | `PutBucketPolicy` |
| CORS | **Settings > CORS** | `PUT …/settings/cors` | `PutBucketCors` |

`GET /storage/buckets/{id}/settings` returns all of them. Over S3, changing settings needs a `read_write` [access key](https://docs.pxxl.app/storage/s3-api.md#access-keys) with no folder limit.

## Versioning

With versioning on, overwriting or deleting an object keeps the old copy as a version. Use it for anything where a bad upload or an accidental delete would hurt.

* Turn it on when you create the bucket (**Keep object versions**) or later in **Settings > Versioning**.
* Once on, it can be **suspended** but not turned off. Existing versions are kept.
* Deleting an object adds a *delete marker*; the older versions stay until you delete them by version ID.
* Older versions count toward your storage. Pair versioning with a [lifecycle rule](#lifecycle-rules) that expires them.

```bash theme={null}
aws s3api put-bucket-versioning --bucket my-bucket \
  --versioning-configuration Status=Enabled \
  --endpoint-url https://storage.pxxl.app/s3

aws s3api list-object-versions --bucket my-bucket --prefix reports/ \
  --endpoint-url https://storage.pxxl.app/s3
```

## Lifecycle rules

Lifecycle rules delete objects automatically: old logs, temporary exports, previous versions, unfinished uploads. Pxxl applies them **every hour**.

The dashboard form covers the common cases. For each rule you set:

| Setting | What it does |
| - | - |
| Prefix | Which objects the rule applies to, such as `tmp/`. Empty means the whole bucket. |
| Expire after, in days | Delete current objects this many days after they were uploaded. |
| Noncurrent versions, in days | With versioning, delete older versions this many days after they were replaced. |
| Abort incomplete uploads, in days | Clean up multipart uploads that were never completed. |

Over S3 you can also filter by tag or object size and expire on a fixed date. Up to 1,000 rules per bucket.

```json theme={null}
{
  "Rules": [
    {
      "ID": "expire-tmp",
      "Status": "Enabled",
      "Filter": { "Prefix": "tmp/" },
      "Expiration": { "Days": 7 }
    },
    {
      "ID": "trim-versions",
      "Status": "Enabled",
      "Filter": {},
      "NoncurrentVersionExpiration": { "NoncurrentDays": 30 },
      "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 2 }
    }
  ]
}
```

```bash theme={null}
aws s3api put-bucket-lifecycle-configuration --bucket my-bucket \
  --lifecycle-configuration file://lifecycle.json \
  --endpoint-url https://storage.pxxl.app/s3
```

Transitions to other storage classes aren't available: every object is in `STANDARD`.

## Bucket policies

A bucket policy is a JSON document that opens or closes access for everyone, on top of access keys. Pxxl supports two uses:

* **Allow public reads** of part of a private bucket. `Allow` statements may grant only these read actions: `s3:GetObject`, `s3:GetObjectVersion`, `s3:GetObjectTagging`, `s3:ListBucket`, `s3:ListBucketVersions` and `s3:GetBucketLocation`.
* **Deny** actions for everyone, including requests made with access keys. For example, block deletes in a folder that must never change.

```json theme={null}
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicImages",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::BUCKET_ID/public/*"
    },
    {
      "Sid": "KeepInvoices",
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:DeleteObject",
      "Resource": "arn:aws:s3:::BUCKET_ID/invoices/*"
    }
  ]
}
```

| Rule | Detail |
| - | - |
| **Principal** | Must be `"*"` or `{"AWS": "*"}`. |
| **Resource** | This bucket only, as `arn:aws:s3:::<bucket-id>` or `arn:aws:s3:::<bucket-id>/<path>`. `*` and `?` wildcards work. |
| **Not supported** | `Condition` and `NotAction`. |
| **Size** | Up to 20 KB. |

Anonymous reads allowed by a policy use the S3 endpoint with the bucket's ID, for example `https://storage.pxxl.app/s3/BUCKET_ID/public/logo.png`.

## CORS

CORS rules decide which websites can call the bucket from a browser, for example to upload with a presigned URL or fetch files with JavaScript.

With **no rules**, Pxxl answers any `http` or `https` origin. Add rules to lock it down to your own sites:

```json theme={null}
[
  {
    "AllowedOrigins": ["https://app.example.com", "https://*.example.com"],
    "AllowedMethods": ["GET", "PUT", "HEAD"],
    "AllowedHeaders": ["*"],
    "ExposeHeaders": ["ETag"],
    "MaxAgeSeconds": 3600
  }
]
```

| Rule | Detail |
| - | - |
| **Rules** | 1 to 100. Each needs `AllowedOrigins` and `AllowedMethods`. |
| **Methods** | `GET`, `PUT`, `POST`, `DELETE`, `HEAD`. |
| **Wildcards** | At most one `*` in each origin or header. |
| **Cookies** | Never sent; use presigned URLs instead. |
| **Takes effect** | Within 30 seconds. |

```bash theme={null}
aws s3api put-bucket-cors --bucket my-bucket \
  --cors-configuration '{"CORSRules":[{"AllowedOrigins":["https://app.example.com"],"AllowedMethods":["GET","PUT"],"AllowedHeaders":["*"]}]}' \
  --endpoint-url https://storage.pxxl.app/s3
```

## Visibility and region

* **Visibility** (**Settings > Visibility**, or `pxxl storage update <id> --public|--private`): a public bucket serves public objects at their public URL. Making a bucket private stops those URLs working at once.
* **Region**: `PUT /storage/buckets/{id}/settings/region` with `{"region":"africa"}` or `{"region":"europe"}`. See [regions](https://docs.pxxl.app/storage/overview.md#regions).

## Encryption

Every object is encrypted at rest (SSE-S3, AES-256). `GetBucketEncryption` reports it; customer-provided and KMS keys aren't supported.


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