---
title: Tables
url: https://anyrow.ai/docs/api/tables
canonical_url: https://anyrow.ai/docs/api/tables
---

# Tables

A table is a schema: named, typed columns and how strictly to fill them.

- [List tables](https://anyrow.ai/docs/api/tables/list.md): `GET /v1/projects/{project_id}/tables`
- [Create table](https://anyrow.ai/docs/api/tables/create.md): `POST /v1/projects/{project_id}/tables`
- [Get table](https://anyrow.ai/docs/api/tables/get.md): `GET /v1/projects/{project_id}/tables/{table_id}`
- [Update table](https://anyrow.ai/docs/api/tables/update.md): `PATCH /v1/projects/{project_id}/tables/{table_id}`
- [Delete table (soft, 72h grace)](https://anyrow.ai/docs/api/tables/delete.md): `DELETE /v1/projects/{project_id}/tables/{table_id}`
- [Duplicate table structure](https://anyrow.ai/docs/api/tables/duplicate.md): `POST /v1/projects/{project_id}/tables/{table_id}/duplicate`
- [Restore deleted table](https://anyrow.ai/docs/api/tables/restore.md): `POST /v1/projects/{project_id}/tables/{table_id}/restore`

## The Table object

- `created_at` (integer, required): At least 0.
- `deleted_at` (integer, required, nullable): At least 0.
- `updated_at` (integer, required): At least 0.
- `id` (string, required): 1 to 48 characters.
- `project_id` (string, required): 1 to 48 characters.
- `name` (string, required): 1 to 128 characters.
- `slug` (string, required): 1 to 50 characters.
- `columns_json` (array of objects, required): 1 to 100 items.
  - `currency_code` (string, optional): Exactly 3 characters.
  - `default` (any, optional)
  - `description` (string, optional, nullable): Up to 256 characters.
  - `id` (string, required): 1 to 36 characters.
  - `instruction` (string, optional, nullable): Up to 512 characters.
  - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
  - `options` (array of strings, optional): Up to 500 items.
  - `required` (boolean, required): Defaults to `false`.
  - `searchable` (boolean, optional)
  - `type` (string, required): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
- `instruction` (string, required, nullable): Up to 512 characters.
- `strictness` (string, required): One of `strict`, `balanced`, `flexible`.
- `insert_mode` (string, required): One of `append`, `dedup`, `merge`, `replace`.
- `merge_columns_json` (array of strings, required, nullable): At least 1 items.
- `default_sort` (string, required, nullable)
- `row_count` (integer, required): At least 0.
- `usage_count` (integer, required): At least 0.
- `data_version` (integer, required): At least 0.
- `fts_version` (integer, required): At least 0.
- `last_used_at` (integer, required, nullable): At least 0.

```json
{
  "created_at": 1711468800000,
  "deleted_at": 1711468800000,
  "updated_at": 1711468800000,
  "id": "tbl_01h5a3g8k9m2n4p6q8r0t2v4x6",
  "project_id": "string",
  "name": "string",
  "slug": "string",
  "columns_json": [
    {
      "currency_code": "string",
      "description": "string",
      "id": "string",
      "instruction": "string",
      "name": "string",
      "options": [
        "string"
      ],
      "required": false,
      "searchable": true,
      "type": "string"
    }
  ],
  "instruction": "string",
  "strictness": "strict",
  "insert_mode": "append",
  "merge_columns_json": [
    "string"
  ],
  "default_sort": "string",
  "row_count": 42,
  "usage_count": 42,
  "data_version": 42,
  "fts_version": 42,
  "last_used_at": 1711468800000
}
```

## List tables

`GET /v1/projects/{project_id}/tables`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)

### Query parameters

- `cursor` (string, optional): Opaque cursor for forward pagination. Pass the nextCursor from the previous response with the same order. Takes precedence over page when both are sent.
- `page` (integer, optional): 1-based page number for offset pagination. Ignored when cursor is present. At least 1.
- `order` (string, optional): Sort keys, comma-separated, each `field[.asc|.desc][.nullsfirst|.nullslast]`; at most 3. Sortable: created_at, name, row_count, last_used_at, updated_at. Default: created_at.desc. Nulls sort last ascending and first descending unless stated. Matches `^(?:created_at|name|row_count|last_used_at|updated_at)(?:\.(?:asc|desc))?(?:\.(?:nullsfirst|nullslast))?(?:,(?:created_at|name|row_count|last_used_at|updated_at)(?:\.(?:asc|desc))?(?:\.(?:nullsfirst|nullslast))?){0,2}$`.
- `filter` (string, optional): Filter expression `field.op.value`; `,` joins conditions with AND; group with `or(...)` and `and(...)`. Fields: created_at (number: eq, ne, neq, gt, gte, lt, lte, in, nin, is); id (string: eq, ne, neq, like, ilike, in, nin, is); name (string: eq, ne, neq, like, ilike, in, nin, is); row_count (number: eq, ne, neq, gt, gte, lt, lte, in, nin, is); slug (string: eq, ne, neq, like, ilike, in, nin, is). `like` is case-sensitive and `ilike` ignores ASCII case; `*` is the wildcard. `in`/`nin` take `(a,b)`; `is` takes `null` or `notnull`. At most 20 conditions, 3 nested groups, 100 in/nin values.
- `q` (string, optional): Free-text search over: name. Whitespace-separated terms must all match. Up to 200 characters.
- `limit` (integer, optional): Maximum number of items per page. Defaults to 20, capped by the endpoint's maxLimit. Defaults to `20`. Between 1 and 100.

### Returns

200 `application/json`.

- `count` (integer, required): At least 0.
- `hasMore` (boolean, required)
- `limit` (integer, required): At least 1.
- `nextCursor` (string, required, nullable)
- `page` (integer, required, nullable): At least 1.
- `tables` (array of objects, required)
  - `created_at` (integer, required): At least 0.
  - `deleted_at` (integer, required, nullable): At least 0.
  - `updated_at` (integer, required): At least 0.
  - `id` (string, required): 1 to 48 characters.
  - `project_id` (string, required): 1 to 48 characters.
  - `name` (string, required): 1 to 128 characters.
  - `slug` (string, required): 1 to 50 characters.
  - `columns_json` (array of objects, required): 1 to 100 items.
    - `currency_code` (string, optional): Exactly 3 characters.
    - `default` (any, optional)
    - `description` (string, optional, nullable): Up to 256 characters.
    - `id` (string, required): 1 to 36 characters.
    - `instruction` (string, optional, nullable): Up to 512 characters.
    - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
    - `options` (array of strings, optional): Up to 500 items.
    - `required` (boolean, required): Defaults to `false`.
    - `searchable` (boolean, optional)
    - `type` (string, required): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
  - `instruction` (string, required, nullable): Up to 512 characters.
  - `strictness` (string, required): One of `strict`, `balanced`, `flexible`.
  - `insert_mode` (string, required): One of `append`, `dedup`, `merge`, `replace`.
  - `merge_columns_json` (array of strings, required, nullable): At least 1 items.
  - `default_sort` (string, required, nullable)
  - `row_count` (integer, required): At least 0.
  - `usage_count` (integer, required): At least 0.
  - `data_version` (integer, required): At least 0.
  - `fts_version` (integer, required): At least 0.
  - `last_used_at` (integer, required, nullable): At least 0.

### Errors

- 404: `not_found`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

### Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.table.list({
  params: {
    project_id: "{project_id}"
  },
})
```

```bash title="cURL"
curl 'https://api.anyrow.ai/v1/projects/{project_id}/tables' \
  -H 'Authorization: ApiKey {your_api_key}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables", {
  headers: {
    Authorization: "ApiKey {your_api_key}",
  },
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.get(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
)
print(response.json())
```

### Response

```json title="200"
{
  "count": 0,
  "hasMore": true,
  "limit": 1,
  "nextCursor": "string",
  "page": 1,
  "tables": [
    {
      "created_at": 1711468800000,
      "deleted_at": 1711468800000,
      "updated_at": 1711468800000,
      "id": "tbl_01h5a3g8k9m2n4p6q8r0t2v4x6",
      "project_id": "string",
      "name": "string",
      "slug": "string",
      "columns_json": [
        {
          "currency_code": "string",
          "description": "string",
          "id": "string",
          "instruction": "string",
          "name": "string",
          "options": [
            "string"
          ],
          "required": false,
          "searchable": true,
          "type": "string"
        }
      ],
      "instruction": "string",
      "strictness": "strict",
      "insert_mode": "append",
      "merge_columns_json": [
        "string"
      ],
      "default_sort": "string",
      "row_count": 42,
      "usage_count": 42,
      "data_version": 42,
      "fts_version": 42,
      "last_used_at": 1711468800000
    }
  ]
}
```

## Create table

`POST /v1/projects/{project_id}/tables`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)

### Request body

Content type: `application/json` (required).

- `columns_json` (array of objects, required): 1 to 100 items.
  - `currency_code` (string, optional): Exactly 3 characters.
  - `default` (any, optional)
  - `description` (string, optional, nullable): Up to 256 characters.
  - `id` (string, required): 1 to 36 characters.
  - `instruction` (string, optional, nullable): Up to 512 characters.
  - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
  - `options` (array of strings, optional): Up to 500 items.
  - `required` (boolean, optional): Defaults to `false`.
  - `searchable` (boolean, optional)
  - `type` (string, optional): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
- `insert_mode` (string, optional): One of `append`, `dedup`, `merge`, `replace`.
- `instruction` (string, optional, nullable): Up to 512 characters.
- `merge_columns_json` (array of strings, optional, nullable): At least 1 items.
- `name` (string, required): 1 to 128 characters.
- `strictness` (string, optional): One of `strict`, `balanced`, `flexible`.

### Returns

201 `application/json`: created.

- `created_at` (integer, required): At least 0.
- `deleted_at` (integer, required, nullable): At least 0.
- `updated_at` (integer, required): At least 0.
- `id` (string, required): 1 to 48 characters.
- `project_id` (string, required): 1 to 48 characters.
- `name` (string, required): 1 to 128 characters.
- `slug` (string, required): 1 to 50 characters.
- `columns_json` (array of objects, required): 1 to 100 items.
  - `currency_code` (string, optional): Exactly 3 characters.
  - `default` (any, optional)
  - `description` (string, optional, nullable): Up to 256 characters.
  - `id` (string, required): 1 to 36 characters.
  - `instruction` (string, optional, nullable): Up to 512 characters.
  - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
  - `options` (array of strings, optional): Up to 500 items.
  - `required` (boolean, required): Defaults to `false`.
  - `searchable` (boolean, optional)
  - `type` (string, required): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
- `instruction` (string, required, nullable): Up to 512 characters.
- `strictness` (string, required): One of `strict`, `balanced`, `flexible`.
- `insert_mode` (string, required): One of `append`, `dedup`, `merge`, `replace`.
- `merge_columns_json` (array of strings, required, nullable): At least 1 items.
- `default_sort` (string, required, nullable)
- `row_count` (integer, required): At least 0.
- `usage_count` (integer, required): At least 0.
- `data_version` (integer, required): At least 0.
- `fts_version` (integer, required): At least 0.
- `last_used_at` (integer, required, nullable): At least 0.

### Errors

- 404: `not_found`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

### Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.table.create({
  params: {
    project_id: "{project_id}"
  },
  json: {
    columns_json: [
      {
        currency_code: "string",
        description: "string",
        id: "string",
        instruction: "string",
        name: "string",
        options: [
          "string"
        ],
        required: false,
        searchable: true,
        type: "string"
      }
    ],
    insert_mode: "append",
    instruction: "string",
    merge_columns_json: [
      "string"
    ],
    name: "string",
    strictness: "strict"
  },
})
```

```bash title="cURL"
curl -X POST 'https://api.anyrow.ai/v1/projects/{project_id}/tables' \
  -H 'Authorization: ApiKey {your_api_key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "columns_json": [
    {
      "currency_code": "string",
      "description": "string",
      "id": "string",
      "instruction": "string",
      "name": "string",
      "options": [
        "string"
      ],
      "required": false,
      "searchable": true,
      "type": "string"
    }
  ],
  "insert_mode": "append",
  "instruction": "string",
  "merge_columns_json": [
    "string"
  ],
  "name": "string",
  "strictness": "strict"
}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables", {
  method: "POST",
  headers: {
    Authorization: "ApiKey {your_api_key}",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "columns_json": [
      {
        "currency_code": "string",
        "description": "string",
        "id": "string",
        "instruction": "string",
        "name": "string",
        "options": [
          "string"
        ],
        "required": false,
        "searchable": true,
        "type": "string"
      }
    ],
    "insert_mode": "append",
    "instruction": "string",
    "merge_columns_json": [
      "string"
    ],
    "name": "string",
    "strictness": "strict"
  }),
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.post(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
    json={
        "columns_json": [
            {
                "currency_code": "string",
                "description": "string",
                "id": "string",
                "instruction": "string",
                "name": "string",
                "options": [
                    "string",
                ],
                "required": False,
                "searchable": True,
                "type": "string",
            },
        ],
        "insert_mode": "append",
        "instruction": "string",
        "merge_columns_json": [
            "string",
        ],
        "name": "string",
        "strictness": "strict",
    },
)
print(response.json())
```

### Response

```json title="201"
{
  "created_at": 1711468800000,
  "deleted_at": 1711468800000,
  "updated_at": 1711468800000,
  "id": "tbl_01h5a3g8k9m2n4p6q8r0t2v4x6",
  "project_id": "string",
  "name": "string",
  "slug": "string",
  "columns_json": [
    {
      "currency_code": "string",
      "description": "string",
      "id": "string",
      "instruction": "string",
      "name": "string",
      "options": [
        "string"
      ],
      "required": false,
      "searchable": true,
      "type": "string"
    }
  ],
  "instruction": "string",
  "strictness": "strict",
  "insert_mode": "append",
  "merge_columns_json": [
    "string"
  ],
  "default_sort": "string",
  "row_count": 42,
  "usage_count": 42,
  "data_version": 42,
  "fts_version": 42,
  "last_used_at": 1711468800000
}
```

## Get table

`GET /v1/projects/{project_id}/tables/{table_id}`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)
- `table_id` (string, required)

### Returns

200 `application/json`.

- `created_at` (integer, required): At least 0.
- `deleted_at` (integer, required, nullable): At least 0.
- `updated_at` (integer, required): At least 0.
- `id` (string, required): 1 to 48 characters.
- `project_id` (string, required): 1 to 48 characters.
- `name` (string, required): 1 to 128 characters.
- `slug` (string, required): 1 to 50 characters.
- `columns_json` (array of objects, required): 1 to 100 items.
  - `currency_code` (string, optional): Exactly 3 characters.
  - `default` (any, optional)
  - `description` (string, optional, nullable): Up to 256 characters.
  - `id` (string, required): 1 to 36 characters.
  - `instruction` (string, optional, nullable): Up to 512 characters.
  - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
  - `options` (array of strings, optional): Up to 500 items.
  - `required` (boolean, required): Defaults to `false`.
  - `searchable` (boolean, optional)
  - `type` (string, required): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
- `instruction` (string, required, nullable): Up to 512 characters.
- `strictness` (string, required): One of `strict`, `balanced`, `flexible`.
- `insert_mode` (string, required): One of `append`, `dedup`, `merge`, `replace`.
- `merge_columns_json` (array of strings, required, nullable): At least 1 items.
- `default_sort` (string, required, nullable)
- `row_count` (integer, required): At least 0.
- `usage_count` (integer, required): At least 0.
- `data_version` (integer, required): At least 0.
- `fts_version` (integer, required): At least 0.
- `last_used_at` (integer, required, nullable): At least 0.

### Errors

- 404: `not_found`, `table_not_found`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

### Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.table.get({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}"
  },
})
```

```bash title="cURL"
curl 'https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}' \
  -H 'Authorization: ApiKey {your_api_key}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}", {
  headers: {
    Authorization: "ApiKey {your_api_key}",
  },
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.get(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
)
print(response.json())
```

### Response

```json title="200"
{
  "created_at": 1711468800000,
  "deleted_at": 1711468800000,
  "updated_at": 1711468800000,
  "id": "tbl_01h5a3g8k9m2n4p6q8r0t2v4x6",
  "project_id": "string",
  "name": "string",
  "slug": "string",
  "columns_json": [
    {
      "currency_code": "string",
      "description": "string",
      "id": "string",
      "instruction": "string",
      "name": "string",
      "options": [
        "string"
      ],
      "required": false,
      "searchable": true,
      "type": "string"
    }
  ],
  "instruction": "string",
  "strictness": "strict",
  "insert_mode": "append",
  "merge_columns_json": [
    "string"
  ],
  "default_sort": "string",
  "row_count": 42,
  "usage_count": 42,
  "data_version": 42,
  "fts_version": 42,
  "last_used_at": 1711468800000
}
```

## Update table

`PATCH /v1/projects/{project_id}/tables/{table_id}`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)
- `table_id` (string, required)

### Request body

Content type: `application/json` (required).

- `default_sort` (string, optional, nullable): Up to 256 characters.
- `insert_mode` (string, optional): One of `append`, `dedup`, `merge`, `replace`.
- `instruction` (string, optional, nullable): Up to 512 characters.
- `merge_columns_json` (array of strings, optional, nullable): At least 1 items.
- `name` (string, optional): 1 to 128 characters.
- `slug` (string, optional): 1 to 50 characters.
- `strictness` (string, optional): One of `strict`, `balanced`, `flexible`.

### Returns

200 `application/json`.

- `created_at` (integer, required): At least 0.
- `deleted_at` (integer, required, nullable): At least 0.
- `updated_at` (integer, required): At least 0.
- `id` (string, required): 1 to 48 characters.
- `project_id` (string, required): 1 to 48 characters.
- `name` (string, required): 1 to 128 characters.
- `slug` (string, required): 1 to 50 characters.
- `columns_json` (array of objects, required): 1 to 100 items.
  - `currency_code` (string, optional): Exactly 3 characters.
  - `default` (any, optional)
  - `description` (string, optional, nullable): Up to 256 characters.
  - `id` (string, required): 1 to 36 characters.
  - `instruction` (string, optional, nullable): Up to 512 characters.
  - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
  - `options` (array of strings, optional): Up to 500 items.
  - `required` (boolean, required): Defaults to `false`.
  - `searchable` (boolean, optional)
  - `type` (string, required): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
- `instruction` (string, required, nullable): Up to 512 characters.
- `strictness` (string, required): One of `strict`, `balanced`, `flexible`.
- `insert_mode` (string, required): One of `append`, `dedup`, `merge`, `replace`.
- `merge_columns_json` (array of strings, required, nullable): At least 1 items.
- `default_sort` (string, required, nullable)
- `row_count` (integer, required): At least 0.
- `usage_count` (integer, required): At least 0.
- `data_version` (integer, required): At least 0.
- `fts_version` (integer, required): At least 0.
- `last_used_at` (integer, required, nullable): At least 0.

### Errors

- 404: `not_found`, `table_not_found`
- 409: `table_project_id_duplicate`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

### Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.table.update({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}"
  },
  json: {
    default_sort: "string",
    insert_mode: "append",
    instruction: "string",
    merge_columns_json: [
      "string"
    ],
    name: "string",
    slug: "string",
    strictness: "strict"
  },
})
```

