# Assign table modes and filters to source database tables

{% hint style="info" %}
Requires the Advanced  API. The Advanced API requires an Enterprise license.
{% endhint %}

Each table is assigned a [table mode](https://docs.tonic.ai/app/generation/table-modes), which determines at a high level how to populate the table in the destination database.

Some data connectors also support [table filters](https://docs.tonic.ai/app/generation/subsetting/table-filtering), which use a `WHERE` clause to restrict the table records to include.

You can use the API to set table modes and table filters.

## Getting the current table modes and filters for a workspace <a href="#api-table-mode-get" id="api-table-mode-get"></a>

To get the current assigned table modes and table filters for a workspace, use:

<mark style="background-color:blue;">**GET**</mark> [**/api/Workspace/{workspaceId}/tablemodes**](https://app.tonic.ai/apidocs/index.html#/Workspace/GetTableModes)

The response contains the list of tables. For each table, the list includes the assigned table mode and, if applicable, the table filter.

## Setting table modes and filters for a workspace <a href="#api-table-mode-set" id="api-table-mode-set"></a>

To set the assigned table modes and table filters for a workspace, use:

<mark style="background-color:green;">**POST**</mark> [**/api/Workspace/{workspaceId}/tablemodes**](https://app.tonic.ai/apidocs/index.html#/Workspace/SetTableMode)

The request provides the list of tables. For each table, the list includes the table mode to assign and, if applicable, the table filter.

For example:

```json
{
  "schema": "public",
  "table": "transactions",
  "tableMode": "Masked",
  "filterClause": "date > '2022-05-02'"
}
```

The available values for `tableMode` are:

* `Masked` - Indicates to use De-Identify table mode. This is the default table mode.
* `Truncated` - Indicates to use Truncate table mode.
* `PreserveDestination` - Indicates to use Preserve Destination table mode.
* `Incremental` - Indicates to use Incremental table mode. Note that for Incremental mode to work, you must specify a date updated column to use. You cannot use the API to select the column. You must use the Structural application.&#x20;

## Setting the same table mode for multiple tables <a href="#api-table-mode-multi-table-single-mode" id="api-table-mode-multi-table-single-mode"></a>

To assign the same table mode to a set of tables, you can use:

[<mark style="background-color:green;">**POST**</mark>**&#x20;/api/Workspace/{workspaceId}/bulk\_table\_mode**](https://app.tonic.ai/apidocs/index.html#/Workspace/SetTableModeBulk)

The request provides a list of tables to update, and the table mode (`tableModeEnum`) to assign to those tables.

For example:

```json
{
  "tables": [
    {
      "schema": "public",
      "table": "customers_legacy"
    },
    {
      "schema": "public",
      "table": "legacy_wo"
    }
  ],
  "tableModeEnum": "Truncated"
}
```

The available values for `tableModeEnum` are:

* `Masked` - Indicates to use De-Identify table mode. This is the default table mode.
* `Truncated` - Indicates to use Truncate table mode.
* `PreserveDestination` - Indicates to use Preserve Destination table mode.
* `Incremental` - Indicates to use Incremental table mode. Note that for Incremental mode to work, you must specify a date updated column to use. You cannot use the API to select the column. You must use the Structural application.&#x20;
