Limai Docs
API ReferenceTables & Rows

Columns

List, create, get, update, and delete columns

List Columns

GET/api/v1/tables/{tableId}/columns

Returns all columns for a table, ordered by index.

Parameters

NameTypeInRequiredDescription
tableIdstringpathYesThe 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

Response200
{
  "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

POST/api/v1/tables/{tableId}/columns

Creates one or more columns in a table. Supports both single column and bulk creation (wrap in a columns array).

Parameters

NameTypeInRequiredDescription
tableIdstringpathYesThe table ID
namestringbodyYesColumn name
slugstringbodyNoStable identifier matching ^[a-z][a-z0-9_]{0,63}$, unique within the table. Auto-generated from the name when omitted.
typestringbodyNoColumn type: TEXT, NUMBER, DATE, BOOLEAN, LABEL, MEASUREMENT(default: TEXT)
descriptionstringbodyNoColumn description for the model
isKeybooleanbodyNoWhether this is a key column(default: false)
isListbooleanbodyNoWhether this column accepts list values(default: false)
labelsarraybodyNoArray of {name, color} for LABEL columns. Label names are stored uppercase
autoGenerateLabelsbooleanbodyNoLet extraction create labels that are not in the list(default: false)
unitsarraybodyNoArray of {name} for NUMBER_WITH_UNIT columns
autoGenerateUnitsbooleanbodyNoLet 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

Response201
{
  "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

GET/api/v1/columns/{columnId}

Returns details of a specific column.

Parameters

NameTypeInRequiredDescription
columnIdstringpathYesThe 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

Response200
{
  "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

PATCH/api/v1/columns/{columnId}

Update a column's properties.

Parameters

NameTypeInRequiredDescription
columnIdstringpathYesThe column ID
namestringbodyNoNew column name
descriptionstringbodyNoNew description
typestringbodyNoNew column type
isListbooleanbodyNoWhether this column accepts list values
dateFormatstringbodyNoDate format: EU or US
excludedFromExtractionbooleanbodyNoWhether to exclude from extraction
unitsarraybodyNoArray of {name}; replaces the stored unit list
autoGenerateUnitsbooleanbodyNoLet 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

Response200
{
  "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

DELETE/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

NameTypeInRequiredDescription
columnIdstringpathYesThe 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

Response200
{
  "success": true
}
StatusMeaning
200The column is retired
401Missing or invalid API token
403The token's role lacks EDIT_MODELS, or the token cannot reach the column's project
404No column with this ID exists

Purge Column

POST/api/v1/columns/{columnId}/purge

Permanently 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:

  1. Send the purge of the retired column with no body. If no retained version describes the column, it is purged and you get 200.
  2. If retained versions describe it, nothing is purged and you get 409 with status: "NEEDS_CONFIRMATION" and the versions in invalidates.
  3. Re-send the purge with invalidateVersionIds set to exactly the ids from invalidates. If the set still matches, the column is purged, the versions are invalidated, and they come back in invalidatedVersions. If the retained versions changed in between, you get a fresh NEEDS_CONFIRMATION and 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

NameTypeInRequiredDescription
columnIdstringpathYesThe column ID
invalidateVersionIdsstring[]bodyNoConfirms 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

Response200
{
  "status": "PURGED",
  "invalidatedVersions": [
    {
      "id": "ver_003",
      "number": 3,
      "label": "March release"
    }
  ]
}
Response409
{
  "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."
}
Response409
{
  "error": "Column must be deleted (retired) before it can be purged",
  "code": "COLUMN_NOT_RETIRED"
}
Response409
{
  "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, ..."
}
StatusMeaning
200PURGED: the column and its values are gone; invalidatedVersions lists any schema versions invalidated
400Invalid JSON, or a body that is not { "invalidateVersionIds"?: string[] }
401Missing or invalid API token
403The token's role lacks EDIT_MODELS or EDIT_DEPLOYMENTS, or the token cannot reach the column's project
404No column with this ID exists
409COLUMN_NOT_RETIRED (delete the column first), NEEDS_CONFIRMATION (re-send with invalidateVersionIds) or BLOCKED_BY_PINNED_DEPLOYMENTS (unpin first); nothing was purged

On this page