```bash title="cURL"
curl -X PATCH 'https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}' \
  -H 'Authorization: ApiKey {your_api_key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "default_sort": "string",
  "insert_mode": "append",
  "instruction": "string",
  "merge_columns_json": [
    "string"
  ],
  "name": "string",
  "slug": "string",
  "strictness": "strict"
}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}", {
  method: "PATCH",
  headers: {
    Authorization: "ApiKey {your_api_key}",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "default_sort": "string",
    "insert_mode": "append",
    "instruction": "string",
    "merge_columns_json": [
      "string"
    ],
    "name": "string",
    "slug": "string",
    "strictness": "strict"
  }),
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.patch(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
    json={
        "default_sort": "string",
        "insert_mode": "append",
        "instruction": "string",
        "merge_columns_json": [
            "string",
        ],
        "name": "string",
        "slug": "string",
        "strictness": "strict",
    },
)
print(response.json())
```

### Response

```json title="200"
{
  "created_at": 1711468800000,
  "deleted_at": 1711468800000,
  "updated_at": 1711468800000,
  "id": "tbl_01h5a3g8k9m2n4p6q8r0t2v4x6",
  "project_id": "string",
  "name": "string",
  "slug": "string",
  "columns_json": [
    {
      "currency_code": "string",
      "description": "string",
      "id": "string",
      "instruction": "string",
      "name": "string",
      "options": [
        "string"
      ],
      "required": false,
      "searchable": true,
      "type": "string"
    }
  ],
  "instruction": "string",
  "strictness": "strict",
  "insert_mode": "append",
  "merge_columns_json": [
    "string"
  ],
  "default_sort": "string",
  "row_count": 42,
  "usage_count": 42,
  "data_version": 42,
  "fts_version": 42,
  "last_used_at": 1711468800000
}
```

