---
title: "private/set_session_key_debug"
method: POST
path: "/private/set_session_key_debug"
tags: ["Session Keys"]
---

# private/set_session_key_debug

`POST /private/set_session_key_debug`

## Request

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

Takes the same params as private/set_session_key and rebuilds the session-key Action without executing anything, returning the EIP-712 encoded_data, encoded_data_hashed, action_hash, typed_data_hash, domain_separator, action_typehash, module, owner and expected_signer, plus the decoded session key, expiry, protocol scopes and subaccounts. Byte-compare these against your local computation to find why a signature is rejected. Requires a logged-in session.

## Request body

- SetSessionKeyRequest: 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 `200`

Success

- SetSessionKeyDebugResponse: Debug-route payload for one rebuilt action: the EIP-712 hashes plus the action input fields.
  - `action_hash` string, required: EIP-712 struct hash of the `Action`: `keccak256(abi.encode(action_typehash, …, encoded_data_hashed, …))`.
  - `action_typehash` string, required: `ACTION_TYPEHASH` — keccak of the `Action` struct type string; invariant across deployments.
  - `domain_separator` string, required: EIP-712 domain separator of the Matching contract for this deployment.
  - `encoded_data` string, required: ABI-encoded, module-specific action payload (the `data` bytes), 0x-hex.
  - `encoded_data_hashed` string, required: `keccak256(encoded_data)` — the value packed into the struct hash.
  - `expected_signer` string, required: The signer the signature is checked against.
  - `input_data` SetSessionKeyActionInputData, required: The rebuilt `Action` envelope and its decoded module-specific `data`.
    - `data` SetSessionKeyActionDataResponse, required
      - `expiry_sec` integer, required
      - `scopes` string[], required: Protocol scope wire strings (e.g. `"trade:orderbook:all"`).
      - `session_key` string, required
      - `subaccounts` integer[], required
    - `expiry` integer, required
    - `module` string, required
    - `nonce` string, required
    - `owner` string, required
    - `signer` string, required
    - `subaccount_id` integer, required
  - `module` string, required: Per-action module contract address bound into the signed struct.
  - `owner` string, required: Wallet that owns the subaccount the action applies to.
  - `recovered_signer` string, nullable: null on the debug routes (no signature is checked there); on a signature-mismatch error this is the address actually recovered.
  - `typed_data_hash` string, required: Final EIP-712 digest the client signs: `keccak256(0x1901 || domain_separator || action_hash)`.

## Other responses

- `default`: JSON-RPC error (see Error Codes)

## Changes

- **2026-10-20** `0c500202be49`: 2 info
  - the endpoint scheme security `DeriveWallet AND DeriveTimestamp AND DeriveSignature` was added to the API
  - added the media type `application/json` for the response with the status `default`

[Operation history](https://skmtc.dev/lyra/apis/derive-v3-api/changes/private/set_session_key_debug/post.md)

---

[API](https://skmtc.dev/lyra/apis/derive-v3-api.md) - [All operations](https://skmtc.dev/lyra/apis/derive-v3-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lyra/apis/derive-v3-api/revisions/415f8a73b10c?raw)
