{
    "variable": [
        {
            "id": "baseUrl",
            "key": "baseUrl",
            "type": "string",
            "name": "string",
            "value": "https:\/\/weather-guardian.com"
        }
    ],
    "info": {
        "name": "WeatherGuardian API Documentation",
        "_postman_id": "cc943f98-7743-4987-82fd-c392caf57f81",
        "description": "",
        "schema": "https:\/\/schema.getpostman.com\/json\/collection\/v2.1.0\/collection.json"
    },
    "item": [
        {
            "name": "Sensors",
            "description": "",
            "item": [
                {
                    "name": "Export sensor data",
                    "request": {
                        "url": {
                            "host": "{{baseUrl}}",
                            "path": "api\/sensors\/:sensor_id\/export",
                            "query": [
                                {
                                    "key": "from",
                                    "value": "2025-10-01T00%3A00%3A00Z",
                                    "description": "Start of the range (inclusive). ISO-8601 or Unix timestamp (s or ms).",
                                    "disabled": false
                                },
                                {
                                    "key": "to",
                                    "value": "1730332799000",
                                    "description": "End of the range (inclusive). ISO-8601 or Unix timestamp (s or ms). Defaults to now.",
                                    "disabled": false
                                },
                                {
                                    "key": "agg_type",
                                    "value": "hour",
                                    "description": "The aggregation level. One of: `raw`, `hour`, `day`.",
                                    "disabled": false
                                }
                            ],
                            "raw": "{{baseUrl}}\/api\/sensors\/:sensor_id\/export?from=2025-10-01T00%3A00%3A00Z&to=1730332799000&agg_type=hour",
                            "variable": [
                                {
                                    "id": "sensor_id",
                                    "key": "sensor_id",
                                    "value": "SEN-089272C3AB30",
                                    "description": "The ID of the sensor."
                                }
                            ]
                        },
                        "method": "GET",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application\/json"
                            },
                            {
                                "key": "Accept",
                                "value": "application\/json"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\"from\":\"architecto\",\"to\":\"architecto\",\"agg_type\":\"raw\"}"
                        },
                        "description": "Export data from a sensor. Only sensors you own (via its hub) or sensors marked as public can be exported.\n\n**Dates:** `from` and `to` accept ISO-8601 datetime strings (e.g. `2025-10-31T12:00:00Z`) **or** Unix timestamps\n(seconds or milliseconds; ms auto-detected by length). If `to` is omitted it defaults to \"now\". All processing is in **UTC**.\n`from` must be before (or equal to) `to`.\n\n**Aggregation shapes:**\n- `raw`: an array of raw measurements with fields: `observed_at` (ISO-8601), `temperature_c`, `humidity_pct`, `pressure_hpa`.\n- `hour`: grouped by **day**, then **hour** (0-23). For each metric you get `{ avg, min, max }`.\n- `day`: an array; each element is an object keyed by `YYYY-MM-DD`, whose value contains per-metric `{ avg, min, max }`."
                    },
                    "response": [
                        {
                            "header": [],
                            "code": 200,
                            "body": "{\n  \"ok\": true,\n  \"geohash\": \"gcw2mn3\",\n  \"data\": [\n    { \"observed_at\": \"2025-10-31T12:34:56Z\", \"pressure_hpa\": 1013.2, \"temperature_c\": 19.8, \"humidity_pct\": 62.1 },\n    { \"observed_at\": \"2025-10-31T12:35:56Z\", \"pressure_hpa\": 1013.1, \"temperature_c\": 19.9, \"humidity_pct\": 61.8 }\n  ]\n}",
                            "name": "raw"
                        },
                        {
                            "header": [],
                            "code": 200,
                            "body": "{\n  \"ok\": true,\n  \"geohash\": \"gcw2mn3\",\n  \"data\": {\n    \"2025-10-31\": {\n      \"hours\": {\n        \"12\": {\n          \"temperature\": { \"avg\": 19.4, \"min\": 18.9, \"max\": 20.1 },\n          \"humidity\":    { \"avg\": 61.7, \"min\": 59.2, \"max\": 64.0 },\n          \"pressure\":    { \"avg\": 1012.9, \"min\": 1012.4, \"max\": 1013.5 }\n        },\n        \"13\": {\n          \"temperature\": { \"avg\": 19.1, \"min\": 18.6, \"max\": 19.8 },\n          \"humidity\":    { \"avg\": 62.3, \"min\": 60.1, \"max\": 64.2 },\n          \"pressure\":    { \"avg\": 1012.6, \"min\": 1012.1, \"max\": 1013.0 }\n        }\n      }\n    }\n  }\n}",
                            "name": "hour"
                        },
                        {
                            "header": [],
                            "code": 200,
                            "body": "{\n  \"ok\": true,\n  \"geohash\": \"gcw2mn3\",\n  \"data\": [\n    {\n      \"2025-10-30\": {\n        \"temperature\": { \"avg\": 18.7, \"min\": 16.9, \"max\": 20.8 },\n        \"humidity\":    { \"avg\": 63.2, \"min\": 54.0, \"max\": 71.4 },\n        \"pressure\":    { \"avg\": 1014.1, \"min\": 1009.8, \"max\": 1017.2 }\n      }\n    },\n    {\n      \"2025-10-31\": {\n        \"temperature\": { \"avg\": 18.1, \"min\": 17.3, \"max\": 19.4 },\n        \"humidity\":    { \"avg\": 64.5, \"min\": 58.2, \"max\": 69.9 },\n        \"pressure\":    { \"avg\": 1013.0, \"min\": 1010.1, \"max\": 1015.0 }\n      }\n    }\n  ]\n}",
                            "name": "day"
                        },
                        {
                            "header": [],
                            "code": 403,
                            "body": "{\"ok\": false, \"message\": \"unauthorised\"}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 422,
                            "body": "{\"message\": \"from date cannot be null\"}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 422,
                            "body": "{\"message\": \"unable to parse from date\"}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 422,
                            "body": "{\"message\": \"unable to parse to date\"}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 422,
                            "body": "{\"message\": \"to date must be after from date\"}",
                            "name": ""
                        }
                    ]
                },
                {
                    "name": "Export latest sensor measurement",
                    "request": {
                        "url": {
                            "host": "{{baseUrl}}",
                            "path": "api\/sensors\/:sensor_id\/latest",
                            "query": [],
                            "raw": "{{baseUrl}}\/api\/sensors\/:sensor_id\/latest",
                            "variable": [
                                {
                                    "id": "sensor_id",
                                    "key": "sensor_id",
                                    "value": "SEN-089272C3AB30",
                                    "description": "The ID of the sensor."
                                },
                                {
                                    "id": "sensor",
                                    "key": "sensor",
                                    "value": "SEN-1234567890",
                                    "description": "The sensor device ID."
                                }
                            ]
                        },
                        "method": "GET",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application\/json"
                            },
                            {
                                "key": "Accept",
                                "value": "application\/json"
                            }
                        ],
                        "body": null,
                        "description": "Returns the latest measurement for a single sensor.\nOnly sensors you own (via its hub) or sensors marked as public can be queried.\n\nThe response payload is the `MeasurementResource` output for the sensor's `lastMeasurement`."
                    },
                    "response": [
                        {
                            "header": [],
                            "code": 200,
                            "body": "{\n  \"observed_at\": \"2026-01-10T00:00:00Z\",\n  \"pressure_hpa\": 1013.2,\n  \"temperature_c\": 19.8,\n  \"humidity_pct\": 62.1,\n  \"battery_pct\": 87\n}",
                            "name": "ok"
                        },
                        {
                            "header": [],
                            "code": 200,
                            "body": "null",
                            "name": "no_measurement"
                        },
                        {
                            "header": [],
                            "code": 403,
                            "body": "{\"ok\": false, \"message\": \"unauthorised\"}",
                            "name": ""
                        },
                        {
                            "header": [],
                            "code": 422,
                            "body": "\"Data can only be exported from sensors\"",
                            "name": ""
                        }
                    ]
                }
            ]
        }
    ],
    "auth": {
        "type": "apikey",
        "apikey": [
            {
                "key": "in",
                "value": "header",
                "type": "string"
            },
            {
                "key": "key",
                "value": "x-api-key",
                "type": "string"
            }
        ]
    }
}