Guides

Ingest data

Ingest unstructured data from inline payloads, files, and public URLs.

Ingest data

RawTree accepts unstructured data without a schema step. A table is created automatically on first insert.

Inline data

rtree insert --table events \
  --data '{"action":"signup","user_id":1}'

Use an array to insert multiple rows:

rtree insert --table events \
  --data '[{"action":"signup","user_id":1},{"action":"purchase","user_id":1,"amount":42}]'

Files

rtree insert --table events --file ./events.jsonl

JSONL is useful for large event streams because each line is one event.

Public URLs

rtree insert --table events --url https://example.com/events.jsonl

URL ingest waits for the import to finish. The API returns JSON with inserted (or null if the row count is unavailable). The X-ClickHouse-Query-Id response header contains the supplied ID, or the ID generated by ClickHouse when omitted. Errors return a normal HTTP error response.

Built-in transforms

Use transforms when the source format needs to be flattened before insert. A transform is a built-in preprocessor for JSON body inserts: RawTree reads the source JSON, emits one or more flat rows, then inserts those rows into the table.

rtree insert --table traces \
  --data '{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"api"}}]},"scopeSpans":[{"spans":[{"name":"GET /health","spanId":"abc"}]}]}' \
  --transform otlp-traces

The API accepts the same transform through the transform query parameter on a JSON body insert:

curl -X POST "https://api.rawtree.com/v1/tables/traces?transform=otlp-traces" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"api"}}]},"scopeSpans":[{"spans":[{"name":"GET /health","spanId":"abc"}]}]}'

OpenTelemetry SDKs and collectors can also send native OTLP directly to RawTree without a transform query parameter. See the OpenTelemetry guide for endpoints, SDK environment variables, Collector config, and a smoke test.

Transforms are not supported with URL inserts. If you use ?url=, transform the data before hosting it.

See Transforms for supported input shapes and emitted rows.

TransformSource format
otlp-tracesOpenTelemetry trace payloads
otlp-logsOpenTelemetry log payloads
otlp-metricsOpenTelemetry metric payloads
cloudwatch-logsAWS CloudWatch Logs subscription or delivery payloads
cloudtrailAWS CloudTrail records
firehoseAWS Firehose HTTP endpoint delivery payloads

API insert

curl -X POST "https://api.rawtree.com/v1/tables/events" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"action":"signup","user_id":1}]'

Verify the insert

rtree table describe events
rtree query "SELECT count() FROM events"

Upload failures and retries

Raw JSON body inserts without a transform stream to the database. RawTree prepares a missing table before forwarding the upload and does not retain a complete copy for server-side replay. The same behavior applies to gzip uploads; the body-size limit applies to the decoded data.

Keep the complete payload until the request succeeds. For temporary delivery failures, including a table not yet visible on the destination replica, the API returns 503 with Retry-After. Retry the complete upload after that delay, with backoff for repeated failures. Correct invalid JSON, invalid gzip, oversized payloads, and permission errors before sending them again.

A failed or interrupted upload can leave a table created or some rows inserted. A timeout or lost response can also mean the database accepted data without the client receiving confirmation. Retrying can therefore produce duplicates; a failed response is not a rollback guarantee.