> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketflows.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate to the sync endpoints

> Move business and customer creation and updating onto the sync endpoints

This guide is for integrations that already use the previous endpoints. If you
are starting fresh, see
[Sync businesses and customers](https://docs.pocketflows.com/how-to/sync-businesses-and-customers.md).

If you are using any of the following endpoints to create or update businesses
and customer, you can migrate to the syncing endpoints.

* `POST /businesses`
* `POST /businesses/:id`
* `POST /businesses/:id/customers`
* `POST /businesses/:id/customers/batch`
* `POST /businesses/:id/customers/batch_update`
* `POST /customers/:id`

> [!NOTE]
>
> A sync request replaces the whole record and blanks out properties that are not provided, so pass
> all properties in every sync request. See [How syncing works](https://docs.pocketflows.com/concepts/sync.md).

## Steps

Migration will generally look like the following:

1. Move business creation and updating to `POST /sync/businesses` (for single
   updates / creates) and `POST /sync/businesses/batch` (to update multiple
   businesses at once, previously not possible!). Crucially, pass both `id` and
   `external_id` so that Pocketflows can associate the existing `id` with the
   new `external_id`
2. Move customer creation and updating to
   `POST /sync/businesses/:business_id/customers` (for updating or creating a
   single customer) or `POST /sync/businesses/:business_id/customers/batch` (for
   updating all the customers of a business). Again, be sure to pass both `id`
   and `external_id` so that we can associate the IDs together.
3. At some point in the future when all Pocketflows businesses and customers
   have the correct `external_id` associated, you can stop sending `id` as part
   of the payload.

If you have any uncertainty, please reach out to the team at
[team@pocketflows.com](mailto:team@pocketflows.com)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.