# Code Buckets

> Store your code and assets in buckets, organized by project. Every upload is encrypted, every change is recorded, and backups bring a bucket back in one step.

Code Buckets is Clatter Labs' storage for code. You group **buckets** into **projects**, upload your code as zip files (plus any assets, up to 10 GB per bucket), browse the code in the Console, follow an events feed of everything that happened, and back up and restore whole buckets.

<CardGroup cols={2}>
<Card title="Quickstart" icon="rocket" href="/code-buckets/quickstart">Create a project and a bucket, upload a zip and read a file.</Card>
<Card title="API reference" icon="code" href="/api-reference/code-buckets/introduction">Projects, buckets, uploads, preview, events and backups.</Card>
</CardGroup>

## What you get

| Feature | What it does |
| --- | --- |
| Projects and Project IDs | Every bucket belongs to a project with a stable ID like `cbp_4k9x2m7q1n8v3c6z0b5w` |
| Buckets up to 10 GB | Zips and assets, uploaded in resumable 16 MiB chunks with checksums |
| Code preview | Uploaded zips unpack into a file tree you can browse with syntax highlighting |
| Events | An ordered feed of every upload, code change, deletion, backup, restore and key action. No comments, no threads |
| Backups | Snapshot a bucket's code and stored files; restore it as a new version |
| Encryption | Every stored zip and asset is encrypted with AES-256-GCM under the bucket's own key |
| Fast API | A small HTTPS API on the edge; immutable reads are cached close to you |

## How it fits together

```text
Account (CL-…)
└── Project            cbp_…   ← the Project ID you use in the API
    └── Bucket         cbk_…   ← up to 10 GB, its own encryption key
        ├── Objects    cbo_…   ← zips (archives) and assets, encrypted
        ├── Code tree  ref     ← unpacked from your latest zip, for preview
        ├── Events     cbe_…   ← what happened, newest first
        └── Backups    cbb_…   ← snapshots you can restore
```

## Two ways to use it

- **Console**: [console.clatterlabs.com/code-buckets](https://console.clatterlabs.com/code-buckets). Create projects and buckets, drag in a zip, browse files, read events, back up and restore.
- **API**: `https://api.codebuckets.clatterlabs.xyz`, with a Console API key and your Account ID. Same projects and buckets, from your builds, scripts and agents.

## Base URL and authentication

```text
https://api.codebuckets.clatterlabs.xyz
```

Every request sends your API key and your Account ID:

```http
Authorization: Bearer clsk_...
X-Clatter-Account: CL-XXXXXXXX
```

Create the key in **Console › API keys** with the Code Buckets permissions (`buckets:read`, `buckets:write`, `backups:write`). See [Authentication](/api-reference/code-buckets/authentication).

<Note>
The Free tier includes **1,000,000 tokens a month and 1 backup**. A token is one API request, or one MiB uploaded or downloaded. See [Pricing](/code-buckets/pricing).
</Note>
