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

## saveAiVisualBoxInfo

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

### Description

Save Vision Box information

### Parameters

`Params`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `params` | `SaveAiVisualBoxInfoParams` | Yes | - | Save request body of type SaveAiVisualBoxInfoParams. Top-level fields: family gid, inventory stockId, optional visionBoxId. |

### Referenced Types

##### `interface` SaveAiVisualBoxInfoParams

| Property | Type | Description |
| --- | --- | --- |
| `gid` | `string` | Home gid |
| `stockId` | `string` | Inventory ID |
| `visionBoxId` | `string` | Vision Box ID (optional) |
| `visionBoxInfoContent` | `AiVisualBoxInfoContent` | Cube service configuration: name, status, image-to-text, report type/language, event list, scenarios, etc. |

##### `interface` AiVisualBoxInfoContent

| Property | Type | Description |
| --- | --- | --- |
| `visionBoxName` | `string` | Visual Cube name |
| `visionBoxState` | `0 \| 1` | Vision Box status |
| `generateDescState` | `0 \| 1` | Image-to-text switch |
| `reportTypeList` | `"ReportType.DAILY" \\| "ReportType.WEEKLY"[]` | Supported report type list |
| `reportLangType` | `string` | Report language type |
| `visionBoxEventList` | `VisionBoxEvent[]` | Vision Box event list |
| `sceneType` | `"SceneType.security" \\| "SceneType.album"` | Scene type (Security/Album, etc.) |

##### `enum` ReportType

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `ReportType.DAILY` | `1` | Daily report |
| `ReportType.WEEKLY` | `2` | Weekly report |

##### `enum` VisionEventType

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `VisionEventType.PRESET` | `0` | Preset event |
| `VisionEventType.CUSTOM` | `1` | Custom event |

##### `enum` SceneType

| Enum Value | Actual Value | Description |
| --- | --- | --- |
| `SceneType.security` | `0` | Security scenario |
| `SceneType.album` | `1` | Gallery scenario |

##### `interface` VisionBoxEvent

| Property | Type | Description |
| --- | --- | --- |
| `eventCode` | `string` | Event code |
| `eventValue` | `string` | Event value |
| `eventType` | `"VisionEventType.PRESET" \\| "VisionEventType.CUSTOM"` | Event type (preset / custom) |


### Examples

#### Request example

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

saveAiVisualBoxInfo({
  gid: '194137',
  stockId: 'stock-1',
  visionBoxId: 'vb-1',
  visionBoxInfoContent: {
    visionBoxName: 'Living Room Cube',
    visionBoxState: 1,
    generateDescState: 0,
    reportTypeList: [1],
    reportLangType: 'zh',
    visionBoxEventList: [],
    sceneType: 0,
  },
})
  .then((r) => console.log(r))
  .catch(console.error);
```

#### Response example

```json
1111
```
