---
name: "getEnterOptions"
mode: "kit"
versionRequirements:
  - { name: "MiniKit", version: "1.0.0" }
platform:
  - "iOS"
  - "Android"
async: true
---

## getEnterOptions

> [VERSION] MiniKit >= 1.0.0

> [PLATFORM] iOS, Android

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

### Description

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

### Parameters

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

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `path` | `string` | `3.2.0` | Path to launch the Mini Program (code package path) |
| `scene` | `1000 \| 1001 \| 1002` | `3.15.0` | Scene value when the mini program is launched |
| `query` | `Record<string, any>` | `3.2.0` | Query parameters used to launch the Mini Program |
| `referrerInfo` | `ReferrerInfo` | `3.2.0` | Sharing |
| `apiCategory` | `string` | `3.2.0` | API category: default (default category); embedded (opened via the half-screen Mini Program capability) |
| `extraQuery` | `Record<string, any>` | `3.21.0` | Additional launch parameters, typically provided by the container, not business parameters |

#### fail callback parameters

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

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

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Referenced Types

##### `interface` ReferrerInfo

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


### Valid Values

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

| Value | Description |
| --- | --- |
| `1000` | Default value |
| `1001` | Opened via the recently used miniapp list |
| `1002` | Opened via URL mapping |


### Examples

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