---
name: "getOutdoorsTracksLocation"
mode: "api"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.5" }
---

## getOutdoorsTracksLocation

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.5

> 💡 This API is a cloud capability and requires authorization before use. For details on cloud capabilities, see the [documentation](/cn/miniapp/common/desc/tech-stack/api).
> Note: Currently, cloud capabilities are not available in the Developer Tools environment; you must package the app or debug on a real device.

### Description

Batch query real-time locations by device ID.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `GetOutdoorsTracksLocationParams` | Yes | Request body |

### Return Value

Type: `Promise<GetOutdoorsTracksLocationResult>`

GetOutdoorsTracksLocationResult (see type definitions and the minituya return table for field meanings)

##### GetOutdoorsTracksLocationResult

| Property | Type | Description |
| --- | --- | --- |
| `deviceLocationList` | `DeviceLocationItem[]` | Real-time location list of devices |

### Referenced Types

##### `type` GetOutdoorsTracksLocationParams

| Property | Type | Description |
| --- | --- | --- |
| `deviceIds` | `string` | Comma-separated Device ID list, up to 50 |
| `coordType` | `string` | Coordinate system type for geolocation: WGS84, GCJ02, BD09LL; if not provided, defaults to Amap in China and Google outside China. |

##### `type` DeviceLocationItem

Real-time location item: In the DeviceLocationItem description, `protocol` is defined as a numeric type, while the response example uses a string (e.g., `"GPS"`); the report time is listed as `reportTime` in the parameter table, but the response example uses `timestamp`.

| Property | Type | Description |
| --- | --- | --- |
| `deviceId` | `string` | Device ID |
| `lon` | `number` | Longitude |
| `lat` | `number` | Latitude |
| `speed` | `number` | Speed |
| `protocol` | `string` | Positioning protocol |
| `reportTime` | `number` | Report time (parameter table) |
| `timestamp` | `number` | Timestamp (partial response example) |


### Examples

#### Request example

```typescript
import { getOutdoorsTracksLocation } from '@tuya-miniapp/cloud-api';

getOutdoorsTracksLocation({
  deviceIds: 'vdevo16245017293',
})
  .then((response) => {
    console.log(response);
  })
  .catch();
```

#### Response example

```json
{
  "deviceLocationList": [
    {
      "deviceId": "vdevo16245017293****",
      "lon": 114.003117,
      "speed": 100,
      "protocol": "GPS",
      "lat": 22.594031,
      "timestamp": 1625198100154
    }
  ]
}
```