## Delete table (soft, 72h grace)

`DELETE /v1/projects/{project_id}/tables/{table_id}`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)
- `table_id` (string, required)

### Returns

200 `application/json`.

- `id` (string, required)

### Errors

- 404: `not_found`, `table_not_found`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

### Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.table.delete({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}"
  },
})
```

```bash title="cURL"
curl -X DELETE 'https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}' \
  -H 'Authorization: ApiKey {your_api_key}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}", {
  method: "DELETE",
  headers: {
    Authorization: "ApiKey {your_api_key}",
  },
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.delete(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
)
print(response.json())
```

### Response

```json title="200"
{
  "id": "string"
}
```

## Duplicate table structure

`POST /v1/projects/{project_id}/tables/{table_id}/duplicate`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)
- `table_id` (string, required)

### Request body

Content type: `application/json` (required).

- `name` (string, required): 1 to 128 characters.
- `slug` (string, required): 1 to 50 characters.

### Returns

201 `application/json`: created.

- `created_at` (integer, required): At least 0.
- `deleted_at` (integer, required, nullable): At least 0.
- `updated_at` (integer, required): At least 0.
- `id` (string, required): 1 to 48 characters.
- `project_id` (string, required): 1 to 48 characters.
- `name` (string, required): 1 to 128 characters.
- `slug` (string, required): 1 to 50 characters.
- `columns_json` (array of objects, required): 1 to 100 items.
  - `currency_code` (string, optional): Exactly 3 characters.
  - `default` (any, optional)
  - `description` (string, optional, nullable): Up to 256 characters.
  - `id` (string, required): 1 to 36 characters.
  - `instruction` (string, optional, nullable): Up to 512 characters.
  - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
  - `options` (array of strings, optional): Up to 500 items.
  - `required` (boolean, required): Defaults to `false`.
  - `searchable` (boolean, optional)
  - `type` (string, required): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
- `instruction` (string, required, nullable): Up to 512 characters.
- `strictness` (string, required): One of `strict`, `balanced`, `flexible`.
- `insert_mode` (string, required): One of `append`, `dedup`, `merge`, `replace`.
- `merge_columns_json` (array of strings, required, nullable): At least 1 items.
- `default_sort` (string, required, nullable)
- `row_count` (integer, required): At least 0.
- `usage_count` (integer, required): At least 0.
- `data_version` (integer, required): At least 0.
- `fts_version` (integer, required): At least 0.
- `last_used_at` (integer, required, nullable): At least 0.

### Errors

- 404: `not_found`, `table_not_found`
- 409: `table_project_id_duplicate`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

### Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.table.duplicate({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}"
  },
  json: {
    name: "string",
    slug: "string"
  },
})
```

