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

# WebDAV

> Sync data from your warehouse to a WebDAV server as CSV, JSON, NDJSON, XML, or Parquet files.

## Supported syncing

| Object Type | Description | Supported Sync Modes |
| - | - | - |
| Any data set | Sync data from a source to a WebDAV server as CSV, JSON, NDJSON, XML, or Parquet files | Insert, All, Diff |

* **All**: All mode creates one file with all the rows in the query results, every time the sync runs.
* **Insert**: Insert mode creates one file with the rows that were added since the last sync.
* **Diff**: Diff mode creates three files, one for rows added, one for rows changed, and another for rows removed since the last sync.

For more information about sync modes, refer to the [sync modes](https://docs.hightouch.com/syncs/types-and-modes.md#sync-modes) docs.

> [!NOTE]
>
> The order of rows and columns in uploaded files may differ from how they appear in your model. This is expected behavior and applies to all sync modes. [Learn more about row and column ordering](https://docs.hightouch.com/models/creating-models.md#row-and-column-ordering).

## Connect to WebDAV

Go to the [**Destinations** overview page](https://app.hightouch.com/destinations?from=docs) and click the **Add destination** button. Select **WebDAV** and click **Continue**. You can then authenticate Hightouch to your WebDAV server by entering the following fields:

* **WebDAV Server URL**: The base URL of your WebDAV server, for example `https://dav.example.com/files/`. Hightouch uploads files relative to this URL.
* **Username**: The username Hightouch uses to authenticate.
* **Password**: The password for the user.

> [!WARNING]
>
> The user you configure must have write access to the target directory on your WebDAV server. A `403 Forbidden` response during a sync indicates insufficient permissions.

> [!NOTE]
>
> You may need to allowlist Hightouch's IP addresses to let our systems connect to your WebDAV server. Reference our [networking docs](https://docs.hightouch.com/security/networking#ip-addresses) to determine which IP addresses you need to allowlist.

Hightouch uses HTTP Basic Authentication and sends an `OPTIONS` request to verify that the server is reachable and the credentials are valid when you test the connection.

> [!NOTE]
>
> Hightouch buffers each file to disk before uploading so it can set an accurate `Content-Length` header. Some WebDAV servers reject chunked transfer encoding, so this ensures compatibility.

## Sync configuration

Once you've set up your WebDAV destination and have a [model](https://docs.hightouch.com/getting-started/concepts.md#models) to pull data from, you can set up your sync configuration to begin syncing data. Go to the [**Syncs** overview page](https://app.hightouch.com/syncs?from=docs) and click the **Add sync** button to begin. Then, select the relevant model and the WebDAV destination you want to sync to.

### Select file format

Hightouch supports syncing CSV, JSON, NDJSON, XML, and Parquet files via WebDAV.

### Enter filename

The filename field lets you specify the path and name of the file relative to your WebDAV server URL.
You can include timestamp variables in the filename, surrounding each with `{}`.
Hightouch supports these timestamp variables:

* `YYYY`: Represents the full year in four digits.
* `YY`: The last two digits of the year.
* `MM`: Two-digit month format (01-12).
* `DD`: Two-digit day format (01-31).
* `HH`: Two-digit hour format in 24-hour clock (00-23).
* `mm`: Two-digit minute format (00-59).
* `ss`: Two-digit second format (00-59).
* `ms`: Three-digit millisecond format.
* `X`: Unix timestamp in seconds.
* `x`: Unix timestamp in milliseconds.

All dates and times are UTC.

For example, you could enter `upload/{YYYY}-{MM}-{DD}-{HH}-{mm}-result.json` to dynamically include the year, month, date, hour, and minute in each uploaded file. Hightouch would place the file at `https://dav.example.com/files/upload/{YYYY}-{MM}-{DD}-{HH}-{mm}-result.json`, so the `upload` directory must already exist on your server.

You can also use other [variable values](https://docs.hightouch.com/syncs/mapping-data.md#variable-values) to include sync metadata in the filename:

* `{model.id}`
* `{model.name}`
* `{sync.id}`
* `{sync.run.id}`

> [!NOTE]
>
> If a file already exists at the path you entered at the time of a sync, Hightouch overwrites it.

> [!TIP]
>
> If you are using an audience and would like to include the audience name, you will still use `{model.name}`.

### Set filename offset

By default, Hightouch uses the timestamp of the sync run to fill in timestamp variables. You can optionally include an offset in seconds. For example, if you want the filename's date to be 24 hours *before* the sync takes place, enter `-86400` (`24 hours * 60 minutes * 60 seconds`). If you want the filename's date to be one hour after the sync takes place, enter `3600` (`60 minutes * 60 seconds`).

### CSV options

If you're syncing to a CSV file, you have additional configuration options:

* **Delimiter**: Your options are comma (`,`), semicolon (`;`), pipe (`|`), tilde (`~`), and tab
* (Optional) Whether to **include a CSV header row** in the exported files
* (Optional) Whether to **include a [byte order mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark)** in the exported files, the BOM is `<U+FEFF>`

### Columns to sync

You can export all columns exactly as your model returns them or choose to export specific ones.

If you need to rename or transform any column values you're syncing, you can use the [advanced mapper](https://docs.hightouch.com/syncs/mapping-data.md#advanced-mapper) to do so. If you choose this option, Hightouch only syncs the fields you explicitly map.

### Batch size

By default, and depending on your [sync mode](#supported-syncing), Hightouch sends one file for each export. (In diff mode, Hightouch sends three files.)

By enabling batching, you allow Hightouch to send multiple files if your model query results are large. This can help avoid file size errors.

### Empty file results

You can select how Hightouch should handle empty results files. Empty result files can occur if your model's query results haven't changed since the last sync.

You can select whether to **skip empty files**. If you skip empty files, Hightouch won't upload any files if your model's query results haven't changed since your last sync.

## Tips and troubleshooting

To see the exact API requests and responses from each sync run, use the [live debugger](https://docs.hightouch.com/syncs/debugger.md). To get notified by Slack, PagerDuty, SMS, or email when a sync fails, set up [sync alerts](https://docs.hightouch.com/syncs/alerting.md). If you run into an issue this page doesn't cover, [contact support](#pylon-chat).

> [!TIP]
>
> The **Test connection** button on the destination configuration page sends an `OPTIONS` request to verify that the server is reachable and the credentials are valid. To fully test write permissions, create and run a one-row test sync to verify that data reaches your WebDAV server.

## Common errors

### 401 Unauthorized

The username or password is incorrect, or the server requires a different authentication method. Verify your credentials and confirm that the server accepts HTTP Basic Authentication.

### 403 Forbidden

The user doesn't have write permission for the target path. Grant write access to the configured user in your WebDAV server, or update the destination to use a path the user can write to.

### 405 Method Not Allowed

The server doesn't support `PUT` requests at the target path. Confirm that your WebDAV server has write operations enabled and that the target path allows writes.
