---
name: "getEnterOptions"
mode: "kit"
versionRequirements:
  - { name: "MiniKit", version: "1.0.0" }
  - { name: "@ray-js/ray", version: "0.3.23" }
platform:
  - "iOS"
  - "Android"
async: true
---

## getEnterOptions

> [VERSION] MiniKit >= 1.0.0 | @ray-js/ray >= 0.3.23

> [PLATFORM] iOS, Android

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

### Description

Get the parameters for this miniapp launch. If it is a cold start, the return value matches the App.onLaunch callback parameters; if it is a warm start, it matches App.onShow.

### Parameters

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `complete` | `() => void` | No | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `path` | `string` | `3.2.0` | Path used to launch the miniapp (code package path) |
| `scene` | `1000 \| 1001 \| 1002` | `3.15.0` | Launch scene value |
| `query` | `Record<string, any>` | `3.2.0` | Query parameters used to launch the miniapp |
| `referrerInfo` | `ReferrerInfo` | `3.2.0` | Share/forward |
| `apiCategory` | `string` | `3.2.0` | API category: default - default category; embedded - embedded; miniapps opened via the half-screen miniapp capability |
| `extraQuery` | `Record<string, any>` | `3.21.0` | Extra parameters for launching the miniapp, typically container-added, non-business parameters |

#### 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 |


### Referenced Types

##### `interface` ReferrerInfo

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `appId` | `string` | `3.2.0` | appId of the source Mini App |
| `extraData` | `Record<string, any>` | `3.2.0` | Data passed from the source Mini App; supported in specific scenes |


### Valid Values

##### `success.scene` valid values

| Value | Description |
| --- | --- |
| `1000` | Default value |
| `1001` | Launched via the Recently Used Mini Programs list |
| `1002` | Launched via URL mapping |


### Examples

#### Demo

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

getEnterOptions({
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
