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

## fileRelationSave

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

### Description

Save pet media files

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `fileInfo` | `FileInfo` | Yes | File info: objectKey, fileName |
| `devId` | `string` | Yes | Device ID |

### Return Value

Type: `Promise<boolean>`

boolean

### Referenced Types

##### `type` FileInfo

File info in the `fileRelationSave` input parameters (relation.save report payload).

| Property | Type | Description |
| --- | --- | --- |
| `objectKey` | `string` | Object storage objectKey (returned by the storage service after the upload completes) |
| `fileName` | `string` | Filename (with extension, e.g., `clip.wav`) |


### Examples

#### Request example

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

fileRelationSave(
  { objectKey: 'your-object-key', fileName: 'clip.wav' },
  'vdevo167504******003'
)
  .then((res) => {
    console.log(res.token, res.action);
  })
  .catch();
```

#### Response example

```json
true
```
