Download OpenAPI specification:
OpenAPI spec for the KDB-X Database Service.
Creates a table from the provided schema definition.
| table required | string Table name |
| type required | string Enum: "partitioned" "splayed" "splayed_mem" "basic" |
| prtnCol required | string Partition column to use for partitioned tables. The column chosen is your primary time filter: it is used by a query's
|
required | Array of objects (TableColumnSpec) |
| primaryKeys | Array of strings Names of columns to use as primary keys for this table. Primary keys identify unique rows. When provided, the table is keyed by these columns, and rows with matching keys update existing records. |
| blockSize | integer Default: 10000 Block size for partitioned storage writes. |
| sortColsMem | Array of strings A list of columns to use for sorting columns in a memory tier. Setting this value will sort data as it arrives in memory. |
| sortColsOrd | Array of strings A list of columns to use for sorting columns in an ordinal partitioned tier. Setting this value will sort data as it migrates into ordinal partitions. |
| sortColsDisk | Array of strings A list of columns to use for sorting columns in a normal disk tier. Settings this value will sort data as it is migrated into disk partitions. |
| description | string |
{- "type": "partitioned",
- "prtnCol": "realTime",
- "columns": [
- {
- "name": "time",
- "type": "timespan"
}, - {
- "name": "sym",
- "type": "symbol",
- "attrMem": "grouped",
- "attrDisk": "parted",
- "attrOrd": "parted"
}, - {
- "name": "realTime",
- "type": "timestamp"
}, - {
- "name": "bid",
- "type": "float"
}, - {
- "name": "ask",
- "type": "float"
}, - {
- "name": "bidSize",
- "type": "long"
}, - {
- "name": "askSize",
- "type": "long"
}
], - "blockSize": 10000,
- "sortColsOrd": [
- "sym"
], - "sortColsDisk": [
- "sym"
], - "description": "Quote data"
}{- "name": "d9726870-1c5c-0d13-4b90-be5fbcb2ad2f",
- "pipeline": "",
- "database": "db",
- "updtype": "schemaChange",
- "status": "completed",
- "details": [ ],
- "tbls": [ ],
- "dates": [ ],
- "progress": {
- "cmdCurrent": "",
- "cmdIndex": 0,
- "cmdTotal": 0,
- "subCurrent": "",
- "subIndex": 0,
- "subTotal": 0
}, - "error": "",
- "warnings": [ ],
- "updated": "2026-03-30T13:37:44.365774085"
}Returns the table definition (schema/columns) and associated metadata for a given table.
| table required | string Table name |
session.describe_table(table="quote")
{- "description": "Quote data",
- "type": "partitioned",
- "blockSize": 10000,
- "prtnCol": "realTime",
- "sortColsOrd": [
- "sym"
], - "sortColsDisk": [
- "sym"
], - "columns": [
- {
- "name": "time",
- "type": "timespan"
}, - {
- "name": "sym",
- "type": "symbol",
- "attrMem": "grouped",
- "attrDisk": "parted",
- "attrOrd": "parted"
}, - {
- "name": "realTime",
- "type": "timestamp"
}, - {
- "name": "bid",
- "type": "float"
}, - {
- "name": "ask",
- "type": "float"
}, - {
- "name": "bidSize",
- "type": "long"
}, - {
- "name": "askSize",
- "type": "long"
}
], - "name": "quote"
}Drops a table and its associated data.
| table required | string Table name |
session.drop_table(table="quote")
{- "name": "c4ceac2c-664a-ce9c-aa5c-b1498f850d22",
- "pipeline": "",
- "database": "db",
- "updtype": "schemaChange",
- "status": "completed",
- "details": [ ],
- "tbls": [ ],
- "dates": [ ],
- "progress": {
- "cmdCurrent": "",
- "cmdIndex": 0,
- "cmdTotal": 0,
- "subCurrent": "",
- "subIndex": 0,
- "subTotal": 0
}, - "error": "",
- "warnings": [ ],
- "updated": "2026-03-31T05:36:22.900404270"
}Returns the current status of a batch ingest job.
| jobId required | string Batch ingest job identifier. |
session.get_import(job_id="3fa85f64-5717-4562-b3fc-2c963f66afa6")
{- "name": "26adfb1d-29bc-fab9-5e32-73f80ea51300",
- "pipeline": "",
- "database": "db",
- "updtype": "ingest",
- "status": "completed",
- "details": {
- "workerHandle": 34,
- "preprocessDone": "2026-03-22T13:25:44.177025580",
- "subsessions": [
- ""
], - "dates": [
- "2026-02-03"
], - "tables": [
- "forex"
]
}, - "tbls": [
- "forex"
], - "dates": [
- "2026-02-03"
], - "progress": {
- "cmdCurrent": "",
- "cmdIndex": 1,
- "cmdTotal": 1,
- "subCurrent": "",
- "subIndex": 0,
- "subTotal": 0
}, - "error": "",
- "warnings": [ ],
- "updated": "2026-03-22T13:25:44.312559923"
}Attempts to cancel a running batch ingest job.
| jobId required | string Batch ingest job identifier. |
session.cancel_import(job_id="3fa85f64-5717-4562-b3fc-2c963f66afa6")
{- "name": "26adfb1d-29bc-fab9-5e32-73f80ea51300",
- "pipeline": "",
- "database": "db",
- "updtype": "ingest",
- "status": "completed",
- "details": {
- "workerHandle": 34,
- "preprocessDone": "2026-03-22T13:25:44.177025580",
- "subsessions": [
- ""
], - "dates": [
- "2026-02-03"
], - "tables": [
- "forex"
]
}, - "tbls": [
- "forex"
], - "dates": [
- "2026-02-03"
], - "progress": {
- "cmdCurrent": "",
- "cmdIndex": 1,
- "cmdTotal": 1,
- "subCurrent": "",
- "subIndex": 0,
- "subTotal": 0
}, - "error": "",
- "warnings": [ ],
- "updated": "2026-03-22T13:25:44.312559923"
}Submit a batch ingest job for a table using files on the server.
For CSV ingest, processing order is types (initial parse), then postparse (transform/derive), then include (final output column selection).
Returns a pending job response; ingestion continues after the response. Final success/failure is available via GET /api/v0/imports/{jobId}.
| table required | string Target table name. |
| path required | string Path to input data on the server filesystem. Accepted forms:
Glob semantics:
The service ingests all matched files. Example values:
|
| format | string Enum: "qbinary" "csv" "parquet" Input data format. If omitted, the service may auto-detect it from the file(s). |
| mode | string Default: "merge" Enum: "overwrite" "merge" Optional ingest mode. If omitted, the service uses |
| delimiter | string Default: "," Delimiter character for delimited text. Ignored for parquet and qbinary. |
| decimal | string Default: "." Decimal separator character for delimited text. Ignored for parquet and qbinary. |
| createTable | boolean Default: false If true and the table does not exist, create it prior to ingest. |
| header | Array of strings If the file has headers, this is optional. If provided, it overrides header names by position. If the file has no headers and either postparse is used or the file has unused columns, this is required (names by position). If createTable=true and the table doesn’t exist, these headers are used as the new table’s column names. |
| include | Array of strings Optional list of column names to ingest (and their order). Only these columns are kept. Applied after both headers are resolved & postparse is applied. |
| types | string Optional type string in CSV parse format (uppercase), e.g. F=float, J=long, P=timestamp, S=symbol, *=string. See https://code.kx.com/q/ref/tok/ for full details. |
object A dictionary of data transforms, made up of column names as keys and q expression strings as values. Existing columns can be modified, and new ones created. Columns from the file are available for use in the expression via a For example: {'timestamp': 'data[`date]+data[`time]'}. Runs after loading and parsing (including typecasting) of data in the file is done. Note that columns used as inputs in the transform are by default not included after use, therefore must be re-added if they are required. For example, to preserve the date column in the above, the | |
| headerRowIndex | integer Default: 0 Header row index (0-based). Use -1 when there is no header row. |
{- "table": "quote",
- "path": "quote.csv"
}{- "name": "26adfb1d-29bc-fab9-5e32-73f80ea51300",
- "pipeline": "",
- "database": "db",
- "updtype": "ingest",
- "status": "pending",
- "details": {
- "workerHandle": 34
}, - "tbls": [ ],
- "dates": [ ],
- "progress": {
- "cmdCurrent": "",
- "cmdIndex": 0,
- "cmdTotal": 0,
- "subCurrent": "",
- "subIndex": 0,
- "subTotal": 0
}, - "error": "",
- "warnings": [ ],
- "updated": "2026-03-22T13:25:44.177025580"
}Submit a batch ingest job for a kdb-native data location readable by the service. The provided path may reference a partitioned HDB directory and may also support other kdb-native layouts such as splayed tables or basic/q-binary tables. The service returns a job ID and continues ingestion asynchronously after the response.
| path required | string Path to a kdb-native data location readable by the service, such as a partitioned HDB directory, a parent directory containing one or more splayed tables, or a parent directory containing basic/q-binary tables. Path is resolved relative to the configured import root. |
| mode | string Default: "merge" Enum: "overwrite" "merge" Optional ingest mode. If omitted, the service uses |
| createTable | boolean Default: false If true and the target table does not exist, create it before ingest. |
{- "path": "/path/to/hdb",
- "mode": "merge",
- "createTable": false
}{- "name": "26adfb1d-29bc-fab9-5e32-73f80ea51300",
- "pipeline": "",
- "database": "db",
- "updtype": "ingest",
- "status": "pending",
- "details": {
- "workerHandle": 34
}, - "tbls": [ ],
- "dates": [ ],
- "progress": {
- "cmdCurrent": "",
- "cmdIndex": 0,
- "cmdTotal": 0,
- "subCurrent": "",
- "subIndex": 0,
- "subTotal": 0
}, - "error": "",
- "warnings": [ ],
- "updated": "2026-03-22T13:25:44.177025580"
}Insert data provided inline in the request body. Supports either a row-matrix (array of rows) or a list of JSON dictionaries (one object per row). Returns a pending job response; final success/failure is available via GET /api/v0/imports/{jobId}.
| table required | string Target table name. |
required | Array of any or Array of objects |
| createTable | boolean Default: false |
| mode | string Default: "merge" Enum: "overwrite" "merge" Optional ingest mode. If omitted, the service uses |
| columnNames | Array of strings |
| types | string Optional type string (case-sensitive), e.g. f=float, j=long, p=timestamp, s=symbol, C=string, *=generic list. See https://code.kx.com/q/ref/cast/ for full details. |
{- "table": "quote",
- "mode": "merge",
- "data": [
- [
- "2026-01-21T10:00:00.000",
- "AAPL",
- 101.1,
- 101.2
], - [
- "2026-01-21T10:00:01.000",
- "AAPL",
- 101.2,
- 101.3
]
]
}{- "name": "26adfb1d-29bc-fab9-5e32-73f80ea51300",
- "pipeline": "",
- "database": "db",
- "updtype": "ingest",
- "status": "pending",
- "details": {
- "workerHandle": 34
}, - "tbls": [ ],
- "dates": [ ],
- "progress": {
- "cmdCurrent": "",
- "cmdIndex": 0,
- "cmdTotal": 0,
- "subCurrent": "",
- "subIndex": 0,
- "subTotal": 0
}, - "error": "",
- "warnings": [ ],
- "updated": "2026-03-22T13:25:44.177025580"
}Structured query using explicit parameters (table, time range, filters, aggregations) rather than a free-form query string.
| table required | string Table name |
| startTS | string Inclusive start of timestamp range |
| endTS | string Exclusive end of timestamp range |
| inputTZ | string Timezones should be supplied in tz database format, for example |
| outputTZ | string Timezones should be supplied in tz database format, for example |
| outputTZCols | Array of strings[ items ] Columns that should be converted to 'outputTZ' |
Array of strings or Array of arrays The
It is also possible to nest filters with the logical operators
Supported filter operators are | |
| groupBy | Array of strings A list of column names to group by |
| agg | Array of strings[ items ]
Available aggregation functions are: all, any, avg, cor, count, cov, dev, distinct, first, last, max, min, prd, scov, sdev, sum, svar, var, wavg, wsum. Note: distinct always returns a list. |
| fill | string
|
| temporality | string Temporality controls how the query interprets the time range between Supported values are:
|
| sortCols | Array of strings Columns to be sorted, post query execution |
| limit | Array of integers Limit of rows to return |
{- "table": "quote",
- "startTS": "2024.11.02T00:00:00.000",
- "endTS": "2024.11.03T00:00:00.000",
- "inputTZ": "UTC",
- "outputTZ": "UTC",
- "outputTZCols": [
- [
- "createTS",
- "updateTS"
]
], - "filter": [
- [
- "or",
- [
- "=",
- "sym",
- "DNDF.CAN"
], - [
- ">",
- "price",
- "300.50"
]
]
], - "groupBy": [
- "sym"
], - "agg": [
- [
- "minPx",
- "min",
- "price"
]
], - "fill": "zero",
- "temporality": "slice",
- "sortCols": [
- "sym",
- "desc"
], - "limit": [
- 3
]
}{- "header": {
- "corr": "f98f13f8-621b-4721-b242-3afb94077441",
- "logCorr": "f98f13f8-621b-4721-b242-3afb94077441",
- "rcvTS": "2026-01-22T07:36:33.459000000",
- "http": "json",
- "api": "simple",
- "agg": ":192.168.240.7:5060",
- "refVintage": -9223372036854776000,
- "rc": 0,
- "ac": 0,
- "ai": "",
- "limitApplied": false
}, - "payload": [
- {
- "time": "0D07:33:41.240573052",
- "sym": "X",
- "realTime": "2026-01-24T07:33:41.240473052",
- "ask": 2.975187,
- "asize": 14,
- "bid": 45.16773,
- "bsize": 36,
- "sensorID": 0,
- "randomID": 14
}, - {
- "time": "0D07:33:41.240573118",
- "sym": "K",
- "realTime": "2026-01-24T07:33:41.240473118",
- "ask": 36.78192,
- "asize": 27,
- "bid": 61.92058,
- "bsize": 28,
- "sensorID": 0,
- "randomID": 0
}
]
}Executes a SQL query string (SELECT-only) against the database.
| query required | string SQL expression. Must be a |
{- "query": "select sym, bid, ask from quote where bid > 100 by sym"
}{- "header": {
- "corr": "f98f13f8-621b-4721-b242-3afb94077441",
- "logCorr": "f98f13f8-621b-4721-b242-3afb94077441",
- "rcvTS": "2026-01-22T07:36:33.459000000",
- "http": "json",
- "api": "sql",
- "agg": ":192.168.240.7:5060",
- "refVintage": -9223372036854776000,
- "rc": 0,
- "ac": 0,
- "ai": "",
- "limitApplied": false
}, - "payload": [
- {
- "sym": "X",
- "bid": 45.16773,
- "ask": 2.975187
}, - {
- "sym": "K",
- "bid": 61.92058,
- "ask": 36.78192
}
]
}Executes a q query string against the database.
| query required | string Freeform q query |
| agg | string The gateway concatenates query results from each tier (RDB, IDB, HDB) by performing a
|
{- "query": "select from quote where sym=`DNDF.CAN, price>300.5",
- "agg": "{select minPx:min price by sym from x}"
}{- "header": {
- "corr": "f98f13f8-621b-4721-b242-3afb94077441",
- "logCorr": "f98f13f8-621b-4721-b242-3afb94077441",
- "rcvTS": "2026-01-22T07:36:33.459000000",
- "http": "json",
- "api": "qsql",
- "agg": ":192.168.240.7:5060",
- "refVintage": -9223372036854776000,
- "rc": 0,
- "ac": 0,
- "ai": "",
- "limitApplied": false
}, - "payload": [
- {
- "sym": "X",
- "bid": 45.16773
}, - {
- "sym": "K",
- "bid": 61.92058
}
]
}