---
updatedAt: 2025-09-22T22:40:02.000Z
agentTools:
  projectIndex: https://bluefin-exchange.readme.io/llms.txt
---

# /account

Retrieves the user's account details.

## Client Library

```python Python
#!/usr/bin/env python

import asyncio
import logging

from bluefin_pro_sdk import BluefinProSdk, Environment, RpcUrl
from crypto_helpers.signature import SuiWallet

# Set up logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)


async def main():
    """
    Example showing how to fetch a user's account details from the Bluefin Pro API
    using the PRODUCTION environment.
    """
    # Create a wallet with your private key
    sui_wallet = SuiWallet(
        mnemonic="dilemma salmon lake ceiling moral glide cute that ginger float area aunt vague remind cage mother concert inch dizzy present proud program time urge"
    )

    log.info(f"Using wallet address: {sui_wallet.sui_address}")

    # Initialize the Bluefin Pro SDK client with PRODUCTION environment and RPC
    async with BluefinProSdk(
            sui_wallet=sui_wallet,
            contracts=None,  # Not needed for this example
            rpc_url=RpcUrl.PROD,
            env=Environment.PRODUCTION,
            debug=False  # Set to True for more verbose output
    ) as client:
        try:
            # Initialize the client, which will handle authentication
            await client.init()

            # Get user's account details
            response = await client.account_data_api.get_account_details()

            # Log the response
            log.info("Account Details Information:")
            log.info(f"{response=}")

            # Return the response for further use if needed
            return response

        except Exception as e:
            log.error(f"Error fetching exchange info: {e}")
            raise


if __name__ == "__main__":
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        log.info("Exiting due to keyboard interrupt")

```
```rust Rust
use bluefin_api::apis::account_data_api::get_account_details;
use bluefin_api::apis::configuration::Configuration;
use bluefin_api::models::Account;
use bluefin_api::models::LoginRequest;
use bluefin_pro::prelude::*;
use chrono::Utc;
use hex::FromHex;
use sui_sdk_types::SignatureScheme;

type Error = Box<dyn std::error::Error>;
type Result<T> = std::result::Result<T, Error>;

/// Sends a request for account details, and returns the deserialized response.
async fn send_request(auth_token: &str) -> Result<Account> {
    println!("Sending request...");
    let response = get_account_details(
        &Configuration {
            base_path: account::mainnet::URL.into(),
            bearer_access_token: Some(auth_token.into()),
            ..Configuration::new()
        },
        Some("INSERT_ACCOUNT_ADDRESS_HERE"),
    )
    .await?;
    Ok(response)
}

#[tokio::main]
async fn main() -> Result<()> {
    let login_request = LoginRequest::new(
        "INSERT_ACCOUNT_ADDRESS_HERE",
        Utc::now().timestamp_millis(),
        auth::mainnet::AUDIENCE.into(),
    );

    let signature = login_request.signature(
        SignatureScheme::Ed25519,
        PrivateKey::from_hex("INSERT_HEX_ENCODED_PRIVATE_KEY_HERE")?,
    )?;

    let auth_token = login_request
        .authenticate(&signature, Environment::Mainnet)
        .await?
        .access_token;

    let account = send_request(&auth_token).await?;

    Ok(())
}

```

## HTTPs

Alternatively, call the GET /account endpoint using the integrated editor on the right or locally from any language supporting HTTPs network calls.

## Request & Response

# OpenAPI definition

