# Versions

## How many are kept

Each project keeps its newest versions up to your plan's number: see [Plans and limits](../get-started/plans-and-limits#registry). After each push, the oldest beyond that number are deleted, with their source, report and diff.

After a downgrade, the old plan's number still holds for 30 days, so nothing is deleted the day you change plans. After that, the next push trims the list to the new plan's number.

## Reading them

Every call takes your project key.

### 1. List the versions

Newest first:

```sh
curl -sS "$BASE/versions" -H "Authorization: Bearer $LATITUDE10_KEY"
```

### 2. Read one version's report

The score's findings, rule by rule:

```sh
curl -sS "$BASE/versions/3/report" -H "Authorization: Bearer $LATITUDE10_KEY"
```

### 3. Download the original

The document exactly as it was pushed, as YAML or JSON:

```sh
curl -sS "$BASE/versions/3/source" -H "Authorization: Bearer $LATITUDE10_KEY" -o openapi.yaml
```

### 4. Compare any two versions

```sh
curl -sS "$BASE/diff?from=1&to=3" -H "Authorization: Bearer $LATITUDE10_KEY"
```

Each change has a `kind`, a `level` (breaking, warning or info), a JSON `pointer` into the document and a `message`. The kinds are listed in [Breaking changes](breaking-changes).

A version number that isn't a number answers `400`, and one that doesn't exist, or was deleted, answers `404`.

## Where this comes from

- `app/workspace/_lib/quotas.ts`
- `app/registry/_lib/versions.ts`
- `app/api/registry/v1/versions/route.ts`
- `app/api/registry/v1/versions/[seq]/source/route.ts`
- `app/api/registry/v1/versions/[seq]/report/route.ts`
- `app/api/registry/v1/diff/route.ts`
- `app/api/registry/v1/_lib/route.ts`
