Data API
Reference for GET /v1/data — query parameters, authentication, and examples.
Programmatic access to PermaSense time series uses the backend data endpoint. The Download page builds the same request interactively; use this page as the full reference.
Endpoint
GET /v1/dataBy default the response format is chosen automatically (see forceType below). Forced csv returns streaming CSV (text/csv) with a header row; forced json returns JSON. Validation and not-found errors respond as JSON {"error":"..."} with status 400 or 404.
Replace {backend_base_url} with your backend base URL (no trailing slash).
Critical: binary and image fields (auto mode)
When
forceTypeis omitted: iffieldsselects exactly one binary column (e.g.gps_raw_data), the response is the raw concatenated binary payload; iffieldsselects exactly one image-path column, the response is a ZIP of the files; otherwise the response is CSV. In CSV, binary columns are encoded as Base64. SetforceType=csvorforceType=jsonto override and keep a tabular response.
Query parameters
| Parameter | Required | Notes |
|---|---|---|
deployment | yes | Deployment name (not ID). |
vsensor | yes | Short virtual-sensor name, or fully prefixed table name. |
from | no | Lower bound, inclusive. UTC as yyyy-MM-dd or yyyy-MM-dd'T'HH:mm:ss. |
to | no | Upper bound, exclusive. Same format as from. Must be after from when both are set. |
position | schema-dependent¹ | Filter by position id, or * for all positions. Mutually exclusive with positionLabel. When *, the CSV includes position (and device_id when present). |
positionLabel | schema-dependent¹ | Filter by position label (resolved via label mapping). Mutually exclusive with position. |
device | schema-dependent¹ | Filter by device id, or * for all devices (device-only sensors). Optional extra filter when a position column also exists. When *, the CSV includes device_id. |
resolution | no | 60m (default, derived hourly view) or raw. |
forceType | no | Override response format: csv, json, binary, or zip. Omit for the smart default (ZIP for a single image-path column, binary for a single binary column, otherwise CSV). |
fields | no | Repeatable query param to select a subset of columns. |
limit | no | Maximum number of rows to return. |
¹ Schema-dependent: required based on the virtual sensor table. Sensors with a position column need position, position=*, or positionLabel. Sensors without a position column need device or device=*. Use the Download form to see which filter applies and which values are available.
Terminal clients like curl are sessionless by default — they do not use your browser login. The virtual sensor must be enabled for public download, otherwise the request is denied. For private sensors, add -H 'Authorization: Bearer <token>'.
Authentication
Public virtual sensors (download enabled by an admin) can be requested anonymously — no credentials required. This is required for sessionless clients such as curl. For any other sensor, send a JWT as Authorization: Bearer <token>. Obtain a token from the backend login endpoint.
Examples
curl
curl '{backend_base_url}/v1/data
?deployment=mydep
&vsensor=humidity
&from=2026-01-01T00:00:00
&to=2026-02-01T00:00:00
&position=91
'Python notebook
Load the CSV into a pandas DataFrame with requests:
import io
import pandas as pd
import requests
base = "{backend_base_url}"
params = {
"deployment": "mydep",
"vsensor": "humidity",
"from": "2026-01-01T00:00:00",
"to": "2026-02-01T00:00:00",
"position": "91",
}
r = requests.get(f"{base}/v1/data", params=params, timeout=120)
r.raise_for_status()
df = pd.read_csv(io.StringIO(r.text))For non-public sensors, pass headers={"Authorization": "Bearer <token>"} to requests.get.
Related
- Download data — UI for building the same request and opening the interactive API drawer
