Skip to main content
Delegated access works by creating a specialized business-controlled user within each end-user’s sub-organization that has carefully scoped permissions to perform only specific actions, such as signing transactions to designated addresses. This can enable your backend to do things like:
  • Automate onchain actions such as staking, redemptions, or limit orders
  • Sign transactions to whitelisted addresses without user involvement
  • Perform scheduled operations (e.g. payouts, rebalances)
  • Respond to specific onchain events programmatically

Implementation flow

You can implement Delegated Access for an embedded wallet in two ways, depending on whether the setup runs from the frontend (recommended) or the backend. This approach uses the end-user’s authenticated session to configure delegated access directly within their sub-organization. The flow is:
  • Create an API-only user (Delegated User) with an API key authenticator that you control. This key can then be used server-side to sign transactions on the user’s behalf.
  • Define policies for the Delegated User that strictly limit which transactions they are allowed to sign.
Why this approach: This avoids temporarily granting the Delegated User root access — see Caution for more details. Since you’re using the client-side authenticated session, the API-only user is created directly as a non-root user within the sub-organization. Advantages:
  • There’s no possibility of elevated (root-level) access for the delegated user.
Limitations:
  • You can’t assume the delegated user or its policies already exist. Before referencing it, you’ll need to call fetchOrCreateP256ApiKeyUser and fetchOrCreatePolicies to ensure the user and permissions are properly set up.
For a detailed step-by-step guide see Client-side Delegated Access setup.

2. Backend

If you prefer to configure delegated access entirely server-side, the flow differs because the end-user in the embedded wallet model does not hold an API key. In this case, you must:
  • Create the sub-organization with two root users: the end-user and your Delegated User (API key authenticator).
  • Use the delegated access API key to add policies explicitly granting the DA user the limited actions you want them to perform.
  • Update the root quorum so that only the end-user remains a root user.

Caution ⚠️

When the delegated access setup is performed from the backend, your service (not the end-user) initiates and approves the sub-organization creation, delegated user addition, and root quorum updates. This means the delegated user is temporarily added to the root quorum without direct end-user consent. If any of these operations fail — particularly the quorum update — the delegated user may unintentionally retain root privileges, effectively gaining unrestricted access to the user’s wallet.
If you adopt this approach, implement strict validation to confirm that:
  • The root quorum was successfully updated; and
  • The delegated user no longer retains unintended permissions once setup completes.
Advantages:
  • Guarantees that the delegated user exists and can perform the required actions without additional setup.
Limitations:
  • Risk of elevated access if the delegated user isn’t successfully removed as a root user, it may retain unintended control.
  • Since all actions are service-initiated, there’s no explicit end-user approval in this flow.
For most end-user applications, it’s recommended to perform delegated access setup client-side, where all actions are explicitly initiated and approved by the user. For a detailed step-by-step guide see Server-side Delegated Access setup. Before going to production, read Securing delegated access to learn how to scope the delegated user’s policies, manage its API keys, and rotate a key in case of a leak.

Frequently asked questions

Yes, in two cases. If the delegated access (DA) user is in the root quorum and can meet its threshold alone, it can create policies unilaterally, because the root quorum isn’t bound by policies. Once it’s removed from the root quorum, it can still create policies if a policy explicitly allows it to. Otherwise, only the root quorum (typically the end user) can change policies.Be careful with a policy that lets the DA user create policies, because the DA user could use it to grant itself broader access. See Securing delegated access.
When the delegated access setup is performed client-side, all actions are initiated and approved by the authenticated end-user within their session. This ensures full transparency and explicit user consent for every operation.
When performed server-side, the setup happens without direct user involvement. This approach is generally used only in enterprise or custodial environments, where your backend manages sub-organizations and delegated users on behalf of end-users.
For typical end-user applications, the client-side setup is the recommended and more secure approach.
Yes — this is a common pattern. You can add a policy per order (limit, stop loss, TWAP, etc.) using either the end-user’s authenticated session or a Delegated Access (DA) user, as long as the DA user has the necessary permissions defined by policy. Prefer the end user’s session, because a DA user that can create policies can grant itself broader access. See Securing delegated access.
The DA user can delete it, if a policy allows it to delete policies (ACTIVITY_TYPE_DELETE_POLICY). Otherwise, deleting it needs the end user’s approval.To avoid cleaning up at all, give the policy a time window. Once the window ends, the policy stops applying. It isn’t deleted, and it doesn’t stop after its first use, so still scope the condition to the order.
In effect, yes. The key difference is that granular policies can restrict what a DA user can do, offering better security hygiene even if there’s still elevated access.
Turnkey’s Policy Engine shines through its flexibility. There are many different approaches you can take based on your requirements, but various themes we see include:
  • Using broad policies with business-controlled API keys
  • Using fine-grained policies, scoped to predictable transaction shapes
  • Using delegated access to implement limit orders, automation flows, or advanced trading logic (e.g. perps, TWAPs)
  • Ensuring strong operational security (e.g. tight scoping & expiring keys) is increasingly common