⚠️ This example is outdated !
Head over to SDK Reference for the updated packages.
1
Initialize Turnkey
2
Configure the Sub Organization for the User
3
Call createSubOrganization from your backend
subOrganization is created.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
This example demonstrates how to create a sub organization using just an end-user’s email: passkeys not required! Note that this flow does not require emails to be verified.
⚠️ This example is outdated !
Head over to SDK Reference for the updated packages.
Initialize Turnkey
import { Turnkey } from "@turnkey/sdk-browser";
const turnkey = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
});
Configure the Sub Organization for the User
import { DEFAULT_ETHEREUM_ACCOUNTS } from "@turnkey/sdk-browser;"
const subOrganizationConfig = {
subOrganizationName: <subOrganizationName>,
rootUsers: [{
userName: <userEmail>,
userEmail: <userEmail>,
apiKeys: [],
authenticators: [],
oauthProviders: []
}],
rootQuorumThreshold: 1,
wallet: {
walletName: <walletName>,
accounts: DEFAULT_ETHEREUM_ACCOUNTS
}
};
Call createSubOrganization from your backend
await turnkey.serverSign("createSubOrganization", [subOrganizationConfig]);
subOrganization is created.Was this page helpful?