---
title: "Import existing connections"
description: "Move a Baileys or whatsmeow session to Polymorfa without pairing the phone again."
canonical: "https://docs.polymorfa.com/connections/import-connections"
---
# Import existing connections

> Move a Baileys or whatsmeow session to Polymorfa without pairing the phone again.

If a phone is already linked to Baileys or whatsmeow, you can move that linked
device to Polymorfa instead of pairing again. The phone stays linked, and the
Connection continues in your Polymorfa project.

> **Warning**
>
> **Never run the source and the imported copy at the same time.** Two copies of
> one linked device compete, and WhatsApp can invalidate the connection. Keep the
> source offline from the snapshot until Polymorfa reports the imported Connection
> as connected.

## Before you begin

- A project and a credential with `connections:manage` on your server.
- A destination Connection reserved through [QuickLink](https://docs.polymorfa.com/connections/quicklink).
- Access to the source's authentication state: the Baileys
  `SignalStoreSnapshot`, or the whatsmeow device store database.

In the Console, **Connections → New connection → Import existing connections** shows the
same steps for each source.

## Import a Baileys session

### Stop the source

Stop all writes to the Baileys authentication state, then take the
`SignalStoreSnapshot`.

### Request the handoff key

Call [Get handoff keys](https://docs.polymorfa.com/api/connections/get-handoff-keys) for the
destination Connection:

```bash
curl -X POST "https://api.polymorfa.com/platform/connections/$CONNECTION_ID/handoff-keys" \
  -H "Authorization: Bearer $POLYMORFA_KEY"
```

The response contains `runnerPublicKeyB64`, the Curve25519 public key to seal
the snapshot to (base64url, no padding), and `handoffId`, which you send back
in the next step.

### Seal the snapshot

Seal the snapshot JSON to `runnerPublicKeyB64` as a sealed box: the 32-byte
ephemeral public key followed by the ciphertext, base64-encoded. Calculate the
SHA-256 hash of the unsealed snapshot JSON as hex.

### Submit the sealed snapshot

Call [Import handoff state](https://docs.polymorfa.com/api/connections/import-handoff-state):

```bash
curl -X POST "https://api.polymorfa.com/platform/connections/$CONNECTION_ID/handoff-import" \
  -H "Authorization: Bearer $POLYMORFA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "handoffId": "'"$HANDOFF_ID"'",
    "sealedEnvelopeB64": "'"$SEALED_ENVELOPE"'",
    "snapshotHashHex": "'"$SNAPSHOT_SHA256"'"
  }'
```

Polymorfa verifies the hash after decrypting the snapshot.

### Wait for the connection

Keep Baileys offline until the Connection reports `connection.connected` or its
status is `CONNECTED`. Then resume traffic through Polymorfa.

## Import a whatsmeow session

whatsmeow sessions move through assisted migration. The Console does not
accept raw database uploads.

1. Keep the whatsmeow device store offline and its database unchanged.
2. Export the device record and Signal tables from one consistent database
   snapshot.
3. Send the snapshot through the assisted migration path.
4. Keep the original store unchanged until Polymorfa confirms the imported
   Connection is connected.

## Verify the import

Read the Connection with [Get connection](https://docs.polymorfa.com/api/connections/get-connection), or
watch for `connection.connected` on a [webhook](https://docs.polymorfa.com/development/webhooks). Send a
test message before you retire the source.

## See also

- [Create a Connection with QuickLink](https://docs.polymorfa.com/connections/quicklink)
- [Start, stop and restart Connections](https://docs.polymorfa.com/connections/manage)
- [Connections API reference](https://docs.polymorfa.com/api/connections/list-connections)
