# Removed Capabilities

Source: https://docs.formance.com/v4.0/modules/ledger/migration/removed-capabilities

Stack: v4.0

Most of the migration is the same work applied to a different contract: different paths, different filter syntax, different idempotency scope. [Update Ledger Clients](https://docs.formance.com/v4.0/modules/ledger/migration/update-clients) covers that.

This page covers the smaller set that is not a rewrite. Each row below is a Ledger v2 capability with no Ledger 3.0 equivalent, so a workflow that depends on one needs a design decision, not a new call site. Check your workflow inventory against this list _before_ planning the client work. For the path of every other call, see the [Endpoint Map](https://docs.formance.com/v4.0/modules/ledger/migration/endpoint-map).

The authoritative list lives with the code, in [Missing Features](https://github.com/formancehq/ledger/blob/release/v3.0/docs/technical/contributing/api-comparison.md#missing-features) and Intentionally Removed Features. This page carries the entries that reach an application client; that document also records contributor-facing gaps and the reasoning behind each removal.

## What does not carry over

| Ledger v2                                                                                                                     | Ledger 3.0                                                                                                                                               | Use instead                                                                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Account date fields `firstUsage`, `insertionDate`, `updatedAt` — returned on the account and usable in filters and pagination | Absent. The account object is `address`, `metadata`, `volumes`, and no date condition is valid on the accounts query target                              | A typed `datetime` account metadata key with an index — see [below](#account-date-fields)                                                                                            |
| `preCommitVolumes`, `postCommitEffectiveVolumes`, `preCommitEffectiveVolumes`                                                 | Removed                                                                                                                                                  | `postCommitVolumes` rides on every transaction, in creates, reverts, reads, lists and prepared-query results. There is no request flag to toggle it and no `expandVolumes`           |
| `GET /accounts/{address}/balances`                                                                                            | No such route                                                                                                                                            | `GET /v3/{ledgerName}/accounts/{address}` — the account carries volumes per `(asset, color)`, balance included                                                                       |
| `GET /accounts/{address}/volumes`                                                                                             | No such route                                                                                                                                            | The same account read, or `GET /v3/{ledgerName}/volumes` with an account filter for aggregates                                                                                       |
| `/volumes` point-in-time reads: `startTime`, `endTime`, `insertionDate`                                                       | Not accepted. Ledger 3.0 `/volumes` takes `useMaxPrecision`, `groupByPrefixes` and `collapseColors`                                                      | Nothing queries a stored historical balance projection. Derive the figure from transaction history, or stamp the value you need as metadata when it is produced                      |
| `metadataCount` in ledger stats                                                                                               | Not returned                                                                                                                                             | No replacement                                                                                                                                                                       |
| Count endpoints — `HEAD /v2/{ledger}/transactions` and `HEAD /v2/{ledger}/accounts`, with the total in the `Count` header     | No such route                                                                                                                                            | `GET /v3/{ledgerName}/stats` returns the unfiltered `transactionCount`. There is no account count and no filtered count                                                              |
| `prefix=` and `reference=` query parameters                                                                                   | Removed. A request that still sends one is not rejected; the parameter is ignored and the list is not narrowed                                           | `filter=`: `address ^= "users:"` textually, `{"$match":{"address":"users:"}}` structurally when the value ends with `:`, and `{"$match":{"reference":"..."}}` to select by reference |
| Log import and export — `POST /v2/{ledger}/logs/import`, `POST /v2/{ledger}/logs/export`, `fctl ledger import`                | The interface exists and returns not-found                                                                                                               | Mirror mode is the supported migration path — see [Migration Overview](https://docs.formance.com/v4.0/modules/ledger/migration/overview)                                             |
| Per-ledger `features` on ledger creation (`HASH_LOGS`, `MOVES_HISTORY…`)                                                      | No equivalent field. `POST /v3/{ledgerName}` takes `metadata`, `mode`, `mirrorSource`, `defaultEnforcementMode`, `initialSchema` and `accountTypes`      | The behaviors those toggles gated are not per-ledger options. For the integrity story, see [Integrity](https://docs.formance.com/v4.0/modules/ledger/operations/integrity)           |
| Buckets — the `bucket` field on ledger creation, `DELETE /v2/_/buckets/{bucket}`, `POST /v2/_/buckets/{bucket}/restore`       | No bucket field and no bucket routes. A `bucket` value sent on creation is ignored, not rejected. Every ledger in a cluster shares the cluster's storage | One ledger per workload you isolated with a bucket, or one cluster where you need physical isolation — see [Buckets](#buckets)                                                       |

Three further changes are rewrites rather than removals, and are covered where you will meet them: bulk moves to `/v3/{ledgerName}/bulk` with a different failure model ([Update bulk handling](https://docs.formance.com/v4.0/modules/ledger/migration/update-clients#update-bulk-handling)), Ledger Schema and query templates become prepared queries and indexes ([Replace Ledger Schema workflows](https://docs.formance.com/v4.0/modules/ledger/migration/update-clients#replace-ledger-schema-workflows)), and idempotency keys move to a cluster-wide namespace ([Redesign idempotency keys](https://docs.formance.com/v4.0/modules/ledger/migration/update-clients#redesign-idempotency-keys)).

## Account date fields

This is the removal most likely to be load-bearing, because the fields backed cohort queries, dormancy sweeps and date-ordered account pagination — and because the loss is silent: a Ledger v2 filter on `first_usage` does not degrade, it fails.

Ledger v2 maintained `first_usage` by lowering it on every write that touched the account. Ledger 3.0's admission path stopped injecting prior values into its preload, which is the same change that disabled `metadataCount`, and accounts are not keyed in a way that would carry an account-level date without new storage machinery. The fields are therefore out by decision rather than pending. Typed metadata is the sanctioned replacement.

### Reading

Declare an account metadata key as `datetime`, which parses the RFC3339 value you write into signed int64 epoch microseconds. Create an account metadata index on that key, wait for it to report ready, then range-filter it:

```
filter=metadata[first_usage] >= 1704067200000000
```

The operand is microseconds, not RFC3339

Metadata range operands are parsed as integers. RFC3339 coercion applies to the builtin `date` and `timestamp` fields, which are not valid on the accounts target at all. Declaring the key `datetime` governs how the stored _value_ is read, not how the filter operand is written.

The same filter works on `GET /v3/{ledgerName}/volumes`, which compiles its filter for the accounts target. See [Filters and Pagination](https://docs.formance.com/v4.0/modules/ledger/querying/filters-and-pagination) and [Indexes](https://docs.formance.com/v4.0/modules/ledger/querying/indexes).

### Writing

There is no set-if-absent. Account metadata writes overwrite, and Numscript's `set_account_meta` has no conditional form, so a rule that stamps the key on every transaction records _last_ usage rather than first.

To stamp once without a client-side read, send the opening transaction through the bulk endpoint with a per-address `reference` and the skip opt-in. `skippableReasons` sits on the entry, not inside `data`:

```json
[
  {
    "action": "CREATE_TRANSACTION",
    "skippableReasons": ["TRANSACTION_REFERENCE_CONFLICT"],
    "data": {
      "reference": "open:users:alice",
      "postings": [{ "source": "world", "destination": "users:alice", "asset": "USD/2", "amount": 100 }],
      "accountMetadata": { "users:alice": { "first_usage": "2024-01-01T00:00:00Z" } }
    }
  }
]
```

Reference uniqueness is arbitrated in consensus order, so every later attempt is skipped instead of overwriting. The unitary `POST /v3/{ledgerName}/transactions` deliberately does not expose the opt-in and answers `409` on the second attempt. The transaction must carry at least one posting, so this fits a ledger with a real opening transaction and is awkward where accounts appear implicitly.

### Carrying the value across

Copying the Ledger v2 value into the typed metadata key at cutover is the only lossless option, and mirroring does not do it for you.

Reconstruction after the fact is possible, but it has to reproduce what the source actually means. Ledger v2 lowers `first_usage` from two paths: the **effective date** of every transaction the account takes part in, and the **log date** of every account-metadata save. An account that only ever received metadata has a `first_usage` and no transaction behind it. So the equivalent is the minimum over both, per address, across the whole log.

A transaction-only scan is wrong

Scanning transactions alone returns a later date for any account given metadata before its first posting, and misses metadata-only accounts entirely. The same applies to shortcuts through per-log volume annotations: a backdated transaction against an already-materialized account lowers the source value without creating a new cell.

## Buckets

In Ledger v2, a bucket was a separate storage namespace in the PostgreSQL database, holding one or more ledgers. Teams used buckets to keep workloads apart in the database, and to delete or restore a group of ledgers as one unit. Ledger 3.0 has no buckets, and nothing replaces the bucket delete and restore routes. `POST /v3/{ledgerName}` has no `bucket` field. A `bucket` value sent by a Ledger v2 client is ignored, not rejected: the request returns `201` and the ledger is created in the shared cluster. Audit your ledger creation calls for a `bucket` value. Where Ledger 3.0 APIs still say "bucket", for example the gRPC `BucketService` or `GET /v3/_/indexes?scope=bucket`, it means the whole cluster, not a Ledger v2 bucket.

What to do instead depends on what the bucket gave you:

| What the bucket gave you                                                   | Ledger 3.0                                                                                                                                                                                                                                              |
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Separate accounts, transactions, and metadata per workload                 | Create one ledger per workload. Each ledger has its own accounts, transactions, metadata, and indexes                                                                                                                                                   |
| Deleting a group of ledgers together                                       | Delete each ledger with `DELETE /v3/{ledgerName}`. Each delete is a separate call, so deleting a group is not atomic. Deletion is permanent: unlike a Ledger v2 bucket, a deleted ledger cannot be restored, and its name can never be reused           |
| Physical separation: storage, capacity, backup and restore, upgrade timing | Run a separate cluster. Ledgers in one cluster share its storage, and [backup](https://docs.formance.com/v4.0/modules/ledger/operations/backup) and [restore](https://docs.formance.com/v4.0/modules/ledger/operations/restore) cover the whole cluster |

Idempotency keys are shared across ledgers

Separate ledgers in one cluster do not get separate idempotency namespaces. Keys are cluster-wide, so two workloads that reused the same key in different v2 buckets now collide. Prefix keys with the workload or ledger name, as described in [Redesign idempotency keys](https://docs.formance.com/v4.0/modules/ledger/migration/update-clients#redesign-idempotency-keys).

## Before you plan the client work

For each row above that your inventory hits, decide and record:

| Decision                                               | Why it belongs in the migration record                                                                    |
| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
| Whether the workflow still needs the capability at all | Some Ledger v2 reads exist because the field was there, not because a business process consumes it        |
| The replacement, and who owns building it              | A typed metadata key with a stamping rule is application work, not a client-library change                |
| Whether historical values must survive the cutover     | This is the only decision that expires: the source value is available until you stop writing to Ledger v2 |
| The read path's index, and its readiness gate          | A filter that needs an index fails until the index is ready, and readiness is per replica                 |

Carry these into the migration record described in [Migration Overview](https://docs.formance.com/v4.0/modules/ledger/migration/overview), then return to [Update Ledger Clients](https://docs.formance.com/v4.0/modules/ledger/migration/update-clients).
