Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tkhq/sdk/llms.txt
Use this file to discover all available pages before exploring further.
@turnkey/http is a lower-level, fully typed HTTP client for interacting with the Turnkey API. It gives you direct access to every Turnkey endpoint with complete TypeScript types for all inputs and responses.
Installation
TurnkeyClient
TurnkeyClient is the main class exported from @turnkey/http. It accepts a configuration object and a stamper, then exposes typed async methods for every Turnkey API endpoint.
Constructor
Configuration object for the client.
A stamper instance that signs outgoing requests. Turnkey provides two stampers:
ApiKeyStamperfrom@turnkey/api-key-stamper— signs with a P-256 API key pairWebAuthnStamperfrom@turnkey/webauthn-stamper— signs with a passkey or WebAuthn device
TStamper interface ({ stamp: (input: string) => Promise<TStamp> }) is accepted.Usage example
Key methods
Every method onTurnkeyClient follows the same pattern: it accepts a typed input object and returns a typed response. For each endpoint, there is also a corresponding stamp* method that produces a signed request without sending it — useful for proxy scenarios.
Read methods
| Method | Description |
|---|---|
getWhoami(input) | Returns the user and organization associated with the current credentials |
getWallets(input) | Lists all wallets in an organization |
getWallet(input) | Returns details for a single wallet |
getWalletAccounts(input) | Lists all accounts derived from a wallet |
getWalletAccount(input) | Returns details for a single wallet account |
getPrivateKeys(input) | Lists all raw private keys in an organization |
getPrivateKey(input) | Returns details for a single private key |
getActivity(input) | Returns the current state of an activity by ID |
getActivities(input) | Lists activities for an organization |
getOrganizationConfigs(input) | Returns configuration for an organization |
getUser(input) | Returns details for a single user |
getPolicies(input) | Lists all policies in an organization |
Mutation methods
All mutation endpoints are asynchronous and return an activity object. The activity’s
status field starts as ACTIVITY_STATUS_PENDING and must be polled to completion. See Activity Polling for details.The exceptions are private key signing endpoints (signTransaction, signRawPayload, signRawPayloads), which complete synchronously.| Method | Description |
|---|---|
createWallet(input) | Creates an HD wallet and derives the first account |
createWalletAccounts(input) | Derives additional accounts from an existing wallet |
createPrivateKeys(input) | Creates one or more raw private keys |
createSubOrganization(input) | Creates a sub-organization under the current org |
signTransaction(input) | Signs a transaction — completes synchronously |
signRawPayload(input) | Signs an arbitrary payload — completes synchronously |
signRawPayloads(input) | Batch-signs multiple payloads — completes synchronously |
createApiKeys(input) | Adds API key authenticators to a user |
createUsers(input) | Creates users within an organization |
deleteUsers(input) | Removes users from an organization |
createPolicy(input) | Creates an access control policy |
exportWallet(input) | Initiates a wallet mnemonic export |
importWallet(input) | Initiates a wallet mnemonic import |
exportPrivateKey(input) | Initiates a private key export |
importPrivateKey(input) | Initiates a private key import |
Stamp methods
For every method above, a correspondingstamp* method is available. It signs the request without sending it, returning a TSignedRequest:
Exported types and utilities
TStamper interface
If you need to build a custom stamper, implement theTStamper interface:
TurnkeyRequestError
When the Turnkey API returns a non-2xx response,TurnkeyClient throws a TurnkeyRequestError: