Session Keys

private/set_session_key

Changed on

Authorizes a new session key for a wallet from a signed action, granting it a set of on-chain (protocol) scopes and off-chain scopes with an expiry, an optional label, an optional IP allowlist, and an optional list of subaccounts it may act on (defaults to all of the wallet's subaccounts). Send the signed action fields (nonce, signer, signature, signature expiry, and module) alongside the requested scopes; the endpoint returns the registered key's public address and its granted scopes, expiry, allowlist, label, and subaccounts.

post/private/set_session_key

Request

  • Base URL
    https://api.derive.xyz/v3
  • Auth
    API key in header X-DeriveWallet and API key in header X-DeriveTimestamp and API key in header X-DeriveSignature

Request body

SetSessionKeyRequest required

Request parameters for registering a scoped session key. Address fields are 0x-prefixed hex strings.

expiry_sec, integer required
ip_whitelist, string[] nullable
label, string nullable
nonce, string required
offchain_scopes, string[] required

Off-chain scopes which are validated in backend only

protocol_scopes, string[] required

Scopes granted to the session key, validated by the protocol. Each is a string like "trade:orderbook:all".

public_session_key, string required

Session key address being authorized.

signature, string required

0x-prefixed hex, 65-byte r||s||v.

signature_expiry_sec, integer required
signer, string required
subaccount_ids, integer[] nullable
wallet, string required

Wallet the session key is being registered for.

Response

Success

PrivateSetSessionKeyResponse required
expiry_sec, integer required
ip_whitelist, string[] required
label, string nullable
offchain_scopes, string[] required
protocol_scopes, string[] required
public_session_key, string required
subaccount_ids, integer[] required

Subaccounts the key may act on. Empty/omitted request (all subaccounts) is expanded to the wallet's current subaccount list.

Changes

    • info

      the endpoint scheme security DeriveWallet AND DeriveTimestamp AND DeriveSignature was added to the API

    • info

      added the media type application/json for the response with the status