Skip to main content

Sources

Host: https://insights-service.<domain>. Allowed: service tokens and users with the insights.use claim.

List sources​

GET/api/v2/sourceinsights-service
curl -s https://insights-service.scenid.cloud/api/v2/source -H "Authorization: Bearer $TOKEN"

Returns an array with sourceId, name, fieldTypes, queue statistics and transformErrorCount. Service tokens and admins see all sources, users their own.

REST calls address sources by sourceId. To work with names, list once and map name → sourceId.

const sources = await (await fetch(`${insights}/api/v2/source`, { headers })).json()
const sourceId = sources.find(source => source.name === 'Orders').sourceId

Get a source​

GET/api/v2/source/{sourceId}insights-service
QueryDescription
schema=trueAdds schema: { validation, render, translations }
fieldTypes, config, events, queue, fields, numExamplesOptional detail flags of the Insights app

Response includes config, fieldTypes, rawDocCount, totalDocCount. Secrets of functions are redacted.

Query and aggregate​

POST/api/v2/source/{sourceId}/aggregateinsights-service
curl -s https://insights-service.scenid.cloud/api/v2/source/$SOURCE_ID/aggregate \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"size": 10,
"fields": ["orderId", "total", "status"],
"filter": [{ "term": { "status.keyword": "paid" } }],
"sort": [{ "total": "desc" }]
}'
BodyTypeDescription
size, fromnumberPage size, offset
fieldsstring[]Returned fields
filterarrayElasticsearch clauses (all must match)
sortarrayElasticsearch sort clauses
pageKeyarray or objectnextPageKey of the previous page
aggs, aggModearray, stringGrouping and metric stages, and the mode (aggregation or composite). aggMode is required with aggs
includeFieldTypesboolean
rawbooleanRead the raw index
Response 200
{
"rows": [{ "_id": "…", "orderId": "ORD-1042", "total": 119.6, "status": "paid" }],
"nextPageKey": [119.6, 4211],
"totalDocCount": { "value": 60, "relation": "eq" },
"filteredDocCount": { "value": 41, "relation": "eq" }
}

See the Query reference for every filter, grouping, metric and response shape, and Recipes for ready-made requests.

Push​

POST/api/v2/source/{sourceId}/pushinsights-service

Queues one document or an array. Only service tokens, only sources of type push.

curl -s https://insights-service.scenid.cloud/api/v2/source/$SOURCE_ID/push \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '[{ "timestamp": "2026-09-01T10:00:00Z", "deviceId": "SENS-HH-01", "temperature": 20.4 }]'

Response { "ok": true, "queued": 1 }. Errors: push/invalid-source-type, push/source-not-ready, push/empty-body.

Other source endpoints​

Used by the Insights app, not by the SDK: GET /{id}/transform-errors, PUT /{id}/transform-error-handling, POST /{id}/reset, GET /{id}/export.csv (streams the full table as CSV), function management.