---
title: Columns
url: https://anyrow.ai/docs/api/columns
canonical_url: https://anyrow.ai/docs/api/columns
---

# Columns

A table's columns: what to extract, with which type and instruction.

- [Add column](https://anyrow.ai/docs/api/columns/add.md): `POST /v1/projects/{project_id}/tables/{table_id}/columns`
- [Reorder columns](https://anyrow.ai/docs/api/columns/reorder.md): `PUT /v1/projects/{project_id}/tables/{table_id}/columns/order`
- [Update column](https://anyrow.ai/docs/api/columns/update.md): `PATCH /v1/projects/{project_id}/tables/{table_id}/columns/{col_id}`
- [Remove column](https://anyrow.ai/docs/api/columns/remove.md): `DELETE /v1/projects/{project_id}/tables/{table_id}/columns/{col_id}`
- [Get distinct column values](https://anyrow.ai/docs/api/columns/distinct.md): `GET /v1/projects/{project_id}/tables/{table_id}/columns/{col_id}/distinct`

## Add column

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

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

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

### Request body

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

- `currency_code` (string, optional): Exactly 3 characters.
- `description` (string, optional, nullable): Up to 256 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`.
- `type` (string, optional): One of `array`, `boolean`, `currency`, `date`, `email`, `enum`, `multi_select`, `number`, `string`, `text`, `url`. Defaults to `string`.

### 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: `optimistic_lock_conflict`

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.column.add({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}"
  },
  json: {
    currency_code: "string",
    description: "string",
    instruction: "string",
    name: "string",
    options: [
      "string"
    ],
    required: false,
    type: "string"
  },
})
```

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

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/columns", {
  method: "POST",
  headers: {
    Authorization: "ApiKey {your_api_key}",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "currency_code": "string",
    "description": "string",
    "instruction": "string",
    "name": "string",
    "options": [
      "string"
    ],
    "required": false,
    "type": "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}/columns",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
    json={
        "currency_code": "string",
        "description": "string",
        "instruction": "string",
        "name": "string",
        "options": [
            "string",
        ],
        "required": False,
        "type": "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
}
```

## Reorder columns

`PUT /v1/projects/{project_id}/tables/{table_id}/columns/order`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

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

### Request body

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

- `order` (array of strings, required): At least 1 items.

### 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: `column_not_found`, `not_found`, `table_not_found`
- 409: `optimistic_lock_conflict`

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.column.reorder({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}"
  },
  json: {
    order: [
      "string"
    ]
  },
})
```

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

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

```python title="Python"
import requests

response = requests.put(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/columns/order",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
    json={
        "order": [
            "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
}
```

## Update column

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

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

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

### Request body

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

- `description` (string, optional, nullable): Up to 256 characters.
- `instruction` (string, optional, nullable): Up to 512 characters.
- `name` (string, optional): 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`.

### 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: `column_not_found`, `not_found`, `table_not_found`
- 409: `optimistic_lock_conflict`

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.column.update({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}",
    col_id: "{col_id}"
  },
  json: {
    description: "string",
    instruction: "string",
    name: "string",
    options: [
      "string"
    ],
    required: false,
    searchable: true,
    type: "string"
  },
})
```

```bash title="cURL"
curl -X PATCH 'https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/columns/{col_id}' \
  -H 'Authorization: ApiKey {your_api_key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "description": "string",
  "instruction": "string",
  "name": "string",
  "options": [
    "string"
  ],
  "required": false,
  "searchable": true,
  "type": "string"
}'
```

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

```python title="Python"
import requests

response = requests.patch(
    "https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/columns/{col_id}",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
    json={
        "description": "string",
        "instruction": "string",
        "name": "string",
        "options": [
            "string",
        ],
        "required": False,
        "searchable": True,
        "type": "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
}
```

## Remove column

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

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

- `project_id` (string, required)
- `table_id` (string, required)
- `col_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: `column_not_found`, `not_found`, `table_not_found`
- 409: `optimistic_lock_conflict`

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.column.remove({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}",
    col_id: "{col_id}"
  },
})
```

```bash title="cURL"
curl -X DELETE 'https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/columns/{col_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}/columns/{col_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}/columns/{col_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
}
```

## Get distinct column values

`GET /v1/projects/{project_id}/tables/{table_id}/columns/{col_id}/distinct`

Authentication: `Authorization: ApiKey {your_api_key}`.

### Path parameters

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

### Query parameters

- `limit` (integer, optional): Defaults to `100`. Between 1 and 500.
- `q` (string, optional): Up to 200 characters.

### Returns

200 `application/json`.

- `values` (array of string | number, required)

### Errors

- 404: `column_not_found`, `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.column.distinct({
  params: {
    project_id: "{project_id}",
    table_id: "{table_id}",
    col_id: "{col_id}"
  },
})
```

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

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/projects/{project_id}/tables/{table_id}/columns/{col_id}/distinct", {
  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}/columns/{col_id}/distinct",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
)
print(response.json())
```

### Response

```json title="200"
{
  "values": [
    "string"
  ]
}
```
