# Limits and storage

Plans are priced by storage only. Builds, snapshots and reviewers are not billed.

## How storage is counted

Every image is stored once per account, keyed by its content. A snapshot that did not change between builds adds nothing, however many builds use it. Storage is the size of every stored image: baselines, images from pull requests and diff images. The account's Billing page shows how much is used. The Free plan has 10 GB, and [pricing](https://stateofpixel.com/index.md#pricing) lists the paid plans.

## Image storage

Images are stored in Netlify Blobs, up to 25 MB each.

## The Usage page

Everyone in the account sees a Usage page on the account page. It splits storage into baselines, images kept only for pull requests and diff images, per project, and charts the last 90 days. Owners see every project. Everyone else sees the projects they can open on GitHub, and a note with how many others are not listed and how much they store. It is counted once a day. An image used by several projects counts for the project that used it first.

## When an account is over its limit

1. At 80%, the account pages show a warning, and so do the project pages for people with write access. The CLI prints one too.
2. At 100%, a 14 day grace period starts. Everything keeps working, and the banner names the day it ends.
3. After the grace period, new images are not stored. Builds still report, but changed snapshots are not compared, and the check passes with "Storage limit reached, not compared". CI keeps passing.

Upgrading, or freeing space with a shorter retention or by deleting a project, ends this as soon as usage is back under the limit.

Owners of the account on GitHub change the plan. Everyone else in the account sees the same warnings, with a note to ask an owner.

A plan cancelled at the next billing date stays until the end of its billing period. If the account then stores more than the Free plan allows, the grace period starts that day. The banner warns about this as soon as the plan is cancelled, and 14 days before any cancelled plan ends.

## Retention

A build is deleted when its pull request closed more than a set time ago, 60 days by default. A build is also deleted when its branch had no new build for that long, even if the pull request is still open. Admins set it from 7 to 365 days under Settings, Retention, in Keep PR-only images for.

Builds on the default branch and on auto-approve branches are kept, and so is any build that another build uses as its baseline. A daily cleanup removes images that no build has used for 24 hours, and frees their storage. A link to a deleted build says when it was deleted and which rule deleted it.

## Limits

| Limit                  | Value              |
| ---------------------- | ------------------ |
| Snapshots per build    | 20,000             |
| Shards per build       | 256                |
| Image size             | 25 MB              |
| Image dimensions       | 10,000 x 50,000 px |
| Snapshot name          | 512 characters     |
| Metadata per snapshot  | 4 KB               |
| Time to finish a build | 60 minutes         |
| Builds per account     | 2,000 a day        |
| Uploads per account    | 20 GB a day        |
| Requests per token     | 600 a minute       |

Images over the size or dimension limits are rejected, their snapshots fail, and `upload` exits 1. Rate limits make the CLI warn and exit 0.
