Migrating data between self-hosted Langfuse instances

Moving traces, prompts and datasets between self-hosted Langfuse deployments is a documented script-based job, but version alignment, project mapping and what does not transfer decide the effort. This page sets out how to plan it.

On this page

Migrating data between self-hosted Langfuse instances: what the move involves

A team that is consolidating several self-hosted Langfuse deployments into one, or splitting one deployment into several, needs to answer a practical question before anyone touches data: what moves, what stays, and how do the two sides line up afterward? Traces, prompts and datasets are the three kinds of content most teams care about, and each one carries different dependencies on projects, API keys and the Langfuse version that wrote it.

The short answer is that Langfuse documents a data migration cookbook that includes Python scripts for transferring traces, prompts and datasets between Langfuse instances, and the same guidance covers moves between a self-hosted instance and Langfuse Cloud. The FAQ entry on migrating data between Langfuse instances is the starting point. That means the work is mostly planning, version alignment, project and key mapping, and verification, not building a migration tool from scratch. Confirm the script versions and their current requirements against the cookbook before you plan, because the scripts are maintained by the vendor and may change with Langfuse releases.

The planning effort sits in the decisions around the scripts. Confirm the source and target Langfuse versions and whether a major upgrade is also pending, list the projects and API keys that must map to the target, and identify which features in use, such as retention settings or Enterprise-only controls, need to be reproduced on the target. Ask your DeployOpen contact or the Langfuse team to confirm what the scripts copy, what they skip, and how they handle scores and observations, since those details decide the verification plan.

Which Langfuse objects move with the cookbook and which need manual work

This table lists each Langfuse object you may need to carry between instances, the source and target, whether the documented cookbook scripts cover it, and what to plan for. The data migration cookbook is the documented starting point, so confirm each row against its current version before you estimate work. Treat any object marked for confirmation or manual work as part of your own migration plan.

ObjectSource and targetCovered by cookbookMigration note
TracesSource instance to target instance, same projectYes, trace scriptCheck the time range and filters the script uses against your retention window.
ObservationsNested under each trace in the sourceConfirm in cookbookVerify spans, generations and their parent links in the target after a test run.
ScoresAttached to traces or observations in the sourceConfirm in cookbookNot listed as covered in the documented scripts. Plan a separate export and re-scoring path if needed.
PromptsPrompt names and content in the source projectYes, prompt scriptRecreate the prompt text exactly and check template variables after the copy.
Prompt labels and versionsVersion history and label assignments such as productionConfirm in cookbookCheck whether version order and labels carry over. Reassign labels in the target if they do not.
DatasetsDataset definitions in the source projectYes, dataset scriptConfirm the dataset name, description and metadata arrive unchanged in the target.
Dataset itemsInputs, expected outputs and metadata for each itemConfirm in cookbookConfirm item IDs and links to source traces, since experiments may depend on them.
API keys and projectsProject IDs, public and secret keys in the source instanceNo, manual workCreate target projects and new keys, then update SDK and integration configuration. Keys are not copied.

Which documented paths to use: scripts, the public API or a manual rebuild

The documented first choice for moving data between two Langfuse instances, or between self-hosted and Langfuse Cloud, is the data migration cookbook. Langfuse's FAQ points to Python scripts that transfer traces, prompts and datasets. Use this path when both ends are Langfuse and the objects you need are the ones the scripts cover.

  • Source and target keys: Create API keys for each project involved, with read access on the source and write access on the target, and record which source project maps to which target project.
  • Runtime location: Run the scripts from a controlled host that can reach both instances, with a pinned Python version and a script version that matches your Langfuse versions.
  • Scope per object type: Confirm whether traces, prompts and datasets run as separate passes, and how the scripts handle identifiers, timestamps and dataset items.
  • Dry run on a copy: Run against a non-production target first, then compare object counts and sample records against the source.

Before running anything against production data, check the cookbook's current notes and confirm the exact instance versions on both ends.

Why version alignment comes before any data is copied

Settle the target version before anything is exported. Source and target should run compatible Langfuse versions, and the target version decides the infrastructure you must have in place. The v3 to v4 upgrade guide requires ClickHouse 25.12 or later (26.4 recommended), PostgreSQL 15 or later and Redis 7.0 or later. If your target is v4 and your source runs an older major version, the target's ClickHouse, PostgreSQL and Redis must meet those minimums before the first record is written. Check the upgrade guides from both your source version and your intended target, because the data model changes between majors. The latest release listed on the GitHub releases page at the time of writing is v4.63.0, but pick the version your SDKs, Helm chart and data stores support, not simply the newest one.