```bash title="cURL"
curl -X POST 'https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/duplicate' \
  -H 'Authorization: ApiKey {your_api_key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "slug": "string"
}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/duplicate", {
  method: "POST",
  headers: {
    Authorization: "ApiKey {your_api_key}",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "string",
    "slug": "string"
  }),
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.post(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/duplicate",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
    json={
        "name": "string",
        "slug": "string",
    },
)
print(response.json())
```

### Response

```json title="201"
{
  "created_at": 1711468800000,
  "deleted_at": 1711468800000,
  "updated_at": 1711468800000,
  "id": "tbl_01h5a3g8k9m2n4p6q8r0t2v4x6",
  "project_id": "string",
  "name": "string",
  "slug": "string",
  "columns_json": [
    {
      "currency_code": "string",
      "description": "string",
      "id": "string",
      "instruction": "string",
      "name": "string",
      "options": [
        "string"
      ],
      "required": false,
      "searchable": true,
      "type": "string"
    }
  ],
  "instruction": "string",
  "strictness": "strict",
  "insert_mode": "append",
  "merge_columns_json": [
    "string"
  ],
  "default_sort": "string",
  "row_count": 42,
  "usage_count": 42,
  "data_version": 42,
  "fts_version": 42,
  "last_used_at": 1711468800000
}
```

