Skip to navigation

Session Keys

Let a short lived key trade for an account without ever holding withdrawal rights

A session key is a Stark key pair your app generates and the account owner authorizes once, by signing a session grant with their wallet. Until the grant expires or is revoked, the session key can sign in, read the account, deposit into it and trade within the scopes the grant lists. It can never withdraw or transfer funds, and it can never manage keys, tokens or other sessions, or register passkeys.

Session keys and passkeys are rolling out gradually, so access may be limited during rollout. A request from an account that does not have access yet returns 403 SESSIONS_DISABLED.

When to use a session key

You want toUse
Trade from a browser app with one wallet prompt, then no further prompts until the session endsSession key
Let a trading bot or script trade your account without holding your main private keySession key
Open a session on a device again later without a wallet, using Face ID, Touch ID or a security keyPasskey
Trade from a long running server process you manage yourself, with keys you rotate by handSubkey
Read account data onlyReadonly token

Compared with a subkey, a session key:

  • is authorized by a signed message, not registered through a JWT session of the main key;
  • always expires, at a time the owner signs;
  • carries explicit scopes, so it can be held to trading only, or trading plus trading settings;
  • can be revoked by the owner, by the session itself on sign out, or all at once;
  • can be held by the owner to an IP allowlist that the session cannot change.

How it works

1

Generate a session key

Your app generates a fresh Stark key pair. The private key never leaves your app.

2

The owner signs a grant

You build a SessionGrant that names the account, the session public key, the scopes and the expiry. The account owner signs it once: EVM owned accounts sign it as EIP-712 typed data, Starknet owned accounts sign it as SNIP-12 typed data with the main key.

3

Open the session

You send the grant and its signature to POST /v2/sessions. The signature is the authentication, so no JWT is needed. The response returns the grant_id that names the session from then on. For an EVM wallet with no Paradex account yet, this first grant opens the account too.

4

Sign in with the session key

The session key gets a JWT for each account the grant covers through POST /v1/auth/{public_key}, exactly as a subkey does, and signs orders the same way. Session JWTs are held to the grant’s scopes on every request.

5

End the session

The session ends at its expiry, or earlier when it is revoked. Clients that see their session JWT refused can check its status without authenticating.

Key terms

TermMeaning
OwnerThe key that controls the account: the EVM wallet for EVM owned accounts, the main Stark key otherwise. Only the owner can sign a grant.
Session grantThe SessionGrant typed data message the owner signs. It is stored exactly as signed.
Session keyThe Stark key pair the grant authorizes. Each grant needs a key that has never been used on the account before.
Grant idThe hash of the signed grant, 0x followed by 64 lowercase hex characters. It identifies the session in every /v2/sessions route.
ScopesWhat the session may do beyond reading. See Scopes.
Main key sessionA JWT the account obtained with its own key, as opposed to a session key, subkey or API token. Some routes accept only this.

What a session can never do

Whatever its scopes, a session cannot:

  • withdraw or transfer funds, or move funds out of the account in any form;
  • create, list or revoke subkeys, API tokens or other sessions, or change any session’s IP allowlist;
  • create subaccounts;
  • register a passkey, or list or revoke any passkey other than the one that opened it;
  • change the profile, username, referral settings or compliance answers;
  • act on behalf of another account with on_behalf_of_account;
  • use a JWT that authorizes accounts other than the one it was minted for.

A session can deposit into its own account, but nothing else that moves value. See Scopes for the full table, including the rules for RFQs and block trades.

Pages in this section