GET
/
getTradingSettings
/
{chain}
/
{userId}
Get User Trading Settings
curl --request GET \
  --url http://localhost:2400/getTradingSettings/{chain}/{userId} \
  --header 'Authorization: Bearer <token>'
{
  "userID": "user-123",
  "slippage": 1.5,
  "gasPreset": "medium",
  "maxGasPrice": 100,
  "mevProtection": true,
  "autoBuy": false,
  "autoSell": false,
  "_id": "settingsId...",
  "createdAt": "2023-03-15T10:00:00.000Z",
  "updatedAt": "2023-03-18T12:00:00.000Z"
}

Endpoint

GET /getTradingSettings/{chain}/{userId}

Description

Fetches the user-specific trading settings for a given blockchain network (Ethereum, Base, or Solana). These settings include parameters like default slippage, gas presets, risk management options, etc., used when placing trades through the platform’s MLO or GPM systems.

Authentication

Requires a valid JWT token passed via cookies.

Path Parameters

ParameterTypeRequiredDescriptionExample
chainstringYesThe blockchain network (‘eth’, ‘base’, ‘sol’).base
userIdstringYesThe ID of the user whose settings are requested.user-123

Success Response (200 OK)

Returns the trading settings object for the specified user and chain. If no settings exist, default settings are created and returned.
Example (Base Settings)
{
  "userID": "user-123",
  "slippage": 1.5, // Default slippage percentage
  "gasPreset": "medium",
  "maxGasPrice": 100, // Max Gwei (for ETH/Base)
  "mevProtection": true,
  "autoBuy": false,
  "autoSell": false,
  // ... other Base-specific settings
  "_id": "settingsId...",
  "createdAt": "2023-03-15T10:00:00.000Z",
  "updatedAt": "2023-03-18T12:00:00.000Z"
}

Error Response (400 Bad Request)

Indicates an invalid chain parameter was provided.
Example
{
  "error": "Invalid chain specified"
}

Error Response (401 Unauthorized)

Indicates that no valid JWT token was provided or the token is expired.
Example
{
  "error": "No access token provided"
}

Error Response (403 Forbidden)

Indicates the authenticated user (from JWT) is trying to access settings for a different userId.
Example
{
  "error": "Forbidden: Access denied"
}

Error Response (404 Not Found)

Indicates the specified userId does not exist.
Example
{
  "error": "User not found"
}

Error Response (500 Internal Server Error)

Indicates a server-side error occurred while fetching or creating settings.
Example
{
  "error": "Server error fetching trading settings",
  "details": "Database query timed out"
}

Notes

  • This endpoint is handled by the User server (Port 5000).
  • Retrieves data from the appropriate settings collection (EthereumTradingSettings, BaseTradingSettings, or SolanaTradingSettings) based on the chain parameter.
  • If settings for the user/chain don’t exist, default settings are created in the database and returned.
  • Ensures the authenticated user matches the requested userId.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

chain
enum<string>
required

The blockchain network ('eth', 'base', 'sol').

Available options:
eth,
base,
sol
userId
string
required

The ID of the user.

Response

200
application/json

Successful retrieval of trading settings for the specified user and chain.

The response is of type object.