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

## getOutdoorsTracksSegments

> [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

Paginated retrieval of device track segments. The difference between end time and start time must be ≤ 7 days. Up to 1000 segments are returned per call. If the number of segments in the time range exceeds 1000, the first 1000 segments are returned along with the start ID for the next page.

### Parameters

`Params`

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

### Return Value

Type: `Promise<GetOutdoorsTracksSegmentsResult>`

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

### Referenced Types

##### `type` GetOutdoorsTracksSegmentsParams

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `deviceId` | `string` | Yes | Device ID |
| `startTime` | `number` | Yes | Start time, 13-digit timestamp |
| `endTime` | `number` | Yes | End time, 13-digit timestamp |
| `lastId` | `number` | No | Start ID for the next page; leave empty on the first request |
| `needRated` | `boolean` | No | Scale conversion |
| `lessMileage` | `number` | No | Return only tracks with mileage greater than lessMileage |

##### `type` GetOutdoorsTracksSegmentsResult

```typescript
TrackSegment[]
```


### Examples

#### Request example

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

getOutdoorsTracksSegments({
  deviceId: 'vdevo16245017293',
  startTime: 1625198100154,
  endTime: 1625198190154,
})
  .then((response) => {
    console.log(response);
  })
  .catch();
```

#### Response example

```json
{
  "deviceId": "vdevo16245017293****",
  "segmentList": [
    {
      "endTime": 1625198190154,
      "battery": 5,
      "speed": 100,
      "duration": 3000,
      "startTime": 1625198100154,
      "mileage": 10
    }
  ],
  "hasMore": false
}
```
