# 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](/app/generation/table-modes.md), which determines at a high level how to populate the table in the destination database.

Some data connectors also support [table filters](/app/generation/subsetting/table-filtering.md), 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;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/api/quick-start-guide/tonic-api-table-modes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
