Skip to main content

Migrate from Pact Broker or PactFlow

Apiome moves an existing Pact Broker or PactFlow workspace into your workspace in two ways: the Migration wizard in the console (Migrate from the UI), and apiome pact migrate from a terminal or a pipeline. Both read the source through its REST API — the source is only ever read — and re-create everything in your Apiome workspace:

  • pacticipants, with their repository, main branch and labels;
  • versions, with their build URL, branches and tags;
  • pacts and verification results;
  • environments, current deployments and current releases;
  • webhooks.

Each row keeps the time the source recorded it, so history, latest and branch heads read the same as before. Running a migration again changes nothing that is already there, and a run that stops part-way resumes where it left off. Before it writes anything, a dry run tells you what would be created and what cannot be carried over. After the copy, Apiome asks both brokers the same can-i-deploy questions to show they agree, lists who has moved, and can keep copying until every pipeline has.

An import fires nothing. No webhook, commit status or notification is sent for history that happened at the source.

Before you start​

Work through this checklist before the first run.

  • A read token for the source. On PactFlow, a read-only token from Settings › API Tokens. On an open-source Pact Broker, its token, or the basic-auth username and password.
  • A workspace API key for Apiome whose member can create and edit Pacts (the built-in Editor, Admin or Owner role; see Who can do what). Use a key without a Pact scope: a key limited to pact:read, pact:publish or pact:verify reaches the broker routes only, and the import is not one of them.
  • The secrets your webhooks use. PactFlow never exports secret values. For each secret the source has (the dry run lists them), create a workspace secret with the same name, so webhooks that refer to ${user.<name>} keep working.
  • No retention run yet. Imported versions keep their source dates. A retention rule such as older than 90 days would treat years of imported history as old. Run retention after the import, with a dry run first.
  • A pause on publishing to the source while you migrate, or plan a second run after the cut-over to pick up what was published meanwhile.

Migrate from the UI​

