Columns

Return the ordered list of columns for one table, with the underlying SQL type, a human-friendly display type, nullability, and whether the column participates in the primary key.

Request

GET /api/tables/{table}/columns
ParameterInTypeNotes
tablepathstringThe real table name from GET /api/tables. Must be in the allow-list and must exist in the public schema.

There are no query parameters and no request body.

Response

200 OK. A JSON object with a single columns array, ordered by the column's position in the table (information_schema.columns.ordinal_position).

FieldTypeNotes
columns[].namestringThe real column name. Use this for sort_column and filter.* parameters on the rows endpoint.
columns[].display_namestringThe name shown in the UI. Either the override from [display.columns] in config.toml, or the column name rewritten from snake_case to Title Case.
columns[].data_typestringThe raw SQL type from information_schema — e.g. integer, character varying, timestamp with time zone, boolean, uuid, jsonb.
columns[].display_typestringA friendly label derived from data_type: one of Text, Number, Decimal, Yes/No, Date, Date & Time, Time, Duration, JSON, UUID, Network, Currency, Binary, List. Unknown types fall through unchanged.
columns[].is_nullablebooleantrue when the column is declared NULL-able. Drives the hatched NULL rendering in the grid.
columns[].is_primary_keybooleantrue when the column participates in the table's primary key.

Example

curl http://127.0.0.1:3141/api/tables/vehicles_log/columns
{
  "columns": [
    {
      "name": "id",
      "display_name": "Id",
      "data_type": "bigint",
      "display_type": "Number",
      "is_nullable": false,
      "is_primary_key": true
    },
    {
      "name": "vehicle_id",
      "display_name": "Vehicle",
      "data_type": "character varying",
      "display_type": "Text",
      "is_nullable": false,
      "is_primary_key": false
    },
    {
      "name": "posn_lat",
      "display_name": "Latitude",
      "data_type": "double precision",
      "display_type": "Decimal",
      "is_nullable": true,
      "is_primary_key": false
    },
    {
      "name": "recorded_at",
      "display_name": "Recorded At",
      "data_type": "timestamp with time zone",
      "display_type": "Date & Time",
      "is_nullable": false,
      "is_primary_key": false
    }
  ]
}

Errors

StatusWhen
404The table is not in the allow-list, or does not exist in the public schema. Body: {"error": "Table 'X' not found"}.
503The server is still in setup mode.
500The underlying query failed. See the server log for detail.

Related