Plan disk capacity for the copy itself. The v3 to v4 guide advises about 3x ClickHouse disk headroom when backfilling historic data, which means a large trace history can need several times its stored size free while it is rewritten into the target. Ask your ClickHouse operator to confirm current disk usage, free space and merge behavior on the target before the job starts, and size the blob storage that holds media and large payloads the same way. Also confirm that the Langfuse Helm chart is at the version the upgrade guide expects if you use bundled data stores, since the guide calls for a chart upgrade from v1 to v2 first.

Align the SDKs with the server before cutover. Python SDK v5 and JS/TS SDK v6 need Langfuse v4.59.0 or later, so applications that send traces to the target must be upgraded in step with the server or they will fail to connect in the expected way. Inventory every client, including scripts and CI jobs, and record which SDK version each one uses. Then run the migration cookbook scripts against a non-production copy of both instances, confirm row counts and a sample of traces and prompts, and only then fix the version pair for the production run. Langfuse upgrade v3 to v4 guide lists the current requirements to confirm with your team.

How to sequence inventory, a pilot, a parallel run and cutover

The sequence moves trace history, prompts and datasets from a source Langfuse instance to a target without losing data or interrupting the applications that send traces. Each step ends with a written output that the next step depends on.

  1. Inventory projects, keys, prompts and datasets

    Your platform team lists every project on the source instance, the organizations and project IDs behind them, the API keys each application uses, the prompts and their labels, the datasets, and the retention settings in effect. Include the Langfuse version on both sides, because the copy scripts and SDK compatibility depend on it. The output is a mapping sheet that pairs each source project with a target project and each application with the key it will use after cutover. Confirm the mapping with the application owners before anything is copied.

  2. Confirm version and Enterprise feature gaps

    Check which Enterprise features the source uses, such as project-level roles, protected prompt labels, data retention policies or audit logs, and confirm whether the target has a license key that enables them. Compare the Langfuse versions and SDK versions that each application uses against the target. The output is a written list of settings that will not carry over automatically and an agreed version for the target. Record these gaps in the mapping sheet so that they are handled during the pilot rather than discovered at cutover.

  3. Run the pilot copy into a non-production target

    Using the data migration cookbook scripts from Langfuse, run a copy of one project's traces, prompts and datasets into a non-production target built to match production sizing. Your engineers review the scripts before running them and keep the run logs. Compare record counts, a sample of traces with their scores and metadata, prompt versions and labels, and dataset items between source and target. The output is a signed-off pilot report listing what matched, what differed and what must change in the process.

  4. Set up the target and check its capacity

    Prepare the production target with the same PostgreSQL, ClickHouse, Redis or Valkey and blob storage design you will operate, and confirm that ClickHouse has enough disk for the historic data you plan to copy. Load test ingestion from a test application so that you know the target can absorb new traces alongside the bulk copy. The output is a target sized in your infrastructure with a documented capacity check. Ask your platform team to confirm backup and restore for the target before data arrives.

  5. Run the parallel period with dual tracing

    Configure the instrumented applications to send new traces to both the source and the target, or send to the target while validating it against the source. Run the full historic copy of the remaining projects during this period, then repeat the comparison for records created since the first copy. Review trace volume, error rates, latency in the UI and any missing scores or prompt labels in the target each day of the period. The output is a validation record showing that new data arrives in both places and that the target matches the source for the agreed sample.

  6. Cut over SDK keys and hosts

    Switch each application's host setting and public and secret API keys to the target, one application group at a time, following the mapping sheet. Freeze prompt edits on the source during the switch so that no change is written to one side only, and rerun the final incremental copy for anything created after the last sync. Your engineers check that traces from each application appear in the target project and that prompts fetched by the applications return the expected labels. The output is a cutover log showing which application moved, when, and the check that confirmed it.

  7. Decommission the source after the retention window

    Keep the source instance read-only and running until the retention window your organization has set for audit and rollback has passed, then take a final backup. Confirm with compliance owners what must be retained and where, since deleting the source may remove evidence you still need. Shut down the source services and remove its keys, storage buckets and database volumes according to your deletion procedure. The output is a decommissioning record with the final backup location, the deletion date and the approvals that authorized it.

How data and keys flow from the source instance to the target

The flow starts at the source Langfuse, where traces, prompts and datasets sit in PostgreSQL, ClickHouse and blob storage. The migration scripts from Langfuse's data migration cookbook read through the source API with a source project key, then write to the target through its API with target keys. The hand-off to check is the key and project mapping: each source project needs a matching target project and its own API keys. Applications are repointed to the target only after the copied data is verified.

Data and API keys moving from the source deployment to the target across a trust boundary.

What makes a consolidation take longer or cost more

This table lists the factors that change the size of a Langfuse data move between self-hosted instances, the cost component each one touches, and what to ask a partner to quote. Read each row as a question to settle before scope is agreed, since most overruns trace back to one of these drivers being discovered late.

