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

# Sync client

> Keep a local folder or a Postgres database current with one command

<Info>
  Data Feeds is in early access. [Contact us](mailto:support@ploti.ai) to set up
  a subscription; the API and sync client described here open to early access
  customers first.
</Info>

The Ploti CLI includes a sync client that runs the whole loop: it loads each dataset's snapshot, applies changes in order, follows schema changes and reloads when asked. Use it as is, or read it as a reference for your own.

## Install and sign in

```bash theme={null}
npm install -g @ploti/cli
ploti login
```

## Sync to a folder

```bash theme={null}
ploti sync sub_8f3k2m --to ./ploti-data
```

Writes each dataset as GeoParquet under `./ploti-data/{datasetId}/`, plus a `state.json` holding the event cursor. Run it again, or on a schedule, to catch up.

## Sync to Postgres

```bash theme={null}
ploti sync sub_8f3k2m --to postgres://user@host:5432/records --schema ploti
```

Creates one table per dataset in the `ploti` schema, keyed on `_ploti_record_id`, with PostGIS geometry. Changes are applied in one transaction per version, so readers never see a half-applied version.

## Options

| Option | Effect |
| - | - |
| `--watch` | Keep running and apply events as webhooks or the log deliver them. |
| `--on-breaking hold` | Default. Stop a dataset at its current version on a MAJOR schema change and report it. |
| `--on-breaking apply` | Migrate the table and continue. |
| `--format csv` | Write CSV instead of GeoParquet (folder target only). |
| `--datasets a,b` | Sync only these datasets from the subscription. |


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