## Restore deleted table

`POST /v1/projects/{project_id}/tables/{table_id}/restore`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)
- `table_id` (string, required)

### Request body

Content type: `application/json` (required).

- `slug` (string, optional): 1 to 50 characters.

### Returns

200 `application/json`.

- `created_at` (integer, required): At least 0.
- `deleted_at` (integer, required, nullable): At least 0.
- `updated_at` (integer, required): At least 0.
- `id` (string, required): 1 to 48 characters.
- `project_id` (string, required): 1 to 48 characters.
- `name` (string, required): 1 to 128 characters.
- `slug` (string, required): 1 to 50 characters.
- `columns_json` (array of objects, required): 1 to 100 items.
  - `currency_code` (string, optional): Exactly 3 characters.
  - `default` (any, optional)
  - `description` (string, optional, nullable): Up to 256 characters.
  - `id` (string, required): 1 to 36 characters.
  - `instruction` (string, optional, nullable): Up to 512 characters.
  - `name` (string, required): 1 to 64 characters. Matches `^[\w\s.-]+$`.
  - `options` (array of strings, optional): Up to 500 items.
  - `required` (boolean, required): Defaults to `false`.
  - `searchable` (boolean, optional)
  - `type` (string, required): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.
- `instruction` (string, required, nullable): Up to 512 characters.
- `strictness` (string, required): One of `strict`, `balanced`, `flexible`.
- `insert_mode` (string, required): One of `append`, `dedup`, `merge`, `replace`.
- `merge_columns_json` (array of strings, required, nullable): At least 1 items.
- `default_sort` (string, required, nullable)
- `row_count` (integer, required): At least 0.
- `usage_count` (integer, required): At least 0.
- `data_version` (integer, required): At least 0.
- `fts_version` (integer, required): At least 0.
- `last_used_at` (integer, required, nullable): At least 0.

