Columns
List, create, get, update, and delete columns
List Columns
/api/v1/tables/{tableId}/columnsReturns all columns for a table, ordered by index.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
tableId | string | path | Yes | The table ID |
Request
const res = await fetch(
"https://app.limai.io/api/v1/tables/tbl_abc123/columns",
{
headers: {
Authorization: "Bearer YOUR_API_TOKEN",
},
}
);
const { data } = await res.json();Response
{
"data": [
{
"id": "col_001",
"name": "Invoice Number",
"slug": "invoice_number",
"type": "TEXT",
"description": null,
"isKey": true,
"isList": false,
"dateFormat": "EU",
"measurementType": "LEVENSHTEIN",
"excludedFromExtraction": false,
"defaultValue": null,
"defaultValueEnabled": false,
"autoGenerateLabels": false,
"autoGenerateUnits": false,
"index": 0,
"labels": [],
"units": []
}
]
}Create Column
/api/v1/tables/{tableId}/columnsCreates one or more columns in a table. Supports both single column and bulk creation (wrap in a columns array).
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
tableId | string | path | Yes | The table ID |
name | string | body | Yes | Column name |
slug | string | body | No | Stable identifier matching ^[a-z][a-z0-9_]{0,63}$, unique within the table. Auto-generated from the name when omitted. |
type | string | body | No | Column type: TEXT, NUMBER, DATE, BOOLEAN, LABEL, MEASUREMENT(default: TEXT) |
description | string | body | No | Column description for the model |
isKey | boolean | body | No | Whether this is a key column(default: false) |
isList | boolean | body | No | Whether this column accepts list values(default: false) |
labels | array | body | No | Array of {name, color} for LABEL columns. Label names are stored uppercase |
autoGenerateLabels | boolean | body | No | Let extraction create labels that are not in the list(default: false) |
units | array | body | No | Array of {name} for NUMBER_WITH_UNIT columns |
autoGenerateUnits | boolean | body | No | Let extraction pick units from the document instead of a fixed list(default: false) |
Label names and LABEL cell values are normalized to uppercase on every write, so a labels entry sent as Active is stored, returned and matched at extraction time as ACTIVE.
A NUMBER_WITH_UNIT column must have at least one unit unless autoGenerateUnits is true. A request that would leave it with neither is rejected with 400 NUMBER_WITH_UNIT columns need at least one unit or autoGenerateUnits enabled; otherwise the extraction prompt would restrict the model to an empty list of units and every cell would come back without one.
Request
const res = await fetch(
"https://app.limai.io/api/v1/tables/tbl_abc123/columns",
{
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Total Amount",
type: "NUMBER",
description: "The total invoice amount including tax",
}),
}
);Response
{
"id": "col_new",
"name": "Total Amount",
"slug": "total_amount",
"type": "NUMBER",
"description": "Total invoice amount including tax",
"isKey": false,
"isList": false,
"dateFormat": "EU",
"measurementType": "LEVENSHTEIN",
"excludedFromExtraction": false,
"index": 3,
"labels": [],
"units": [],
"createdAt": "2025-01-15T10:30:00.000Z"
}Get Column
/api/v1/columns/{columnId}Returns details of a specific column.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
columnId | string | path | Yes | The column ID |
Request
const res = await fetch(
"https://app.limai.io/api/v1/columns/col_abc123",
{
headers: {
Authorization: "Bearer YOUR_API_TOKEN",
},
}
);
const column = await res.json();Response
{
"id": "col_abc123",
"name": "Invoice Number",
"type": "TEXT",
"description": null,
"isList": false,
"dateFormat": "EU",
"tableId": "tbl_001",
"excludedFromExtraction": false,
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-15T00:00:00.000Z"
}Update Column
/api/v1/columns/{columnId}Update a column's properties.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
columnId | string | path | Yes | The column ID |
name | string | body | No | New column name |
description | string | body | No | New description |
type | string | body | No | New column type |
isList | boolean | body | No | Whether this column accepts list values |
dateFormat | string | body | No | Date format: EU or US |
excludedFromExtraction | boolean | body | No | Whether to exclude from extraction |
units | array | body | No | Array of {name}; replaces the stored unit list |
autoGenerateUnits | boolean | body | No | Let extraction pick units from the document instead of a fixed list |
The unit rule applies to the merged result: switching type to NUMBER_WITH_UNIT, sending units: [], or setting autoGenerateUnits: false is rejected with a 400 when the column would end up with no units and auto-generation off.
Request
const res = await fetch(
"https://app.limai.io/api/v1/columns/col_abc123",
{
method: "PATCH",
headers: {
Authorization: "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
description: "Unique invoice identifier",
}),
}
);Response
{
"id": "col_abc123",
"name": "Invoice Number",
"description": "Unique invoice identifier",
"type": "TEXT",
"isList": false,
"dateFormat": "EU",
"excludedFromExtraction": false,
"updatedAt": "2025-01-15T12:00:00.000Z"
}Delete Column
/api/v1/columns/{columnId}Retires a column, exactly as deleting it from the table in the app does. The column disappears from the table, from the schema, and from future extractions, but the values already extracted into it are kept rather than erased. Deleting a column that is already retired succeeds again without changing anything.
Retiring is not permanent deletion: the column's extracted values stay in the database and in exports. To remove the column and every value extracted for it for good, retire it first and then purge it.
The token's role needs the EDIT_MODELS permission (OWNER or DEVELOPER), and the token must be able to reach the column's project.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
columnId | string | path | Yes | The column ID |
Request
const res = await fetch(
"https://app.limai.io/api/v1/columns/col_abc123",
{
method: "DELETE",
headers: {
Authorization: "Bearer YOUR_API_TOKEN",
},
}
);Response
{
"success": true
}| Status | Meaning |
|---|---|
200 | The column is retired |
401 | Missing or invalid API token |
403 | The token's role lacks EDIT_MODELS, or the token cannot reach the column's project |
404 | No column with this ID exists |
Purge Column
/api/v1/columns/{columnId}/purgePermanently deletes a column together with every value ever extracted for it, in every document, reviewed ones included, exactly as purging a retired column in the app does. There is no undo. Delete Column only retires a column and keeps its data; use purge when the data itself has to go. As in the app, a column must be deleted (retired) before it can be purged: purging a column that is still active is refused with 409 and code: "COLUMN_NOT_RETIRED", and nothing is written. Call Delete Column first, then purge.
Purging needs more than deleting: the token's role must have both EDIT_MODELS and EDIT_DEPLOYMENTS, which today means OWNER, and the token must be able to reach the column's project.
Retained schema versions and the confirmation step
A released schema version keeps describing the columns it was released with. Purging a column that a retained schema version still describes invalidates that version: it can no longer be released, and a deployment serving it would fail to extract. The API therefore never invalidates a version you have not named:
- Send the purge of the retired column with no body. If no retained version describes the column, it is purged and you get
200. - If retained versions describe it, nothing is purged and you get
409withstatus: "NEEDS_CONFIRMATION"and the versions ininvalidates. - Re-send the purge with
invalidateVersionIdsset to exactly theids frominvalidates. If the set still matches, the column is purged, the versions are invalidated, and they come back ininvalidatedVersions. If the retained versions changed in between, you get a freshNEEDS_CONFIRMATIONand nothing is written.
If a deployment is pinned to one of those versions, purge is refused outright with 409 and status: "BLOCKED_BY_PINNED_DEPLOYMENTS". Unpin those deployments first, by releasing another schema into them or switching them to follow the model, then retry.
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
columnId | string | path | Yes | The column ID |
invalidateVersionIds | string[] | body | No | Confirms the purge may invalidate these retained schema versions. Must be exactly the ids returned in invalidates by a NEEDS_CONFIRMATION response. Omit the body when no confirmation is needed. |
Request
const url = "https://app.limai.io/api/v1/columns/col_abc123/purge";
const headers = {
Authorization: "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
};
let res = await fetch(url, { method: "POST", headers });
let body = await res.json();
if (body.status === "NEEDS_CONFIRMATION") {
res = await fetch(url, {
method: "POST",
headers,
body: JSON.stringify({
invalidateVersionIds: body.invalidates.map((version) => version.id),
}),
});
body = await res.json();
}Response
{
"status": "PURGED",
"invalidatedVersions": [
{
"id": "ver_003",
"number": 3,
"label": "March release"
}
]
}{
"status": "NEEDS_CONFIRMATION",
"invalidates": [
{
"id": "ver_003",
"number": 3,
"label": "March release"
}
],
"error": "Purging this column invalidates the retained schema versions listed in invalidates: ... Re-send the request with invalidateVersionIds set to exactly these ids to confirm."
}{
"error": "Column must be deleted (retired) before it can be purged",
"code": "COLUMN_NOT_RETIRED"
}{
"status": "BLOCKED_BY_PINNED_DEPLOYMENTS",
"blocking": [
{
"version": {
"id": "ver_003",
"number": 3,
"label": "March release"
},
"deployments": [
{
"id": "dpl_prod01",
"name": "Production"
}
]
}
],
"error": "Purge refused: deployments listed in blocking are pinned to schema versions that describe this column. Unpin them first, ..."
}| Status | Meaning |
|---|---|
200 | PURGED: the column and its values are gone; invalidatedVersions lists any schema versions invalidated |
400 | Invalid JSON, or a body that is not { "invalidateVersionIds"?: string[] } |
401 | Missing or invalid API token |
403 | The token's role lacks EDIT_MODELS or EDIT_DEPLOYMENTS, or the token cannot reach the column's project |
404 | No column with this ID exists |
409 | COLUMN_NOT_RETIRED (delete the column first), NEEDS_CONFIRMATION (re-send with invalidateVersionIds) or BLOCKED_BY_PINNED_DEPLOYMENTS (unpin first); nothing was purged |