getGroupId
Synchronously returns the group ID assigned by the Apps in Toss platform. The group ID identifies the business or service group the mini-app belongs to.
Signature
import { getGroupId } from '@apps-in-toss/web-framework';
declare function getGroupId(): string;
Parameters
None.
Returns
string— the group ID string provided by Apps in Toss.
Permission
No permission required — getGroupId is not bound to a PermissionName. For the typical permission flow used by other namespaces, see Guides — Permissions pattern.
Examples
Minimal
import { getGroupId } from '@apps-in-toss/web-framework';
const groupId = getGroupId();
console.log('Group ID:', groupId);
Realistic — include group ID in API request headers
import { getGroupId } from '@apps-in-toss/web-framework';
import { useEffect, useState } from 'react';
function GroupInfoPage() {
const [groupId, setGroupId] = useState('');
useEffect(() => {
const id = getGroupId();
setGroupId(id);
}, []);
async function fetchGroupData() {
const id = getGroupId();
const response = await fetch('/api/group-data', {
headers: {
'X-Group-Id': id,
},
});
return response.json();
}
return (
<div>
<p>Group ID: <code>{groupId || 'Loading...'}</code></p>
<button type="button" onClick={fetchGroupData}>Fetch group data</button>
</div>
);
}
Try it live
Open the Environment page in sdk-example and run the getGroupId card to inspect the result.
Related APIs
getDeviceId— returns the device's unique identifier.getAppsInTossGlobals— returns deployment ID and brand globals.env.getDeploymentId— returns the current deployment's unique identifier.
Related guides
- Guides — Permissions pattern — permission flow used by other namespaces (reference only;
getGroupIddoesn't require a permission). - Recipes — Group-ID-based server API integration
External references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.- Web standard counterpart: none — group ID is a mini-app platform concept.