---
name: "enhanceClarityCancel"
mode: "kit"
versionRequirements:
  - { name: "AIKit", version: "1.4.1" }
  - { name: "@ray-js/ray", version: "1.7.37" }
platform:
  - "iOS"
  - "Android"
async: true
title: "enhanceClarityCancel"
---

## enhanceClarityCancel

> [VERSION] AIKit >= 1.4.1 | @ray-js/ray >= 1.7.37

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Cancel image clarity enhancement processing

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `trace_id` | `string` | Yes | - | `2.1.0` | Link ID |
| `device_id` | `string` | Yes | - | `2.1.0` | Device ID |
| `scene_type` | `string` | Yes | - | `2.1.0` | Business type |
| `enhance_type` | `1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8` | No | `1` | `2.1.0` | Enhancement type |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `() => void` | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Valid Values

##### `enhance_type` valid values

| Value | Description |
| --- | --- |
| `1` | No action, default |
| `2` | Noise reduction |
| `3` | Low-light enhancement |
| `4` | Super-resolution |
| `5` | Noise reduction + low-light enhancement |
| `6` | Noise reduction + super-resolution |
| `7` | Low-light enhancement + super-resolution |
| `8` | Noise reduction + low-light enhancement + super-resolution |


### Examples

#### Basic usage

```tsx
import { ai } from '@ray-js/ray'

const { enhanceClarityCancel } = ai;

enhanceClarityCancel({
  trace_id: 'example',
  device_id: 'device_001',
  scene_type: 'example',
  success: () => {
    console.log('enhanceClarityCancel success');
  },
  fail: (error) => {
    console.log('enhanceClarityCancel fail', error.errorMsg);
  },
});
```
