Skip to main content
Use the sync endpoints to keep Pocketflows matched to your own records. You identify each record with your own identifier, the external_id, and Pocketflows creates the record if it doesn’t exist or replaces it if it does. For the model behind this, see How syncing works.
A sync request replaces the whole record. Properties you leave out are blanked out, so pass every property in every sync request.

1. Sync a business

Pass the unique identifier you already have for the business as external_id, along with its name. metadata is optional.
The response is the business, including its Pocketflows id. Save this id to use as the business_id in the customer endpoints below.

2. Sync a customer of that business

Pass the unique identifier you already have for the customer as external_id, along with the customer’s properties: email_address, phone_number, full_name, first_name, last_name, and metadata. Every request must include at least one of email_address or phone_number.
The response is the customer, including its Pocketflows id. To change one property on an existing customer, send the full record again with the new value. This request clears the phone number and keeps the email address and name, because they are sent again:

3. Sync in batches

To sync many records in one request, send them as an array. Each record takes the same properties as the single-record request.
The customer batch endpoint allows for partial success: when a customer is invalid, the rest of the request still processes. In the response, the customers array contains null for the customers that had errors, and the errors array says what went wrong with each one. A request can contain at most 15,000 customers. The business batch endpoint is all or nothing: if any business is invalid, for example an id that does not match one of your businesses, the request fails and no businesses are synced.

Keep records in sync over time

After the first sync, send changes as they happen in your system:
  • A property changes, such as a new phone number: sync the full record again, as in step 2.
  • A customer opts out of marketing: see Respect customer consent. Sync doesn’t change a customer’s unsubscribes.
  • A customer is deleted: call DELETE /customers/:id with the customer’s Pocketflows id. There is no way to delete or look up a customer by external_id, so store the id from each sync response alongside your own record.

Re-running a sync

Sending the same external_id again finds the existing record and replaces it, so repeating a sync does not create a second record. To retry an individual request safely, see Idempotency keys.