/imp endpoint imports CSV data into QuestDB tables via HTTP multipart/form-data POST requests.
Endpoint
Request Format
The request must be amultipart/form-data POST with the CSV file in the data field.
Query Parameters
Target table name. If not specified, uses the filename (without extension).
Column name to use as designated timestamp. QuestDB will use this column for time-based partitioning and queries.
Partition strategy for the table. Options:
NONE- No partitioningHOUR- Hourly partitionsDAY- Daily partitions (recommended for most use cases)WEEK- Weekly partitionsMONTH- Monthly partitionsYEAR- Yearly partitions
DAY if timestamp column is specified, otherwise NONE.When
true, drops the existing table before importing. Use with caution.When
true, creates the table if it doesn’t exist. When false, imports only if table exists.CSV field delimiter character. Common values:
,- Comma (default)\t- Tab;- Semicolon|- Pipe
When
true, treats the first row as column names even if auto-detection suggests otherwise.Skip Lines with Extra Values. When
true, silently ignores rows with more columns than expected.Error handling strategy:
skipRow- Skip rows with errors, import valid rowsabort- Abort import on first error
Maximum number of uncommitted rows before automatic commit. Higher values improve import speed but use more memory.Default: Configured server value (typically 1000)
Maximum out-of-order lag for timestamp values. Accepts time units:
1s- 1 second5m- 5 minutes1h- 1 hour1d- 1 day
o3MaxLag=10sResponse format:
tabular- Plain text tablejson- JSON response
Response
JSON Format (fmt=json)
Status of the import:
"OK" on success.Name of the table where data was imported.
Number of rows that failed to import due to errors.
Number of rows successfully imported.
Whether a header row was detected in the CSV.
Partition strategy used for the table.
Name of the designated timestamp column (if specified).
Array of warning messages (if any).Common warnings:
"Existing table timestamp column is used"- Import used existing table’s timestamp"Existing table PartitionBy is used"- Import used existing table’s partition strategy
Array of column information.
Examples
Basic CSV Import
Import a CSV file into a new table:sensors (derived from filename).
Import with Table Name
Import with Timestamp and Partitioning
Import with Custom Delimiter
Import a tab-separated file:%09 is the URL-encoded tab character.
Import with JSON Response
Overwrite Existing Table
Import into Existing Table
Append data to an existing table (fails if table doesn’t exist):Import with Schema Definition
You can provide a schema JSON to specify column types:Advanced Import with Multiple Options
CSV Format Requirements
Header Row
The first row is automatically detected as a header if:- Column names are valid identifiers
- Values differ significantly from subsequent rows
forceHeader=true to always treat the first row as headers.
Data Types
QuestDB automatically detects column types:| Pattern | Detected Type | Example |
|---|---|---|
true, false | BOOLEAN | true |
| Integer | INT or LONG | 123 |
| Decimal | DOUBLE | 3.14 |
| ISO timestamp | TIMESTAMP | 2024-01-01T00:00:00.000Z |
| UUID format | UUID | a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 |
| IPv4 format | IPv4 | 192.168.1.1 |
| Text | STRING or SYMBOL | hello |
Timestamp Formats
Supported timestamp formats:yyyy-MM-ddTHH:mm:ss.SSSSSSSZ(ISO 8601)yyyy-MM-dd HH:mm:ssyyyy-MM-dd- Unix timestamp (seconds or milliseconds)
pattern field.
Null Values
The following are treated as NULL:- Empty fields (consecutive delimiters)
NULL(case-insensitive)- Empty strings in quoted fields:
""
Error Handling
Row-Level Errors
Withatomicity=skipRow (default), rows with errors are skipped:
errors field shows how many errors occurred per column.
Import Errors
Common error responses:Performance Tips
Out-of-order data: Use
o3MaxLag to handle late-arriving data efficiently. QuestDB can merge out-of-order data up to the specified lag.Multipart Upload Example (Python)
Limits and Configuration
Configure import limits inserver.conf: