Skip to main content

Documents

Base: https://insights-service.<domain>/api/v2/source/{sourceId}. Sources of type store and push.

Write rules: the body is a flat object (objects only for list and geo-point), without id or _id. Values are converted to the field types, unknown fields are dropped.

Get​

GET/doc/{docId}insights-service

Response { "id": "…", "doc": { … } }. 404 doc/not-found.

Create​

POST/docinsights-service
curl -s https://insights-service.scenid.cloud/api/v2/source/$SOURCE_ID/doc \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"data": {
"orderId": "ORD-2001", "orderedAt": "2026-09-01T10:15:00Z", "quantity": 2,
"unitPrice": 24.9, "total": 49.8, "status": "paid", "newCustomer": true
},
"return": false
}'

Response { "id": "…", "result": "created" }, or { "id", "doc" } with return: true.

The id is the value of the duplicate-control field if the source uses one (the same key updates that document). Otherwise it is generated, and the same payload sent twice creates two documents.

Errors: doc/invalid-body, doc/body-not-flat, doc/reserved-field:<name>, doc/source-type-not-supported, doc/field-type-mismatch, validation { "errors": [...] }.

Update​

PUT/doc/{docId}insights-service

Body { "data": { … }, "update": true, "return": false }. Without update the document is replaced. With update: true the fields are merged into the raw document. Response { "result": "ok" }. 404 doc/not-found.

Delete​

DELETE/doc/{docId}insights-service

204. With ?return=true: { "id", "doc" }. Removes the document from the raw and main index.

Batch insert​

POST/batchinsights-service
curl -s https://insights-service.scenid.cloud/api/v2/source/$SOURCE_ID/batch \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{ "data": [ { "orderId": "ORD-2002", "total": 10 }, { "orderId": "ORD-2003", "total": 12.5 } ] }'
Response 200
{ "created": 2, "updated": 0, "failed": 0, "total": 2, "errors": [] }

Partial success: invalid documents are listed in errors ({ code, message, path?, id? }), the rest is written. A document may carry _id. With return: true the response also has ids.

NDJSON: send Content-Type: application/x-ndjson with one JSON document per line, useful for tools like Vector.

curl -s https://insights-service.scenid.cloud/api/v2/source/$SOURCE_ID/batch \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/x-ndjson' \
--data-binary $'{"orderId":"ORD-2004","total":9}\n{"orderId":"ORD-2005","total":11}\n'

Errors: batch/invalid-body, batch/invalid-jsonl.

Find across sources​

GET/api/v2/sources/{sourceId1,sourceId2}/docsinsights-service
QueryDescription
sizeDefault 10, max 1000
filterJSON array [{ "field", "operator", "value" }]

Operators: eq, neq, gt, gte, lt, lte, in, exists, contains.

curl -s -G "https://insights-service.scenid.cloud/api/v2/sources/$ID1,$ID2/docs" \
-H "Authorization: Bearer $TOKEN" \
--data-urlencode 'size=20' \
--data-urlencode 'filter=[{"field":"status","operator":"eq","value":"paid"}]'

Response { "total": 12, "<sourceName>": [ … ] }. Errors: sources/customers-source-not-supported, source/not-found, filter/unknown-operator.