DriverWhy it changes cost or effortWhat to ask a partner to quote
Trace volume and ClickHouse disk headroomHistoric traces, observations and scores are read from one ClickHouse and written to another, so disk and compute needs grow with history. Langfuse's v4 guide advises about 3x ClickHouse disk headroom when backfilling historic data.Estimated data volume per project, disk headroom assumed, whether the copy runs in batches, and who sizes and monitors the target cluster.
Number of projects and mapping complexityEach source project must be mapped to a destination project, and each mapping needs its own verification. More projects mean more scripts runs, more checks and more chances for traces to land in the wrong place.Project inventory, the proposed source-to-destination mapping, naming rules, and how mapping decisions are recorded and signed off.
Prompts with labels and version historyPrompt versions, labels and their history must be re-created in the destination. Labels that production code depends on need a cutover plan so applications do not fetch the wrong version during the move.Count of prompts and versions, which labels are live in production, and how label state is verified after the copy.
Datasets and their itemsDatasets and dataset items move as structured records, and experiments or evaluators that reference them may need re-linking. Large item sets increase run time and validation effort.Number of datasets and items, whether experiment history must be kept, and how references between items and runs are checked.
Enterprise features in useRBAC roles, data retention policies, audit logs and similar features need an Enterprise license key and their settings do not all move with the data. Each one enabled on the source needs to be configured again on the destination.List of Enterprise features in use on each instance, license key status on both, and which settings are re-applied manually.
Versions of the two instancesIf the instances run different Langfuse versions, the copy may need a version alignment step first. Major version differences also bring different data models, which changes what the scripts read and write.Current version on each instance, the target version, whether an upgrade is needed before the move, and the upgrade sequence.
Number of SDK applications needing new keysEach application that sends traces must get a new project API key and a configuration change, then be tested. Applications owned by different teams add coordination and change-window work.Count of applications and owning teams, the key rotation plan, and who updates configuration and confirms traces arrive.
Cutover and parallel runningRunning both instances during cutover doubles some monitoring and requires a decision on which instance receives new traces at each step. Ingestion gaps or duplicates are costly to correct after the fact.Cutover steps, how long both systems run in parallel is decided by the client, and the reconciliation checks used to confirm counts match.

What usually goes wrong when merging or splitting Langfuse data

Most problems in a Langfuse data move are not transfer failures. They come from identifiers that map to the wrong place, data that was copied without the objects that depend on it, and storage or retention settings that work against the copy. Each card below names one failure, how to prevent it, and how to check the result before you cut over.

Duplicate traces after a parallel run

If the old and new instances both receive live traffic during a parallel run, and the backfill then re-imports the same history, traces appear twice and token and cost totals inflate. Prevent this by choosing one import key per trace, such as the trace ID, and by recording the timestamp where live ingestion switched to the new instance. Verify by comparing trace counts for a fixed time window on both sides before and after the backfill, and by sampling a few traces with repeated IDs.

Project and API key mapping errors

Scripts write to the project that a key points to, so a key mapped to the wrong project on the target sends data into the wrong workspace, and SDK clients keep sending to the old instance without any error. Build a written table of source project, target project and the public and secret keys that belong to each, and confirm it with the application owners. Verify by sending a test trace from each application key and checking which project it lands in.

Prompts losing labels or history

A prompt copied as its latest version may arrive without the version history, or with labels such as production that point to the wrong version, so deployed applications fetch an unexpected prompt. Decide which versions and labels must survive, then compare each prompt's version count and the version each label resolves to on both instances. Check that applications fetching by label receive the expected text in a staging environment before switching them over.

Experiments referencing datasets that did not copy

Experiment runs point to dataset items, and if the datasets are copied without preserving item IDs or are copied after the experiments, the run history loses its link to the items it tested. Copy datasets first, keep item identifiers stable where the script allows it, and then copy experiment results. Verify by opening a sample of migrated experiments and confirming that each run resolves to items in the target dataset.

Retention rules deleting data mid-move

A retention policy on the source or target can delete traces older than its window while a backfill is still reading them, so the copy finishes with gaps that look like successful runs. Review retention settings on both instances before starting, and pause or lengthen retention on the source for the move. The data retention policy is an Enterprise license feature, so confirm what your license covers. Verify by comparing the oldest trace timestamp on each side against the window you intended to move.

License key docs

Disk exhaustion during backfill

Backfilling historic data into ClickHouse needs extra room while parts are merged, and the Langfuse v4 guide advises about 3x ClickHouse disk headroom when backfilling historic data. Running out of disk mid-copy can stall ingestion on the target and leave a partial dataset. Measure the source data size and the free space on the target before starting, run the backfill in date-bounded batches, and watch disk use after each batch.

v4 upgrade guide

Questions teams ask before moving data between Langfuse instances

Is moving data between Langfuse instances a script run or a project?

For a small, well-understood dataset, it can be a scripted run; for a populated production instance, it is usually a project. Langfuse points to a data migration cookbook with Python scripts for transferring traces, prompts and datasets between two Langfuse instances, or between self-hosted and Langfuse Cloud. The scripts move data, but they do not decide which data should move, how projects map, or how the target is verified. Those decisions, plus the pre-move checks, make the difference between a run and a project.

What drives the effort of a Langfuse data migration?

Effort tracks the volume and shape of the data and how much must be proven afterward. The main drivers are:

  • Trace and observation volume, and how many projects and environments hold it
  • Whether the source and target run the same Langfuse version, since version alignment comes first
  • Prompt versions, labels and datasets that must keep their identity and links
  • API key and project mapping across the two instances
  • Whether historic data needs to be reingested into a newer data model
  • Disk headroom on the target ClickHouse, since Langfuse advises about 3x headroom when backfilling historic data

Ask any partner to break its estimate down along these drivers.

What does our team need to provide before a migration starts?

You need access, a written inventory and a decision on scope. Access means credentials for both instances, network paths between the source and the target, and infrastructure accounts for PostgreSQL, ClickHouse and S3-compatible blob storage on each side. The inventory lists projects, prompts, datasets, retention settings and any Enterprise features in use, because some of those settings may not carry over automatically. You also need a named owner who can approve the project mapping and sign off on verification results. Confirm these items with your Langfuse operators before the work is scoped.

Can our own engineers run the migration without a partner?

Yes, if they have the skills and time, and the cookbook scripts are the starting point. Your team needs working knowledge of Langfuse's API and data model, operational access to both deployments, and the ability to test the target before cutover. A partner adds value where the work is unfamiliar: planning the version and mapping decisions, running dry runs in a non-production copy, and documenting the evidence your change board will ask for. Decide which of those tasks your team can carry without weakening the result.

How long should we plan for a Langfuse data migration?

Plan for the time it takes to align versions, dry-run the scripts, verify the target and schedule a cutover window, not just the copy itself. We do not publish a duration for this work, and none is supplied here. The schedule depends on data volume, how many projects are involved, whether a major version upgrade is required first, and how many verification cycles your governance process needs. Ask for a timeline built from a written scope, with a dry-run stage and a go or no-go checkpoint before production cutover.

Does the cookbook cover everything that needs to move?

No. The cookbook transfers traces, prompts and datasets, but other items need their own plan. Items to confirm include API keys, project and user settings, RBAC roles, protected prompt labels, retention policies, audit logs, evaluators and integrations such as webhooks. Some of these are Enterprise features that need a license key on the target. Review the Langfuse FAQ on migrating data between instances and the scripts' documentation, then test each item on the target and record what did not move.

Should we settle Langfuse version and license questions before we move data?

Yes. Align the source and target versions, and check which features need an Enterprise license key on the target. Langfuse's self-hosted docs describe the Enterprise features, including RBAC roles, data retention and audit logs, that need a license key. Also confirm the SDK versions your applications use, because newer Python and JS/TS SDKs require specific Langfuse versions. Make these decisions in the planning stage, since a version mismatch found during cutover is expensive to unwind.

How DeployOpen scopes and delivers a Langfuse data migration

DeployOpen treats a migration between self-hosted Langfuse instances as a fixed-scope piece of work with written deliverables. We start from the source and target versions, data volumes and the features each side uses, then plan the copy, the key and project mapping, and the verification before anything moves.

How we scope

  • Inventory source and target versions, traces, prompts, datasets and projects to decide what moves.
  • Agree in writing which data is copied, which is rebuilt, and which stays behind in the source.
  • Map source projects and API keys to target projects, with named owners for each mapping decision.
  • Confirm the infrastructure sizing and free disk headroom the target ClickHouse needs before copying history.

How we build

  • Run the Langfuse data migration cookbook scripts for traces, prompts and datasets against a rehearsal instance first.
  • Align the target Langfuse version with the source and document any version steps before the copy starts.
  • Test each script run against counts and sample records in both instances, and record every discrepancy.
  • Rehearse the cutover of SDK endpoints and API keys so applications send new traces to the right project.

How we hand over

  • Deliver a runbook with the exact script order, parameters, mappings, verification steps and rollback notes.
  • Provide a reconciliation report listing what moved, what did not, and what your team must recreate manually.
  • Document settings that do not move automatically, such as users, roles, Enterprise configuration and integrations.
  • Walk your platform and data teams through the procedure so they can repeat or audit it later.

How we support

  • Engagements are fixed-scope, so changes to the agreed data set or mapping are handled through a written scope change.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Ask any proposal to name the source and target versions, the scripts used and the verification method it covers.
  • Confirm with your team which retention and Enterprise features are in use before requesting a quote.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.