---
name: migrate-laevitas-history
description: Migrate a Laevitas API v1 historical-data integration to supported API v2 compatibility routes, with endpoint mapping, read-only parity checks and rollback. Use for existing REST collectors; native schemas and MCP are optional separate changes.
---

# Migrate Laevitas historical data to API v2

Deliver a small, reviewable client patch, a route coverage inventory and a
verification report. Preserve the client's dataset and collection behavior.
Do not switch production traffic merely because a patch compiles.

## Authoritative inputs

- [Live rollout status](https://apiv2.laevitas.ch/api/v1/changelog/history-migration)
- [Route mapping](https://apiv2.laevitas.ch/migration/v1-to-v2/legacy-history-routes.json)
- [Migration guide](https://apiv2.laevitas.ch/migration/v1-to-v2/legacy-history-migration.md)
- [Download manifest](https://apiv2.laevitas.ch/migration/v1-to-v2/manifest.json)
- [Verifier](https://apiv2.laevitas.ch/migration/v1-to-v2/verify-history.mjs)
- [Example verification plan](https://apiv2.laevitas.ch/migration/v1-to-v2/cases.example.json)
- [OpenAPI](https://apiv2.laevitas.ch/swagger-json)
- [Historical corrections](https://apiv2.laevitas.ch/api/v1/changelog/data-corrections)

Read the guide and mapping before editing. If they cannot be retrieved, do not
invent mappings or infer availability from this document. A downloaded kit's
version does not establish current account access; check live status and a
bounded authorized request. Verify downloaded file hashes against the manifest
retrieved over HTTPS; review the verifier before executing it.

## Inventory, then patch

Find the client's API host configuration, request builders, response types,
pagination loops, retry policy and persisted-data writes. List each used route
as supported by the mapping, still on v1, or needing clarification. Redact
secrets when inspecting configuration. Do not read unrelated credentials.

For mapped compatibility routes only:

```text
https://api.laevitas.ch/historical/...
https://apiv2.laevitas.ch/api/v1/historical/...
```

Use each exact `legacy_path` / `compatibility_path` mapping, preserving path
arguments, query parameters, response parser, units, UTC bounds and pagination.
Do not globally replace every hostname: unmapped historical routes, analytics
and WebSocket integrations must remain unchanged. `API v2` names the product;
`/api/v1` is its current URL namespace, not a reference to the legacy API product.

Keep the existing API key in an authentication header (`X-API-Key` or `apiKey`),
never a query string, prompt, committed file or log. Existing subscription and
history restrictions still apply. Do not create accounts, purchase subscriptions,
spend x402 credits or alter entitlements as part of a client migration.

Native routes and MCP expose the retained dataset through different inputs
and normalized responses. Adopt them only when the user requests that separate
change; use the mapping and OpenAPI schemas rather than guessing parameters.
Do not replace retained history with modern OHLCVT, ticker or fitted-surface
data. Migration neither repairs missing history nor makes revised data certified
as-originally-published point-in-time data.

## Verify without changing stored observations

Add local request-construction and parser tests. With the user's authorization
for API reads and a key supplied through their secure environment, run bounded
comparisons against v1 and the compatibility alias. Never ask them to paste a
secret into the conversation. The downloadable verifier defaults to a dry run;
`--live` explicitly enables authenticated reads using `LAEVITAS_API_KEY`.

Use the client's actual selectors and closed windows within their entitlement:

- A populated window read through every declared page, including pages after
  an empty intermediate page; a short page alone is not exhaustion.
- The same rows with a different page size and shifted window.
- Expected-empty and expired-instrument cases where relevant.
- Repeated rounds separated in time, not just a burst of identical requests.

Keep null, zero, missing field and missing row distinct. Preserve duplicate-row
identity and do not merge rows only by timestamp. Compare compatibility
envelopes with compatibility envelopes; native joined-series pagination and
snapshot counts can intentionally differ. Do not silently relax numeric
tolerances, manufacture fills or overwrite stored observations to pass a test.
Report unresolved numerical differences with the coordinate and field, without
credentials. Empty matches alone do not certify history or complete coverage.

The old and new routes share account quota. Initial retained-source safety
ceilings are 60 reads/minute and two concurrent reads per account, with shared
service capacity. Respect 429 / retry guidance and use bounded backoff. Treat
503 as unavailable, never as empty data. A failure or truncated verification
is not a passing migration; retain v1 for the affected route.

## Hand off and roll back

Report supported/unchanged routes, code changes, checked windows/pages, actual
results and remaining gaps. Keep the original v1 host/path configurable and
provide a rollback switch. Change production traffic only with the user's
approval, starting with a small route family. No v1 sunset date is announced;
do not delete the v1 integration or promise a migration duration.
