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

# Add Column

> Add a column to an existing custom table

Adds one column to a custom table.

> [!WARNING]
>
> **Service key required.**

## Path Parameters

**tableName** `string` *required*

Logical name of the table — pass `orders`, not `custom_orders`.

## Body Parameters

**columnName** `string` *required*

Matches `^[a-zA-Z_][a-zA-Z0-9_]{0,62}$`. Cannot be one of the managed column names (`id`, `createdAt`, `updatedAt`, `deletedAt`).

**dataType** `string` *required*

One of `text`, `integer`, `float`, `boolean`, `timestamp`, `json`, `decimal`, `date`, `uuid`.

**nullable** `boolean` *required*

Whether the column accepts `NULL`. Adding a non-nullable column to a table that already holds rows needs a `defaultValue`, or the existing rows have nothing to put in it.

**defaultValue** `string | null`

Optional default, as a string.

```json theme={null}
{
  "columnName": "priority",
  "dataType": "integer",
  "nullable": false,
  "defaultValue": "0"
}
```

## Response

Returns `201 Created`.

**added** `string`

The name of the column that was added.

## Error Responses

> [accordion] Invalid Body — 400
>
> ```json theme={null}
> { "error": "Bad Request", "code": "database/invalid-body" }
> ```

> [accordion] Reserved Column — 400
>
> The name is one of the managed columns.
>
> ```json theme={null}
> { "error": "Bad Request", "code": "database/reserved-column" }
> ```

> [accordion] Invalid Default Value — 400
>
> ```json theme={null}
> { "error": "Bad Request", "code": "database/invalid-default-value" }
> ```

> [accordion] Elevated Auth Required — 403
>
> ```json theme={null}
> {
>   "error": "Service key required.",
>   "code": "auth/elevated-auth-required"
> }
> ```

> [accordion] Table Not Found — 404
>
> ```json theme={null}
> { "error": "Not Found", "code": "database/table-not-found" }
> ```

> [accordion] Column Conflict — 409
>
> A column with that name already exists on the table.
>
> ```json theme={null}
> { "error": "Conflict", "code": "database/column-conflict" }
> ```

> [accordion] Column Limit Reached — 409
>
> A table may hold at most 100 columns.
>
> ```json theme={null}
> { "error": "Conflict", "code": "database/column-limit-reached" }
> ```

> [accordion] Server Error — 500
>
> ```json theme={null}
> { "error": "Internal Server Error", "code": "database/server-error" }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.