### Errors

- 404: `not_found`, `table_not_found`
- 409: `table_project_id_duplicate`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

### Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.table.restore({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}"
  },
  json: {
    slug: "string"
  },
})
```

```bash title="cURL"
curl -X POST 'https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/restore' \
  -H 'Authorization: ApiKey {your_api_key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "slug": "string"
}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/restore", {
  method: "POST",
  headers: {
    Authorization: "ApiKey {your_api_key}",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "slug": "string"
  }),
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.post(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/restore",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
    json={
        "slug": "string",
    },
)
print(response.json())
```

### Response

```json title="200"
{
  "created_at": 1711468800000,
  "deleted_at": 1711468800000,
  "updated_at": 1711468800000,
  "id": "tbl_01h5a3g8k9m2n4p6q8r0t2v4x6",
  "project_id": "string",
  "name": "string",
  "slug": "string",
  "columns_json": [
    {
      "currency_code": "string",
      "description": "string",
      "id": "string",
      "instruction": "string",
      "name": "string",
      "options": [
        "string"
      ],
      "required": false,
      "searchable": true,
      "type": "string"
    }
  ],
  "instruction": "string",
  "strictness": "strict",
  "insert_mode": "append",
  "merge_columns_json": [
    "string"
  ],
  "default_sort": "string",
  "row_count": 42,
  "usage_count": 42,
  "data_version": 42,
  "fts_version": 42,
  "last_used_at": 1711468800000
}
```
