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
| Parameter | In | Type | Notes |
|---|---|---|---|
table | path | string | The 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).
| Field | Type | Notes |
|---|---|---|
columns[].name | string | The real column name. Use this for sort_column and filter.* parameters on the rows endpoint. |
columns[].display_name | string | The 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_type | string | The raw SQL type from information_schema — e.g. integer, character varying, timestamp with time zone, boolean, uuid, jsonb. |
columns[].display_type | string | A 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_nullable | boolean | true when the column is declared NULL-able. Drives the hatched NULL rendering in the grid. |
columns[].is_primary_key | boolean | true 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
| Status | When |
|---|---|
404 | The table is not in the allow-list, or does not exist in the public schema. Body: {"error": "Table 'X' not found"}. |
503 | The server is still in setup mode. |
500 | The underlying query failed. See the server log for detail. |
Related
- GET /api/tables — discover table names.
- GET /api/tables/{table}/rows — the column names here are exactly the names accepted by
sort_columnandfilter.*.