Skip to navigation

Manage Sessions

List, read, revoke and check the status of sessions
RouteWho can call it
GET /v2/sessionsThe owner’s main key session
GET /v2/sessions/{grant_id}The owner’s main key session, or the session itself
DELETE /v2/sessions/{grant_id}The owner’s main key session, or the session itself
DELETE /v2/sessionsThe owner’s main key session
PUT /v2/sessions/{grant_id}/ip-allowlistThe owner’s main key session
GET /v2/sessions/{grant_id}/statusAnyone, no authentication

A main key session is a JWT the account obtained with its own key. JWTs from subkeys, readonly tokens and other sessions are refused on routes reserved for the owner.

The session object

FieldTypeDescription
grant_idstringThe grant id
statestringactive, revoked or expired
labelstringThe label from the grant
sourcestringWhat opened the session: app, builder (a grant that approves a builder), passkey or api
passkey_credential_idstringThe credential id of the passkey that opened the session. Only present when source is passkey.
builderobject or null{ "account", "name", "max_fee_rate" } for a grant that approves a builder, otherwise null. name may be null.
scopesstring[]The scopes from the grant
limitsobjectThe limits exactly as the grant states them: max_order_notional, max_open_notional, daily_notional, max_loss, max_leverage and markets
accountsstring[]Every account the session covers
allowed_cidrsstring[]The owner’s IP allowlist for the session. Empty means any IP. It is not part of the signed grant.
issued_atintegerWhen the owner signed the grant, in milliseconds
expires_atintegerWhen the session expires, in milliseconds
revoked_atintegerWhen the session was revoked, in milliseconds, or 0
open_order_countintegerThe session’s resting orders and untriggered stops, for display. Only on the first page of GET /v2/sessions, for an active or revoked session, and absent when unknown. May be limited during rollout.
{
"grant_id": "0x5f1c0a4e2b7d9e3f6a8c1b0d2e4f6a8c0b2d4e6f8a0c2e4b6d8f0a2c4e6b8d0f",
"state": "active",
"label": "My trading app",
"source": "app",
"builder": null,
"scopes": ["trade"],
"limits": {
"max_order_notional": "none",
"max_open_notional": "none",
"daily_notional": "none",
"max_loss": "none",
"max_leverage": "none",
"markets": ["*"]
},
"accounts": ["0x<account>"],
"allowed_cidrs": [],
"issued_at": 1767225600000,
"expires_at": 1767830400000,
"revoked_at": 0
}

List sessions

GET /v2/sessions
Authorization: Bearer <main key JWT>

Returns the owner’s sessions in every state, newest first, with cursor pagination.

Query parameterDescription
stateOnly return sessions in this state: active, revoked or expired
page_sizeResults per page. Defaults to 50, at most 200.
cursorThe next or prev cursor from a previous page

Response 200: { "results": [ <session>, ... ], "next": "...", "prev": "..." }

Returns 403 when the caller is not the owner’s main key session.

Get a session

GET /v2/sessions/{grant_id}
Authorization: Bearer <JWT>

Returns one session object. The owner’s main key session can read any of its sessions, and a session can read itself. Any other caller gets 404, whether or not the grant exists.

Revoke a session

DELETE /v2/sessions/{grant_id}?cancel_orders=true
Authorization: Bearer <JWT>

Revokes the session on every account it covers, and its JWTs stop working. The owner’s main key session can revoke any of its sessions; a session can revoke itself, which is how an app signs out. Revoking a session that is already revoked succeeds.

Query parameterDescription
cancel_orderstrue to also cancel the session’s resting orders and the open RFQs it created. Defaults to false.

What happens to the session’s orders:

Revoked byResting ordersTWAPs and untriggered stops
The ownerKept, unless cancel_orders=trueCanceled
The session itselfKept, unless cancel_orders=trueKept working, unless cancel_orders=true. A session whose grant approves a builder cancels them.

Revoking a session does not revoke the builder approval its grant carried.

Without cancel_orders, the RFQs the session created stay open. The revoked session can no longer execute them, but the owner can, and can cancel them with DELETE /v1/rfqs/{rfq_id}.

The Paradex app’s own sign out sends no cancel_orders, so orders placed from the app keep working after you sign out. Both SDKs send cancel_orders=true by default, since a revoked session key can no longer cancel its own orders.

Response 204 with no body.

StatusMeaning
403The caller is another session or key on one of the session’s accounts
404The grant id is malformed or unknown, or the caller has no relation to the session

A 5xx can come after the grant is already revoked, before the server cancels its orders. The session key can no longer retry, so the owner retries with cancel_orders=true, which cancels the orders even though the grant is already revoked.

Revoke all sessions

DELETE /v2/sessions?cancel_orders=true
Authorization: Bearer <main key JWT>

Revokes every session the owner has opened, on every account each one covers. Each session’s WebSocket connections are closed, and its TWAPs and untriggered stops are canceled. Pass cancel_orders=true to also cancel their resting orders.

Response 204 with no body. Returns 403 when the caller is not the owner’s main key session.

Set a session’s IP allowlist

PUT /v2/sessions/{grant_id}/ip-allowlist
Authorization: Bearer <main key JWT>
Content-Type: application/json
{ "allowed_cidrs": ["203.0.113.0/24", "198.51.100.42/32"] }

Replaces the session’s IP allowlist on every account it covers. Once the list has any entries, sign in and every request made with the session must come from an IP inside it:

  • REST requests and POST /v1/auth/{public_key} from any other IP return 403 IP_NOT_ALLOWED;
  • over WebSocket, sign in and order requests from any other IP are refused, and open connections from outside the new list are closed with code 4035, which triggers cancel on disconnect for those connections.

The change takes effect within seconds. Only the owner’s main key session can set the list, so a session can never widen its own.

FieldTypeDescription
allowed_cidrsstring[]Required. The full replacement list of IPv4 or IPv6 CIDRs, at most 50. Send [] to lift the restriction.

Response 200: the updated session object.

StatusErrorMeaning
400INVALID_REQUEST_PARAMETERallowed_cidrs is missing, has more than 50 entries, or holds an invalid CIDR
403INVALID_TOKEN_SCOPEThe caller is a session
403UNAUTHORIZED_ERRORThe caller is a subkey, readonly token or other JWT that is not the owner’s main key session
403SESSIONS_DISABLEDSessions are not available for this account yet
404NOT_FOUNDThe grant id is unknown or belongs to another owner
409SESSION_REVOKEDThe session is revoked

A 5xx response means the list may have been stored without taking effect everywhere. Send the same request again.

Check a session’s status

GET /v2/sessions/{grant_id}/status

Takes no JWT and returns only the session’s state, nothing about the owner, the accounts or the grant’s terms.

Response 200

{ "state": "active" }

state is active, revoked or expired. An unknown or malformed grant id returns 404, which a client should treat the same as revoked.

Use it when a session JWT or /auth call is refused: if the state is revoked or expired, drop the session key and its JWTs for every account and stop reconnecting. Any other answer means the refusal was not caused by the session ending, so retry with a short backoff. A 403 on an ordinary call is a refused action, usually a missing scope, and never means the session has ended. Both SDKs follow this rule.

The route is rate limited per IP like other public endpoints, so call it on a refusal rather than polling it.