Skip to main content
Session tokens are best for frontend applications where you need to authenticate users in the browser. Sessions are created by your backend using the project API key, then passed to the client. Sessions expire after a period of inactivity but can be refreshed.
NameTypeRequiredDescription
AuthorizationstringYesBearer token format: Bearer <session_token>

Flow

1

Backend creates a session

Your server calls the session endpoint using the project API key.
2

Pass token to client

Return the session token to the frontend (e.g., via HTTP-only cookie or secure storage).
3

Client makes requests

The frontend sends the token in the Authorization header with each request.

Step 1: Create a session

This is called from your backend using the project API key.
curl -X POST "https://synthesis.trade/api/v1/project/account/{account_id}/session" \
  -H "X-PROJECT-API-KEY: sk_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345678901234="

Step 2: Use the session token

Pass the token from the response as a Bearer token in your client requests.
curl -X GET "https://synthesis.trade/api/v1/wallets" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Refresh a session

Expire the existing session and issue a new one. This extends the user’s authenticated session without requiring them to re-authenticate.
curl -X POST "https://synthesis.trade/api/v1/project/account/{account_id}/session/{session_id}/refresh" \
  -H "X-PROJECT-API-KEY: sk_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345678901234="

Expire a session

Manually expire a specific session or all sessions for an account.
curl -X POST "https://synthesis.trade/api/v1/project/account/{account_id}/session/{session_id}/expire" \
  -H "X-PROJECT-API-KEY: sk_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345678901234="

Available routes

All routes under /api/v1/account/* and /api/v1/wallet/* accept session tokens.
RouteMethodDescription
/api/v1/account/sessionGETGet current session info
/api/v1/walletsGETList wallets
/api/v1/wallet/pol/{id}/orderPOSTPlace an order
/api/v1/wallet/pol/{id}/balanceGETGet wallet balance
/api/v1/wallet/pol/{id}/positionsGETGet positions
All wallet and account endpoints