v2
Stream

Ingest JSON/NDJSON data into Ducklake

Ingest JSON/NDJSON data into Ducklake tables.

This endpoint accepts:

  • JSON objects or arrays (Content-Type: application/json)
  • NDJSON streams (Content-Type: application/x-ndjson)
  • Optional compression with gzip or zstd (Content-Encoding: gzip|zstd)

Two modes are supported via config.mode:

  • append (default): inserts rows into the target table.
  • merge: atomic delete-then-insert keyed on config.primary_key (exactly one field for v2). Existing rows whose PK matches an incoming row are deleted; all incoming rows are then inserted. Within-batch duplicate PKs are rejected before any duckserver call.

Partitioning uses the table's existing partition spec.

Type-coercion notes:

  • Values are inlined as SQL literals and CAST(... AS <target_type>) to the target column's type from DESCRIBE, so mixed-type input (e.g. an int and a string in the same VARCHAR column) inserts cleanly.
  • Python bool values land via DuckDB's CAST semantics: TRUE/FALSE for BOOLEAN columns, lowercase 'true'/'false' for VARCHAR columns. Send a string if you need case preservation.

Authentication is required via API key or JWT token in Authorization header.

post/v2/stream

Request body

Response

Successful Response

successboolean required

Whether the ingestion was successful

request_idstring required

Unique request identifier

stream_idstring required

Unique stream identifier

tablestring required

Fully qualified table name

acceptedinteger required

Number of rows parsed and accepted

successful_rowsinteger required

Number of rows successfully written

rejected_rowsinteger required

Number of rows rejected due to validation errors

partitionsstring[] required

Human-friendly partition summary

snapshot_idstring nullable

Iceberg snapshot ID (present when wait=true)

warningsstring[]

Warning messages

errorsstring[]

Error messages

Changes