```json
{
  "openapi": "3.0.3",
  "info": {
    "title": "Bluefin Account Data API",
    "version": "v1",
    "description": "All numeric quantities are represented as string in e9 format.\n"
  },
  "servers": [
    {
      "url": "https://api.{env}.bluefin.io",
      "variables": {
        "env": {
          "default": "sui-staging",
          "enum": [
            "sui-staging",
            "sui-prod"
          ]
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Account Data",
      "description": "Account Data Service"
    }
  ],
  "paths": {
    "/api/v1/account": {
      "get": {
        "tags": [
          "Account Data"
        ],
        "operationId": "getAccountDetails",
        "summary": "/account",
        "description": "Retrieves the user's account details.",
        "security": [],
        "parameters": [
          {
            "name": "accountAddress",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Account address to fetch account details by."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with account details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                }
              }
            }
          },
          "400": {
            "description": "request missing required parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "account not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Account": {
        "type": "object",
        "required": [
          "tradingFees",
          "canTrade",
          "canDeposit",
          "canWithdraw",
          "crossEffectiveBalanceE9",
          "crossMarginRequiredE9",
          "totalOrderMarginRequiredE9",
          "marginAvailableE9",
          "crossMaintenanceMarginRequiredE9",
          "crossMaintenanceMarginAvailableE9",
          "crossMaintenanceMarginRatioE9",
          "crossLeverageE9",
          "crossUnrealizedPnlE9",
          "totalUnrealizedPnlE9",
          "crossUnrealizedLossE9",
          "crossAccountValueE9",
          "totalAccountValueE9",
          "updatedAtMillis",
          "assets",
          "positions",
          "authorizedAccounts",
          "authorizedWallets",
          "accountAddress"
        ],
        "properties": {
          "groupId": {
            "type": "string",
            "description": "The (optional) group ID of the account.\nAccounts belonging to the same group cannot trade against each other.\n",
            "example": "group1"
          },
          "tradingFees": {
            "$ref": "#/components/schemas/TradingFees"
          },
          "canTrade": {
            "type": "boolean",
            "description": "If the user can trade.",
            "example": true
          },
          "canDeposit": {
            "type": "boolean",
            "description": "If the current user can deposit to the account.",
            "example": true
          },
          "canWithdraw": {
            "type": "boolean",
            "description": "If the current user can withdraw from the account.",
            "example": false
          },
          "crossEffectiveBalanceE9": {
            "type": "string",
            "description": "Total effective balance in USD (e9 format).",
            "example": "12000000000000"
          },
          "crossMarginRequiredE9": {
            "type": "string",
            "description": "The sum of initial margin required across all cross positions (e9 format).",
            "example": "1000000000"
          },
          "totalOrderMarginRequiredE9": {
            "type": "string",
            "description": "The sum of initial margin required across all open orders (e9 format).",
            "example": "1000000000"
          },
          "marginAvailableE9": {
            "type": "string",
            "description": "The amount of margin available to open new positions and orders (e9 format).",
            "example": "1000000000"
          },
          "crossMaintenanceMarginRequiredE9": {
            "type": "string",
            "description": "The sum of maintenance margin required across all cross positions (e9 format).",
            "example": "5000000000"
          },
          "crossMaintenanceMarginAvailableE9": {
            "type": "string",
            "description": "The amount of margin available before liquidation (e9 format).",
            "example": "1000000000"
          },
          "crossMaintenanceMarginRatioE9": {
            "type": "string",
            "description": "The ratio of the maintenance margin required to the account value (e9 format).",
            "example": "1000000000"
          },
          "crossLeverageE9": {
            "type": "string",
            "description": "The leverage of the account (e9 format).",
            "example": "1000000000"
          },
          "totalUnrealizedPnlE9": {
            "type": "string",
            "description": "Total unrealized profit (e9 format).",
            "example": "2000000000"
          },
          "crossUnrealizedPnlE9": {
            "type": "string",
            "description": "Unrealized profit of cross positions (e9 format).",
            "example": "2000000000"
          },
          "crossUnrealizedLossE9": {
            "type": "string",
            "description": "An implicitly negative number that sums only the losses of all cross positions.",
            "example": "1000000000"
          },
          "crossAccountValueE9": {
            "type": "string",
            "description": "The total value of the cross account, combining the cross effective\nbalance and unrealized PnL across all cross positions, and subtracting any pending\nfunding payments on any cross position.\n",
            "example": "1000000000"
          },
          "totalAccountValueE9": {
            "type": "string",
            "description": "The total value of the account, combining the total effective\nbalance and unrealized PnL across all positions, and subtracting any pending\nfunding payments on any position.\n",
            "example": "1000000000"
          },
          "updatedAtMillis": {
            "type": "integer",
            "format": "int64",
            "description": "Last update time in milliseconds since Unix epoch.",
            "example": 1627872345678
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Asset"
            }
          },
          "positions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Position"
            }
          },
          "authorizedAccounts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "deprecated": true,
            "description": "Deprecated: Replaced with authorizedWallets."
          },
          "accountAddress": {
            "type": "string",
            "description": "The address of the account.",
            "example": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcde"
          },
          "authorizedWallets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuthorizedWallet"
            },
            "description": "The wallets that are authorized to trade on behalf of the current account."
          }
        }
      },
      "AuthorizedWallet": {
        "type": "object",
        "required": [
          "address",
          "authorizedAtMillis"
        ],
        "properties": {
          "address": {
            "type": "string",
            "description": "The address of the authorized wallet."
          },
          "alias": {
            "type": "string",
            "description": "The alias of the authorized wallet."
          },
          "authorizedAtMillis": {
            "type": "integer",
            "format": "int64",
            "description": "The timestamp in milliseconds when the wallet was authorized."
          }
        }
      },
      "Position": {
        "type": "object",
        "required": [
          "symbol",
          "avgEntryPriceE9",
          "clientSetLeverageE9",
          "liquidationPriceE9",
          "markPriceE9",
          "notionalValueE9",
          "sizeE9",
          "unrealizedPnlE9",
          "side",
          "marginRequiredE9",
          "maintenanceMarginE9",
          "isIsolated",
          "updatedAtMillis",
          "isolatedMarginE9",
          "fundingRatePaymentAllTimeE9",
          "fundingRatePaymentSinceChangeE9",
          "fundingRatePaymentSinceOpenedE9"
        ],
        "properties": {
          "symbol": {
            "type": "string",
            "description": "Market address."
          },
          "avgEntryPriceE9": {
            "type": "string",
            "description": "Average entry price determined by a simple average of all entry prices resulting in this position size (e9 format).",
            "example": "400000000000"
          },
          "clientSetLeverageE9": {
            "type": "string",
            "description": "Isolated position leverage (e9 format).",
            "example": "100000000000"
          },
          "liquidationPriceE9": {
            "type": "string",
            "description": "Liquidation price (e9 format).",
            "example": "0"
          },
          "markPriceE9": {
            "type": "string",
            "description": "Mark price (e9 format).",
            "example": "667950671178"
          },
          "notionalValueE9": {
            "type": "string",
            "description": "Notional value (e9 format).",
            "example": "0"
          },
          "sizeE9": {
            "type": "string",
            "description": "Position size (e9 format).",
            "example": "100000000"
          },
          "unrealizedPnlE9": {
            "type": "string",
            "description": "Unrealized profit (e9 format).",
            "example": "-1000000000"
          },
          "side": {
            "$ref": "#/components/schemas/PositionSide"
          },
          "marginRequiredE9": {
            "type": "string",
            "description": "Initial margin required with current mark price (e9 format).",
            "example": "0"
          },
          "maintenanceMarginE9": {
            "type": "string",
            "description": "Maintenance margin required with current mark price (e9 format).",
            "example": "0"
          },
          "isIsolated": {
            "type": "boolean",
            "description": "If the position is isolated.",
            "example": true
          },
          "isolatedMarginE9": {
            "type": "string",
            "description": "Margin value present if margin type is isolated (e9 format).",
            "example": "1000000000"
          },
          "updatedAtMillis": {
            "type": "integer",
            "format": "int64",
            "description": "Last update time.",
            "example": 1733899435274
          },
          "fundingRatePaymentAllTimeE9": {
            "type": "string",
            "description": "Total funding rate payment (e9 format).",
            "example": "0"
          },
          "fundingRatePaymentSinceChangeE9": {
            "type": "string",
            "description": "Funding rate payment since last position change (e9 format).",
            "example": "0"
          },
          "fundingRatePaymentSinceOpenedE9": {
            "type": "string",
            "description": "Funding rate payment since position opened (e9 format).",
            "example": "0"
          }
        }
      },
      "PositionSide": {
        "type": "string",
        "description": "The side of the position, either long or short",
        "enum": [
          "LONG",
          "SHORT",
          "UNSPECIFIED"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "description": "A code representing the type of error."
          },
          "message": {
            "type": "string",
            "description": "A human-readable message describing the error."
          }
        },
        "required": [
          "message"
        ]
      },
      "TradingFees": {
        "type": "object",
        "required": [
          "makerFeeE9",
          "takerFeeE9",
          "isApplied"
        ],
        "properties": {
          "makerFeeE9": {
            "type": "string",
            "description": "The Account Maker Fee (e9 format).",
            "example": "1000000"
          },
          "takerFeeE9": {
            "type": "string",
            "description": "The Account Taker Fee (e9 format).",
            "example": "1000000"
          },
          "isApplied": {
            "type": "boolean",
            "description": "Are the fees applied on the account?"
          }
        }
      },
      "Asset": {
        "type": "object",
        "description": "Details about an asset in the account.",
        "properties": {
          "symbol": {
            "type": "string",
            "description": "The symbol of the asset."
          },
          "quantityE9": {
            "type": "string",
            "description": "The quantity of the asset."
          },
          "effectiveBalanceE9": {
            "type": "string",
            "description": "The effective balance of the asset."
          },
          "maxWithdrawQuantityE9": {
            "type": "string",
            "description": "The maximum quantity that can be withdrawn."
          },
          "updatedAtMillis": {
            "type": "integer",
            "format": "int64",
            "description": "The timestamp of the last update in milliseconds."
          }
        },
        "required": [
          "symbol",
          "quantityE9",
          "effectiveBalanceE9",
          "maxWithdrawQuantityE9",
          "updatedAtMillis"
        ]
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```