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

## getServiceDetail

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

### Description

Service detail information

### Parameters

`Params`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `params` | `QueryServiceDetailDto` | Yes | - | Request body |

### Referenced Types

##### `type` QueryServiceDetailDto

| Property | Type | Description |
| --- | --- | --- |
| `homeId` | `string` | Home ID |
| `stockId` | `string` | Inventory ID |

##### `interface` DeviceInfo

| Property | Type | Description |
| --- | --- | --- |
| `productId` | `string` | Product ID |
| `planList` | `PlanInfoDto[]` | Device service plan list |
| `isUseFreeService` | `0 \| 1` | Whether the first-term free subscription item has been purchased (0 = not purchased, 1 = purchased) |
| `isUseCommonUserTrail` | `0 \| 1` | Whether a standard trial (account-level free item) has been purchased before (0 = not purchased, 1 = purchased) |
| `isUseCommonDeviceTrail` | `0 \| 1` | Whether a standard trial (device-level free item) has been purchased before (0 = not purchased, 1 = purchased) |
| `isTried` | `0 \| 1` | Whether the item has been tried (0 = not tried, 1 = tried) |
| `hasServiceOrder` | `boolean` | Whether a service ticket exists |
| `icon` | `string` | Device icon |
| `name` | `string` | Device name |
| `ownerId` | `string` | Home ID |
| `uuid` | `string` | Device unique ID |
| `roomName` | `string` | Room name |
| `deviceId` | `string` | Device deviceId |
| `isBind` | `"DeviceBindStatus.BINDING" \\| "DeviceBindStatus.NOT_SUPPORT" \\| "DeviceBindStatus.NOT_BIND"` | Binding status (Bound / Not supported / Unbound) |
| `status` | `boolean` | Device status |
| `aiSmartFreeDev` | `boolean` | Whether the current device is whitelisted for aiSmart capabilities |

##### `interface` CloudService

| Property | Type | Description |
| --- | --- | --- |
| `bindDeviceNum` | `number` | Number of bound devices |
| `totalDevices` | `number` | Total quantity |

##### `enum` StockStatus

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `StockStatus.NO_ENABLE` | `1` | Not enabled |
| `StockStatus.ENABLED` | `2` | Enabling |

##### `enum` DeviceBindStatus

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `DeviceBindStatus.BINDING` | `1` | Bound |
| `DeviceBindStatus.NOT_SUPPORT` | `2` | Not supported |
| `DeviceBindStatus.NOT_BIND` | `3` | Unbound |

##### `interface` PlanInfoDto

| Property | Type | Description |
| --- | --- | --- |
| `commodityCode` | `string` | Product code |
| `commodityName` | `string` | Product name |
| `env` | `number` | Environment identifier |
| `instanceId` | `string` | Instance ID (usually the device ID) |
| `isSubscribe` | `0 \| 1` | Whether subscribed to the product (0/1) |
| `orderNo` | `number` | Sort order |
| `planStatus` | `1` | Package status (e.g., in use) |
| `serviceBeginTime` | `number` | Service start time |
| `serviceEndTime` | `number` | Service end time |
| `stockId` | `string` | Inventory ID |
| `isCanceled` | `0 \| 1` | Whether unsubscribed (0/1) |
| `isAdditional` | `0 \| 1` | Whether an add-on (0/1) |


### Examples

#### Request example

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

getServiceDetail({ homeId: '194137', stockId: 'stock-1' })
  .then((d) => console.log(d))
  .catch(console.error);
```

#### Response example

```json
{
  "cover": "https://images.example.com/cover.jpg",
  "commodityName": "Cloud Storage Monthly Plan",
  "stockId": "stock-1",
  "commodityCode": "CLOUD_30D",
  "duration": 30,
  "durationDesc": "30 days",
  "stockStatus": 2,
  "isSubscribe": 1,
  "isFuturePayments": 0,
  "additionalUuid": "uuid-root",
  "categoryCode": "ipc",
  "isPublish": 1,
  "cloudService": { "bindDeviceNum": 1, "totalDevices": 2 }
}
```
