Prerequisites
You also need:- A platform configured with
USDBin its supported currencies. In sandbox, USDB is enabled by default alongsideUSDandUSDC. - Sandbox or production API credentials with access to the
Embedded Wallet AuthandInternal Accountsendpoints.
Walkthrough
The walkthrough below is the happy path: create a customer, find the auto-provisioned account and its default email OTP credential, fund it, and withdraw to a bank account. Each step shows the HTTP request your integrator backend makes on behalf of the client.1. Create a customer
Create the customer record. A Global Account is provisioned automatically whenever a customer is created on a platform that hasUSDB in its supported currencies — you don’t need to pass it on the customer.
201 Created with the new Customer:... id. In sandbox, the customer is KYC-approved immediately; in production you would now run them through the KYC / KYB flow before any funds can move.
2. Find the Global Account
When a customer is created on a USDB-enabled platform, Grid automatically provisions a Global Account alongside their other internal accounts. Fetch it by filtering the customer’s internal accounts bytype=EMBEDDED_WALLET.
InternalAccount:... id — every auth credential is scoped to it.
3. Find the default email OTP credential
Global Accounts are initialized with anEMAIL_OTP credential tied to the customer email on file. Fetch the auth methods for the account and keep the AuthMethod:... id for the signing step later in this walkthrough.
4. Fund the Account
Global Accounts behave like any other internal account on the way in — incoming funds do not need the customer’s signature. In sandbox, use the sandbox funding endpoint to skip straight to a funded state:amount is in the smallest unit of the account’s currency. USDB has 6 decimals, so 1000000000 is 1,000.00 USDB.
You will receive an INCOMING_PAYMENT webhook when the balance updates. The account now holds 1,000.00 USDB.
5. Add an external bank account
Add the destination the customer wants to withdraw to. This is a standard external account — nothing Global Account-specific.201 Created with the new ExternalAccount:... id.
6. Create a withdrawal quote
Create a quote with the Global Account as the source. Grid returns apayloadToSign in the quote’s payment instructions — this is what the client will sign to authorize the transfer.
lockedCurrencyAmount is in the smallest unit of the locked side’s currency. Here the sending currency is USDB (6 decimals), so 10000000 is 10.00 USDB.
Response:
7. Authenticate and sign
The customer has an outstanding quote with apayloadToSign. Now we need a session signing key to sign it with. The flow is keypair → OTP challenge → verify → decrypt → sign.
1
Your backend requests a fresh OTP
Ask Grid to send a fresh OTP email for the default Response (200):
EMAIL_OTP credential.2
Client enters the OTP and generates a key pair
The client generates a fresh P-256 client key pair and posts the public key plus the OTP value to your backend. Grid uses the public key to seal the session signing key to that device.
3
Your backend verifies the OTP with Grid to mint a session
encryptedSessionSigningKey and expiresAt to the client.4
Client decrypts the session signing key and stamps the payload
The client decrypts
encryptedSessionSigningKey with the matching client private key, then stamps the quote’s payloadToSign with the resulting session signing key. Return the full Turnkey API-key stamp to your backend./challenge + /verify round-trip.
8. Execute the quote
Call/execute with the stamp in the Grid-Wallet-Signature header.
OUTGOING_PAYMENT) as it settles — see Transaction lifecycle.
Where to next
Client keys & signing
Generate the P-256 key pair, decrypt the session signing key, and sign payloads on Web, iOS, and Android.
Authentication
OAuth and Email OTP flows, passkey reauthentication, and the full WebAuthn parameter mapping.
Sessions
List, refresh, and revoke active sessions.
Exporting a wallet
Let a customer take their wallet seed off Grid.