Creating a Metric from Uploaded Data
Upload raw data (CSV, spreadsheet, JSON, XML, or values you already computed) and create a metric from it.
-
POST /data_feeds/generate?type=dataUpload— post the raw data (CSV, spreadsheet, JSON or XML) with its name/description as query parameters (see the Data Feeds guide for supported content types):POST /data_feeds/generate?type=dataUpload&name=Orders Content-Type: text/csv date,amount,status,region 2026-05-01,120.00,paid,US -
POST /metrics— see Creating the metric from the feed below. -
To refresh the data later (the feed created this way never auto-refreshes),
POST /data_feeds/:feedId/raw_datawith the new content — the metric keeps pointing at the same feed/column, so it picks up the new data automatically.
Creating the metric from the feed
POST /data_feeds/generate returns a feed with an id and columns[] (each with its own id); the metric then points at the feed itself, not at any underlying datasource:
{
"name": "Order Amount",
"description": "Order total from the uploaded orders CSV",
"sourceType": "DATAFEED",
"sourceId": "<feed id>",
"fieldId": "<id of the amount column>",
"dimensions": [
{ "name": "Status", "fieldId": "<id of the status column>" },
{ "name": "Region", "fieldId": "<id of the region column>" }
]
}Use the id of a metric-shaped column (e.g. a numeric column with an aggregation) for fieldId. If the feed has more than one date column and the metric should key off a specific one, set timeRefId to that column's id; otherwise it can be omitted. Other columns you want as filter/group-by dimensions go in dimensions[], each with that column's id as fieldId — as with the two above, which make the metric filterable and groupable by status and by region.
Updated 6 days ago