Open Contracts, then Migrate from a broker under Start something (or in the header's ⋯ menu). The wizard has four steps, and the migration itself runs on Apiome's servers: you can close the page while it copies.

  1. Connect. Enter the Broker URL — a public http(s) address — and choose how to Sign in with: an API token, or a Username and password. Press Test connection. The wizard answers with what it found, for example PactFlow · 42 pacticipants found, or with why not: Could not sign in to acme.pactflow.io (401). Check the token. Continue stays disabled until a test has passed. The token or password is used for this migration only and is never stored.

  2. Choose. Continue starts a dry run; the step fills in when it finishes.

    The Choose step of the Migration wizard: eight ticked tiles with counts from a dry run (42 pacticipants, 3,816 versions, 1,284 pacts, 9,402 verification results, 4 environments, 57 deployments and releases, 11 webhooks, 318 labels and tags), How much history with What clean-up would keep selected, the conflict policy on Keep Apiome’s, and a Before you copy strip open on 11 webhook notes.The Choose step of the Migration wizard: eight ticked tiles with counts from a dry run (42 pacticipants, 3,816 versions, 1,284 pacts, 9,402 verification results, 4 environments, 57 deployments and releases, 11 webhooks, 318 labels and tags), How much history with What clean-up would keep selected, the conflict policy on Keep Apiome’s, and a Before you copy strip open on 11 webhook notes.
    Route/ade/dashboard/pacts/migrate
    • What to copy: untick a kind to leave it behind. Each tile shows how many the source holds.
    • How much history: copy All verification results, the Latest per pact, or None; copy All versions, or only What clean-up would keep — the versions your keep-rules would remove anyway stay behind, with their pacts and results. That choice needs saved keep-rules.
    • When something already exists here: Keep Apiome’s, skip the source’s (the default), or Replace with the source’s. Replacing applies to a pact and to what is currently deployed; a verification result is never replaced, and is listed if it differs.
    • Before you copy: one strip lists everything the source holds that cannot be carried over as it is (see What is not carried over). Open a chip to read it.
    • Advanced: Start from scratch copies everything again instead of skipping what an earlier migration from this source copied; the two numbers are the command's --matrix-limit and --batch-bytes.

    Press Start copying.

  3. Copy. A progress bar, one row per kind (Copied, Skipped, Failed) and a live log.

    The Copy step of the Migration wizard at 31%: a striped progress bar, a table of kinds with copied, skipped and failed counts (pacts 612 of 1,284 with 2 failed, verification results waiting), the two failed pacts with their reasons, a log, and a Stop button.The Copy step of the Migration wizard at 31%: a striped progress bar, a table of kinds with copied, skipped and failed counts (pacts 612 of 1,284 with 2 failed, verification results waiting), the two failed pacts with their reasons, a log, and a Stop button.
    Route/ade/dashboard/pacts/migrate
    • Every record that fails is listed with its reason — see When a record is refused. When the copy ends with failures, Retry the N that failed takes the place of Continue; Continue without them moves on and leaves them in the report.
    • Stop stops the copy before its next batch. Resume carries on where it stopped: what was already copied is skipped, so nothing is copied twice.
    • You can leave the page. Past migrations in the header lists every migration of the workspace; Open puts one back in the wizard, and a copy that is still running opens by itself when you return.
    • Resuming a migration you reopened asks you to sign in to the source again, because the credentials were not kept.
  4. Switch over. See Switch over below. Download report saves the run as JSON: the counts, every failure with its reason, everything not portable, the agreement check, who has moved and the log. Press Finish, then work through After the import.

    The Switch over step of the Migration wizard: Copied. Apiome and acme.pactflow.io give the same answers — 40 can-i-deploy questions checked on both sides, 40 agree; the two variables to point pipelines at Apiome; Watch who has moved with Mobile App still on the old broker and Orders UI and Billing Service on Apiome; and Keep copying until everyone has moved switched on.The Switch over step of the Migration wizard: Copied. Apiome and acme.pactflow.io give the same answers — 40 can-i-deploy questions checked on both sides, 40 agree; the two variables to point pipelines at Apiome; Watch who has moved with Mobile App still on the old broker and Orders UI and Billing Service on Apiome; and Keep copying until everyone has moved switched on.
    Route/ade/dashboard/pacts/migrate

The wizard's The same, from anywhere block writes what you chose as apiome pact migrate and as the REST request; on Switch over it shows apiome pact migrate --follow and the request that switches keep-in-sync on. The kinds, the history depth and Replace with the source’s have no flag on the command, and the block says so.

Without permission to migrate (see Who can do what) the wizard is read-only and reads Ask a workspace admin to run this migration. You can still open Past migrations.

Switch over​

The last step answers three questions: does Apiome give the same answers as the old broker, which pipelines have moved, and what happens to what is still published to the old broker.

  • The agreement check. When the copy ends, Apiome asks both brokers the same can-i-deploy questions — up to 40: every version the old broker has deployed or released, and the latest version of each pacticipant, each against every environment — exactly as pact-broker can-i-deploy asks them. The step reads Copied. Apiome and acme.pactflow.io give the same answers. when every answer matches. When some do not, it reads, for example, 38 of 40 agree. and lists each difference with both answers and why:

    The cause readsWhat it meansWhat to do
    the verification result of … was not copied: …A result was refused or left behind by a choice (the reason follows)Fix what it names, then Retry on Copy, or copy the results
    the pact … was not copied / … was not copiedA pact or a version is missing in ApiomeAs above
    Apiome has a result … does notA pipeline already published to Apiome directlyNothing: that pipeline has moved
    … could not answer it — a selector it does not support?The old broker refused the question (an old Pact Broker without environments, for one)Nothing to fix in Apiome
    what is deployed to or released in … differsThe two record different versions in that environmentRecord the deployment in Apiome, or copy the deployments

    A question either side cannot answer counts as a difference — it is never dropped.

  • 1 · Point your pipelines here. The two variables a pipeline changes — PACT_BROKER_BASE_URL and PACT_BROKER_TOKEN — and Create a key with Pact scopes. The official Pact CLI and libraries keep working.

  • 2 · Watch who has moved. For each pacticipant, where it last published a pact (as a consumer) or a verification result (as a provider): Apiome or Old broker, with how long ago. Those still on the old broker are listed first. A copied record keeps the old broker's time, so a pacticipant counts as moved only once it publishes to Apiome after its last publication at the source.

Keep copying until everyone has moved​

Pipelines rarely move on the same day. Switch on Keep copying until everyone has moved and, every 15 minutes, Apiome copies what is new at the old broker: the run reads the source again and skips everything it already copied — it does not even fetch those pacts and results again — so only what was published since is brought over. Each pass refreshes the agreement check and Watch who has moved.

  1. On Switch over, turn on Keep copying until everyone has moved.
  2. If you reopened the migration from Past migrations, the step asks you to sign in to the source again; enter the token (or the username and password) and press Keep copying.
  3. Apiome tries the credentials and then keeps them encrypted for as long as keep-in-sync is on. The step shows when the next pass is due and when the last one copied.
  4. When every pacticipant reads Apiome, turn it off. The credentials are deleted.

If the old broker stops answering, the step says since when, and the passes keep trying. After 24 hours without an answer, keep-in-sync stops itself and says so: Keep-in-sync stopped itself: acme.pactflow.io could not be read for 24 hours …. Nothing copied is lost; switch it on again once the old broker answers.

One migration per workspace is kept in sync at a time. Keeping credentials needs an encryption key on the server (APIOME_MCP_CREDENTIAL_ENCRYPTION_KEYS); without one the switch is off and the step suggests apiome pact migrate --follow instead.

Migrate from the command line​

Set up the target as for every apiome pact command, and the source token in its own variable:

export PACT_BROKER_BASE_URL=https://api.apiome.dev/v1/tenants/acme/pact-broker
export PACT_BROKER_TOKEN=$APIOME_API_KEY
export PACT_SOURCE_BROKER_TOKEN=<read token for the source>

Prefer the variable to --token: other users of the machine can read a command line.

Check first: the dry run​

apiome pact migrate --from https://acme.pactflow.io --dry-run

The dry run reads the whole source and checks every record with Apiome, without writing anything. For each kind of record, the report shows how many were read, how many would be created and how many already exist. It then lists:

  • Not portable: what the source holds that cannot be carried over as it is, with what to do about it (see What is not carried over).
  • Would be refused: each record Apiome would not accept, with the reason. An example is a webhook whose URL points at a private address.
  • Not read from the source: what the migration never reads.

The dry run checks each record on its own. It does not check whether one record finds another: a verification result whose pact is not imported yet, or a deployment to an environment that does not exist yet. The import itself checks those.

Import​

apiome pact migrate --from https://acme.pactflow.io

The command reads the source, then sends the records in the order they depend on each other: pacticipants, environments, versions (oldest first), pacts, verification results, deployments, releases and webhooks. They go in batches of up to 100 records. It prints a line on stderr as it reads each part and sends each kind, then the report.

Each record is imported on its own. A refused record does not stop the others. The report lists it with the reason, and the command exits 1.

Resume and run again​

Progress is kept in apiome-pact-migrate.state.json in the current directory (--state picks another file). A second run with the same --from and workspace skips every record the first run imported, and does not even read its pact or result again. Only what was refused, or not reached, is sent. Fix what the report names, then run the same command again.

Importing a record that is already in Apiome changes nothing, so running again is always safe, even without the state file. --restart ignores the state file and sends everything again.

Keep copying: --follow​

While pipelines move one by one, --follow keeps the command running and copies again every --interval minutes (15 by default), from the same state file — so each pass reads and sends only what was published to the source since the last one:

apiome pact migrate --from https://acme.pactflow.io --follow

Press Ctrl-C to stop. If the source stops answering, each pass says so and the next one tries again; after 24 hours without an answer the command stops by itself, says so and exits 1. A wrong URL or token on the first pass fails at once. --follow cannot be combined with --dry-run. The wizard's keep-in-sync does the same on Apiome's servers.

Exit codes​

CodeMeaning
0Every record was imported or was already there (with --dry-run: would be imported)
1At least one record was refused, the source or Apiome refused a credential, or a flag was wrong; with --follow, the last pass refused a record or the source was unreachable for 24 hours

What is carried over​

SourceIn ApiomeKept
PacticipantPacticipant, handle derived from the namename, repository URL, main branch, labels, creation time
VersionPacticipant versionnumber, build URL, branches, tags (each with its own time), creation time
PactPact of that consumer versionthe document, publication time
Verification resultVerification result of that pactnumber, verdict, provider version, build URL, test results, verifier, time
EnvironmentEnvironmentname, display name, production flag, contacts, creation time
Current deploymentDeploymentversion, application instance, time
Current releaseReleaseversion, time
WebhookContract webhookuuid, description, events, consumer and provider, request, creation time

What is already in Apiome stays as it is. A record only adds what is missing: a label, a tag, a branch, or a repository or main branch the Apiome pacticipant does not have yet. The report counts those as updated.

What is not carried over​

The report lists each of these with what to do.

WhatWhyWhat to do
PactFlow secret valuesPactFlow never exports them; the dry run lists each secret's nameCreate each one as a workspace secret with the same name before the import
A webhook header or password the source shows as **********The source redacts credentialsThe webhook is imported turned off, and each credential becomes a secret waiting for a value. Set it on Contracts → Settings → Secrets; the webhook turns on by itself
A webhook that refers to a secret Apiome does not haveApiome resolves ${user.<name>} from its own secretsCreate the secret, then run again
Webhook events Apiome does not firePactFlow-only eventsThey are left out; a webhook with no event left is not imported
A pacticipant's display nameAn Apiome pacticipant has one name: the one pacts useNothing; the name is kept
Test results in a shape Apiome does not storeApiome stores an array, or an object with a tests arrayThe result is imported without them
Deployment history and releases whose support endedThe source lists only current deployments and releasesNothing; history starts with the current state
PactFlow teams, users, roles, API tokens and provider contractsNot part of a Pact Broker workspaceSet them up in Apiome: teams, roles, API keys, provider contracts
Webhook execution historyDeliveries are not exportedNothing; Apiome keeps its own delivery log from now on

For a workspace with a very long history, the source's matrix may hold more rows for one integration than the command asks for (1,000 by default). The report says so for that integration. Run again with a larger --matrix-limit.

When a record is refused​

CodeMeaningWhat to do
pact-migration-invalidThe record cannot be read; the message names the field, e.g. /records/3/numberUsually a value the source holds that Apiome does not accept; fix it at the source or leave it
pact-migration-reference-missingA verification result whose pact, or a deployment whose environment, is not in ApiomeRun again: the earlier record is usually refused for another reason listed above it
pact-migration-conflictApiome already records it differently: another pact for that consumer version, another version deployed there, or another result with that numberDecide which one is right; Apiome's own record is kept. In the wizard, Keep Apiome’s counts it as skipped rather than failed, and Replace with the source’s replaces a pact or a deployment
pact-webhook-invalidThe webhook breaks a webhook rule, such as a private host or a missing secretFix the webhook or create the secret, then run again
source-unreadableThe source listed a pact or result but no longer returns itNothing, or run again if the source was briefly unavailable

After the import​

  • Set the secrets the report lists on Contracts → Settings → Secrets (each reads No value); the webhooks waiting for them turn on by themselves.
  • Check the answers agree. The wizard's Switch over step asks both brokers the same can-i-deploy questions. From the command line, run apiome pact can-i-deploy for one application against Apiome and against the source; the verdicts should match.
  • Point CI at Apiome. Change PACT_BROKER_BASE_URL and PACT_BROKER_TOKEN in your pipelines (see Run Pact in CI). Your pact-broker commands keep working, or move them to apiome pact.
  • Keep copying until everyone has moved — the wizard's switch, or apiome pact migrate --follow — or run the migration once more after the last publish to the source.
  • Set up retention for the imported history, with a dry run first (Labels, deletes and retention).
  • Assign owners to the pacticipants so failures reach a team (Give a pacticipant an owner).

Who can do what​

ActionPermission
Run the import with apiome pact migratePacts create and edit (Editor, Admin, Owner)
Run a dry run with apiome pact migrate --dry-runPacts view (every role)
Use the wizard: test a connection, run a dry run, copy, resumePacts create and edit (Editor, Admin, Owner)
Stop a migration in the wizardPacts edit
Switch Keep copying until everyone has moved on or offPacts create and edit (Editor, Admin, Owner)
Read Past migrationsPacts view (every role)

The wizard needs create and edit even for a dry run, because Apiome's servers reach the source on your word.

Each import request of the command is recorded in the Access audit as pacts.migration.import. The wizard records pacts.migration.source.test, pacts.migration.run.start, .stop and .resume, and pacts.migration.sync.update when keep-in-sync is switched on or off. An audit entry holds the request's route, never its records and never the source's credentials.

For automation: the REST API​

The wizard's server-side runs are routes any tool can call:

  • POST /v1/tenants/{tenant}/pact-migration/test signs in to a source and counts its pacticipants;
  • POST /v1/tenants/{tenant}/pact-migration/runs starts a run — mode: "dry-run" or "copy", with options for the kinds, history depth and conflict policy — and answers 202 with the run;
  • GET /v1/tenants/{tenant}/pact-migration/runs lists the runs, and GET …/runs/{run_id}?after=<last log line> reads one: counts per kind, findings, failures and log;
  • POST …/runs/{run_id}/stop stops it, and POST …/runs/{run_id}/resume carries on, given the source's credentials again;
  • GET …/runs/{run_id}/sync reads keep-in-sync, and PUT …/runs/{run_id}/sync switches it: {"enabled": true, "token": "…", "interval_minutes": 15} (5 to 1,440 minutes) or {"enabled": false}.

A finished copy carries the switch-over checks in facts: agreement (asked, agree, differences with their cause) and moved (each pacticipant's last: apiome, source or none). options.agreement_questions sets how many questions are asked (0 to 200; 0 skips the check).

A workspace runs one migration at a time (409 pact-migration-run-active). The source URL must be a public http(s) address (422 pact-migration-source-invalid); a refused sign-in is 422 pact-migration-source-refused. The credentials are sent with the request that starts or resumes a run and are not stored — except, encrypted, while keep-in-sync is on. Switching keep-in-sync on answers 409 pact-migration-sync-active when another migration of the workspace is kept in sync, 422 pact-migration-sync-invalid for a dry run, and 503 pact-migration-sync-unavailable when the server has no encryption key.

The command itself sends what it reads to two routes, which any tool can also call:

  • POST /v1/tenants/{tenant}/pact-migration/import writes a batch of up to 100 records;
  • POST /v1/tenants/{tenant}/pact-migration/check answers the same batch without writing it.

Each record has a kind (pacticipant, environment, version, pact, verification, deployment, release or webhook) and an optional created_at. The answer lists one outcome per record, in order: created, updated, unchanged or refused (with code and message), and would-create or exists for a check. The fields of each kind are in the REST reference.