In a token grant organization, Toku sets up networks, tokens and your token contract address. updateOrgTokenAddress returns 403 there, so ask your Toku team to change them.
// Add a single recipientconst recipient = await tokuAPI('POST', 'createUserRoleInOrg', { email: 'jane.smith@company.com', givenName: 'Jane', familyName: 'Smith', externalEmployeeID: 'EMP-001', // Your HRIS ID country: 'US', employmentType: 'FULL_TIME'});console.log(recipient.roleInOrgID);// "660e8400-..." — save this, you'll need it for grants and wallets
The new seat has the USER role. If the email already has a seat in your organization, the call returns 409.
For bulk onboarding, use batch updates. Each row is matched to an existing seat by tgaRoleInOrgID, loginEmail or externalEmployeeID; a row that matches no seat creates a new USER seat.
Grant configurations define the grant type (kind, such as RTU, RTA, TPA or TOKEN_BONUS) and signing requirements. Create them in the TGA dashboard first.
const employeeGrants = await tokuAPI('GET', 'getEmployeeGrants?externalEmployeeID=EMP-001');// or ?payrollEmployeeID=... (wins if you send both)
List endpoints return all results (no pagination). For large organizations, cache results locally and poll periodically rather than calling on every page load.
networkName and walletType must match a network and wallet type set up in your organization. A recipient can also add their own wallet with addWallet, using a token that acts as their own seat (x-role-type: USER).
// 1. Find the new wallet and send it a test transaction// (needs automated test transactions turned on for your organization)const pending = await tokuAPI('GET', `getPendingWallets?roleInOrgID=${recipient.roleInOrgID}`);await tokuAPI('POST', 'sendTestTransaction', { walletID: pending[0].walletID});// 2. After the recipient confirms receipt, approve the walletconst awaiting = await tokuAPI('GET', 'getPendingWalletTestRequests');for (const req of awaiting) { await tokuAPI('POST', 'approveWalletRequest', { walletRequestID: req.walletVerificationRequestID });}
distRatio is a fraction from 0 to 1 for each of the recipient's wallet references on that grant.
setTokenWalletRefsDistribution is a different setting: it splits a person's pay in stablecoin across their wallets, for stablecoin payroll. It does not change how grants are distributed.
// Poll grants every 5 minutesasync function pollGrants() { const grants = await tokuAPI('GET', 'listGrants'); for (const grant of grants) { // Check for newly vested tokens if (grant.percentageOfUnitsVested > lastKnownPercentage[grant.grantID]) { console.log(`Grant ${grant.grantName}: ${grant.percentageOfUnitsVested}% vested`); } // Check for status changes if (grant.grantStatus !== lastKnownStatus[grant.grantID]) { console.log(`Grant ${grant.grantName}: status changed to ${grant.grantStatus}`); } }}setInterval(pollGrants, 5 * 60 * 1000);