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

## fetchDeviceFileSign

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

### Description

Get temporary storage upload signature

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `bizType` | `string` | Yes | Business type |
| `fileName` | `string` | Yes | File name to be stored |
| `contentType` | `string` | Yes | File category |

### Return Value

Type: `Promise<FileSign>`

FileSign: action (temporary storage signature), token (key for querying the storage result)

##### FileSign

| Property | Type | Description |
| --- | --- | --- |
| `action` | `string` | Temporary storage signature (used with the upload SDK) |
| `token` | `string` | Key for querying the storage result, used for `fetchDeviceFileUploadState` |

### Examples

#### Request example

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

fetchDeviceFileSign('pet_media', 'clip.wav', 'audio/wav')
  .then((sign) => {
    console.log(sign);
  })
  .catch();
```

#### Response example

```json
{
  "action": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token": "upload-token-abc123"
}
```
