/api/ingest/ndjson forwards your request body unchanged to the index your ingest API key is scoped to. Use it to write to a custom-schema index, or when you already emit JSON and don’t want to adopt OpenTelemetry. For OpenTelemetry-instrumented apps, use the OTLP endpoint instead.
The gateway does no batching or retries. Use an agent such as Vector, or handle both in your client.
Prerequisites
- A running Rootprint instance. Substitute its host for
<your-rootprint>. curl, or a log agent such as Vector.
Setup
1
Create the index
Create an index with the fields your logs carry and one
datetime field as the timestamp. See Create a custom index.The index mode decides what happens to fields the schema doesn’t declare: dynamic stores them, lenient ignores them, and strict rejects the record.2
Create an ingest API key
In Settings → API keys, click Create ingest key and pick the index. See API keys.
3
Send records
Send NDJSON: one JSON object per line, with no wrapping array and no trailing commas. Set
Content-Type: application/x-ndjson (application/json also works). The examples write to an audit-log index with the fields ts, level, action, actor, and source_ip.- curl
- Vector
Replace
<your-rootprint> and <your-ingest-api-key>.4
Map display roles
On the index’s Configuration tab, point Log level and Message at your fields:
level and action in this example. The defaults assume the OpenTelemetry schema (severity_text, body.message), so records look blank until you change them.5
Verify in Rootprint
A successful POST returns
200 with num_ingested_docs and num_rejected_docs counts. Accepted documents become searchable a few seconds later. Open Logs, pick your index from the selector, and look for the records you sent.otel-logs-v0_9 index instead, send records with its field names (see Indexes):
Troubleshooting
200withnum_rejected_docsabove0: some lines were dropped and the rest were accepted. Common causes: a trailing comma, a JSON array instead of one object per line, a value whose type doesn’t match the index schema, or an undeclared field in astrictindex.- 401, 403, 413, or 503: see Response codes. The NDJSON gateway returns them for the same reasons.
Related
- OTLP reference: for OpenTelemetry apps
- Indexes: built-in OpenTelemetry schema
- Create a custom index: define your own index schema
- Manage indexes: map log level, message, and traceback
- POST /api/ingest/ndjson: endpoint reference

