{"openapi":"3.0.3","info":{"title":"Wonder API","version":"1.0.0","description":"Read-only access to device locations. Create a token on the Wonder web page, choosing which devices it covers, and send it as `Authorization: Bearer <token>`. A token works until it is revoked."},"servers":[{"url":"/api/v1"}],"security":[{"bearerToken":[]}],"paths":{"/devices":{"get":{"operationId":"listDevices","summary":"List the devices this token covers, with their latest position","responses":{"200":{"description":"Devices covered by the token","content":{"application/json":{"schema":{"type":"object","required":["devices"],"properties":{"devices":{"type":"array","items":{"$ref":"#/components/schemas/Device"}}}}}}},"401":{"description":"Missing, unknown or revoked token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The token exceeded its request limit (60 per minute by default). Retry after the given delay.","headers":{"Retry-After":{"description":"Seconds until the token may call again","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/devices/{uuid}/history":{"get":{"operationId":"getDeviceHistory","summary":"Location history for a device, with nearby consecutive points grouped","description":"Consecutive points that stayed within `radius` metres of the first point of a group are returned as one entry spanning `from` to `to`. When there are more entries than `limit`, the most recent ones are returned and `truncated` is true. A request may span at most 31 days; page through older history with `from` and `to`.","parameters":[{"name":"uuid","in":"path","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","description":"Start of the window. Defaults to 12 hours before `to`.","schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","description":"End of the window. Defaults to now.","schema":{"type":"string","format":"date-time"}},{"name":"radius","in":"query","description":"Metres a device may move and still count as the same place. 0 disables grouping.","schema":{"type":"number","minimum":0,"maximum":10000,"default":50}},{"name":"limit","in":"query","description":"Maximum number of entries to return.","schema":{"type":"integer","minimum":1,"maximum":5000,"default":1000}}],"responses":{"200":{"description":"Grouped track, oldest entry first","content":{"application/json":{"schema":{"$ref":"#/components/schemas/History"}}}},"400":{"description":"Invalid query parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing, unknown or revoked token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The device does not exist or is not covered by this token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"The token exceeded its request limit (60 per minute by default). Retry after the given delay.","headers":{"Retry-After":{"description":"Seconds until the token may call again","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerToken":{"type":"http","scheme":"bearer","description":"Token created on the Wonder web page"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"Device":{"type":"object","required":["uuid","name","location","battery"],"properties":{"uuid":{"type":"string"},"name":{"type":"string","nullable":true},"location":{"nullable":true,"description":"Latest known position, null until the device has reported one","allOf":[{"$ref":"#/components/schemas/LatestLocation"}]},"battery":{"nullable":true,"description":"Latest battery report, null if the device never reported one","allOf":[{"$ref":"#/components/schemas/Battery"}]}}},"LatestLocation":{"type":"object","required":["lat","lon","updatedAt"],"properties":{"lat":{"type":"number"},"lon":{"type":"number"},"updatedAt":{"type":"string","format":"date-time","nullable":true}}},"Battery":{"type":"object","required":["level","updatedAt"],"properties":{"level":{"type":"number","description":"Battery level as reported by the device"},"updatedAt":{"type":"string","format":"date-time"}}},"History":{"type":"object","required":["device","from","to","radius","truncated","track"],"properties":{"device":{"type":"string"},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"radius":{"type":"number"},"truncated":{"type":"boolean"},"track":{"type":"array","items":{"$ref":"#/components/schemas/TrackEntry"}}}},"TrackEntry":{"type":"object","required":["lat","lon","from","to","samples"],"properties":{"lat":{"type":"number","description":"Mean latitude of the grouped points"},"lon":{"type":"number","description":"Mean longitude of the grouped points"},"from":{"type":"string","format":"date-time","description":"First report in the group"},"to":{"type":"string","format":"date-time","description":"Last report in the group"},"samples":{"type":"integer","description":"Number of raw reports in the group"}}}}}}