# Move from another provider

> Map the fields and events of your current setup to CustomDomain™.

Source: https://docs.customdomain.ai/docs/guides/move-from-another-provider

If your product already connects customer domains through another service, the
move is mostly renaming. This page maps what you store and handle today to what
CustomDomain™ uses. Your customers' domains stay where they are until you decide
to point them at us.

> **Moving a live domain**
>
> A domain that is live elsewhere keeps serving until its records change. Connect
> it here, check that it reads `live`, and only then retire the old setup. Domains
> already connected can be added up to 200 at a time with `POST /v1/connections:bulk`.

## The plan

1. Create an [application](/docs/concepts/applications) and a [key](/docs/build/keys).
2. Replace the call that opens your current connect flow with a token route
   on your server and the [widget](/docs/widget-sdk/installation-and-embed).
3. Register a [webhook](/docs/webhooks/overview) and map its events using the
   table below.
4. Connect a made up `.test` name in the [Sandbox](/docs/build/sandbox) to
   check your receiver end to end.
5. Connect your customers' domains, then retire the old handlers.

## Fields

| Your current setup                                   | CustomDomain™                                                          | Notes                                                                                                                                                                                              |
| ---------------------------------------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Your own id for the customer, kept on the connection | `end_user_ref`                                                         | Send it when you [mint the token](/docs/authentication/widget-tokens) or create the connection. Webhooks echo it as `user_id`. Do not start ids with `console:`; the console reserves that prefix. |
| The customer's domain                                | `domain` on the connection, plus `host` for the subdomain label        | A connection is one hostname.                                                                                                                                                                      |
| Provider that was detected or used                   | `provider_id` on the connection, `provider` on events                  |                                                                                                                                                                                                    |
| How the setup was done                               | `setup_type` (`automatic`, `manual`, `async`, `mcp`)                   |                                                                                                                                                                                                    |
| A flat propagation status                            | `status` on the connection: `pending`, `propagating`, `live`, `failed` | Events also carry `propagation_status` (`pending`, `success`, `timeout`) and `connection_id`, so a receiver rarely has to read the connection again.                                               |
| A certificate status                                 | `certificate.*` events and `GET /v1/connections/{id}/certificate`      | See [Certificates](/docs/connect-flow/certificates).                                                                                                                                               |
| A redirect status                                    | `redirection_status` on events, `www_redirect` on the connection       | Present only where the domain is on the CustomDomain™ edge.                                                                                                                                        |
| The DNS records to show                              | `records` on the connection                                            | Computed for you from the application's [target](/docs/connect-flow/routing).                                                                                                                      |
| A job or request id for a check                      | The connection `id`                                                    | `POST /v1/connections/{id}:recheck` checks now.                                                                                                                                                    |
| Your own label                                       | `client_label`                                                         |                                                                                                                                                                                                    |

## Events

| If your handler runs when             | Subscribe to                                      | Notes                                                                              |
| ------------------------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------- |
| A domain is added                     | `connection.created`                              |                                                                                    |
| Records are written for it            | `connection.applied`                              | `data.via` says which way. `updated_objects` lists what was written.               |
| Records are seen and the domain works | `connection.live`                                 | This is the one most integrations act on.                                          |
| Records never showed up               | `connection.failed`                               | A recorded `error_code` rides along. See [Troubleshooting](/docs/troubleshooting). |
| A certificate is issued or renewed    | `certificate.issued`, `certificate.renewed`       | `certificate.failed` and `certificate.expiring` also exist.                        |
| A record disappeared later            | `domain.record_missing`, `domain.record_restored` | Sent only where drift alerts are on for your service.                              |
| A domain is removed                   | `connection.disconnected`                         | `removal` says what happened to its records.                                       |

The full list is the [event catalog](/docs/webhooks/overview#event-catalog).

## Webhook receiver

* **Signatures.** Verify with the `CustomDomain-Signature` and
  `CustomDomain-Timestamp` headers and your endpoint's `whsec_` secret. See
  [Verifying signatures](/docs/webhooks/verifying-signatures).
* **Idempotency.** The same event can arrive more than once. Deduplicate on the
  envelope `id`.
* **Retries.** A delivery succeeds on any `2xx` within 15 seconds. See
  [Delivery and retries](/docs/webhooks/overview#delivery--retries).

## Different targets for different customers

A connection takes the target of its [application](/docs/concepts/applications),
set with `PUT /v1/applications/{id}/connect-target`. If today you pass a different
set of records for each customer, create one application per target.

## Check your work

* A `.test` name in a Sandbox application reaches `live` after about 15 seconds
  and sends the same events as a real one, marked `"sandbox": true`.
* Your handler sees `user_id` equal to the `end_user_ref` you sent.
* Replaying a delivery (`POST /v1/webhook-deliveries/{id}/replay`) does not
  change anything twice.
