Skip to main content
The closeMiniapp command programmatically closes the mini app from within your application. Use Case: This command is useful when your mini app needs to close itself after completing an action, such as opening a deeplink to another app or finishing a specific flow.

Using the command

The command takes no arguments and has no response — the mini app closes immediately.
app/page.tsx
import { MiniKit } from '@worldcoin/minikit-js'

const handleClose = () => {
	if (!MiniKit.isInstalled()) {
		return
	}

	MiniKit.commands.closeMiniapp()
}
app/page.tsx
import { MiniKit } from '@worldcoin/minikit-js'

const openDeeplinkAndClose = () => {
	if (!MiniKit.isInstalled()) {
		return
	}

	window.open('https://example.com/deeplink', '_blank')
	MiniKit.commands.closeMiniapp()
}