Skip to main content

getSchemeUri

Synchronously returns the deep-link scheme URI that was used when the screen was first entered. URI changes caused by subsequent in-app navigation are not reflected — only the initial entry URI is returned.

Signature

import { getSchemeUri } from '@apps-in-toss/web-framework';

declare function getSchemeUri(): string;

Parameters

None.

Returns

  • string — the scheme URI at initial entry. Does not update as the user navigates within the mini-app.
Fixed at initial entry

getSchemeUri() returns the URI from when the mini-app was first opened. Navigating within the app does not change the return value. If you need the current route, use your app's router state instead.

Permission

No permission required — getSchemeUri is not bound to a PermissionName. For the typical permission flow used by other namespaces, see Guides — Permissions pattern.

Examples

Minimal

import { getSchemeUri } from '@apps-in-toss/web-framework';

const schemeUri = getSchemeUri();
console.log('Entry scheme URI:', schemeUri);
import { getSchemeUri } from '@apps-in-toss/web-framework';
import { useEffect, useState } from 'react';

function DeepLinkPage() {
const [schemeUri, setSchemeUri] = useState('');
const [params, setParams] = useState<Record<string, string>>({});

useEffect(() => {
const uri = getSchemeUri();
setSchemeUri(uri);

try {
// Parse query parameters from the scheme URI.
const url = new URL(uri);
const parsed: Record<string, string> = {};
url.searchParams.forEach((value, key) => {
parsed[key] = value;
});
setParams(parsed);
} catch {
// Ignore if the URI format is not parseable.
}
}, []);

return (
<div>
<p>Entry URI: <code>{schemeUri}</code></p>
<ul>
{Object.entries(params).map(([key, value]) => (
<li key={key}><strong>{key}</strong>: {value}</li>
))}
</ul>
</div>
);
}

Try it live

Open the Environment page in sdk-example and run the getSchemeUri card to inspect the result.

Open in sdk-example

External references