Skip to main content

Overview

@0xkey-io/sdk-server signs requests to the 0xkey API with your organization’s API keypair. Use it for:
  • Backend automation (wallets, policies, users)
  • Proxies that sign specific user-initiated activities with the parent org key (sub-org creation, email auth, OTP)
  • Next.js Server Actions exported as server.* helpers
The package also re-exports @0xkey-io/http for lower-level typed requests.
Company Wallets and delegated access backends typically use this package (or the Go SDK). Embedded Wallets in React should still use React Wallet Kit on the client; use sdk-server only where you need a trusted backend.

Installation


Initializing

defaultOrganizationId
string
required
Root organization ID for requests unless overridden per call.
apiBaseUrl
string
required
Public API base URL. Use https://api.0xkey.com with local-gateway during dev.
apiPrivateKey
string
required
API private key (never expose to the browser).
apiPublicKey
string
required
API public key registered in the Dashboard for the private key above.

Creating clients

API calls must be stamped. With the server SDK, stamping uses your API keypair.

apiClient()

Returns a typed client that signs every request with the configured API credentials.
Create wallets with helper constants:
Runnable sample: examples/with-sdk-server.

API proxies

Some user flows must be signed by the parent organization (for example createSubOrganization, emailAuth, initOtp). You can implement routes yourself with apiClient(), or use built-in proxy handlers. Default allowed proxy methods: oauth, createReadWriteSession, createSubOrganization, emailAuth, initUserEmailRecovery

Express

Next.js Pages Router

Restrict allowedMethods to the smallest set your frontend needs.

Server Actions (server.*)

The package exports helpers for common auth flows (usable from Next.js "use server" modules or your own backend): Example OTP initiation:
Pair with @0xkey-io/core or @0xkey-io/react-wallet-kit on the client for session stamping. See Email authentication and Backend setup.

Examples