Skip to content
Start Trading

Get Account By ID

AccountGetAccountByIdResponse v1().accounts().getAccountById(AccountGetAccountByIdParamsparams = AccountGetAccountByIdParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
GET/v1/accounts/{account_id}

Fetch account details by ID, including the mailing address, date of birth, phone number, and country of tax residency of the account-holder entity when on file.

ParametersExpand Collapse
AccountGetAccountByIdParams params
Optional<Long> accountId
ReturnsExpand Collapse
class AccountGetAccountByIdResponse:

Represents a trading account

long id

The unique identifier for the account

formatint64
long accountHolderEntityId

The account holder entity identifier

formatint64
String fullName

The full legal name of the account

LocalDate openDate

The date the account was opened

formatdate
long optionsLevel

The options level of the account

formatint64
String shortName

The short name of the account

The current status of the account

One of the following:
ACTIVE("ACTIVE")
INACTIVE("INACTIVE")
CLOSED("CLOSED")

The sub-type of account

One of the following:
CASH("CASH")
MARGIN("MARGIN")
OTHER("OTHER")

The type of account

One of the following:
CUSTOMER("CUSTOMER")
OTHER("OTHER")
Optional<LocalDate> closeDate

The date the account was closed, if applicable When a null/undefined value is observed, it indicates it does not apply.

formatdate
Optional<String> countryOfTaxResidency

The country of tax residency of the account-holder entity. null when not on file or entity reference data is unavailable. When a null/undefined value is observed, it indicates that there is no available data.

Optional<LocalDate> dateOfBirth

The date of birth of the account holder’s primary contact. null when not on file or entity reference data is unavailable. When a null/undefined value is observed, it indicates that there is no available data.

formatdate
Optional<Address> mailingAddress

The mailing address of the account-holder entity. null when no mailing address is on file or entity reference data is unavailable. When a null/undefined value is observed, it indicates that there is no available data.

String city

City

String country

Country

String line1

First street address line

String postalCode

Postal code

Optional<String> line2

Second street address line When a null/undefined value is observed, it indicates it does not apply.

Optional<String> state

State or province When a null/undefined value is observed, it indicates it does not apply.

Optional<String> phoneNumber

The phone number of the account holder’s primary contact. null when not on file or entity reference data is unavailable. When a null/undefined value is observed, it indicates that there is no available data.

Get Account By ID

package com.clearstreet.api.example;

import com.clearstreet.api.client.ClearStreetClient;
import com.clearstreet.api.client.okhttp.ClearStreetOkHttpClient;
import com.clearstreet.api.models.v1.accounts.AccountGetAccountByIdParams;
import com.clearstreet.api.models.v1.accounts.AccountGetAccountByIdResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        ClearStreetClient client = ClearStreetOkHttpClient.builder()
            .fromEnv()
            .apiKey("My API Key")
            .build();

        AccountGetAccountByIdResponse response = client.v1().accounts().getAccountById(0L);
    }
}
{
  "data": {
    "account_holder_entity_id": 987654321,
    "close_date": null,
    "country_of_tax_residency": "US",
    "date_of_birth": "1985-03-15",
    "full_name": "Test Trading Account",
    "id": 19816,
    "mailing_address": {
      "city": "New York",
      "country": "USA",
      "line1": "4 World Trade Center",
      "line2": "150 Greenwich Street, Floor 45",
      "postal_code": "10007",
      "state": "NY"
    },
    "open_date": "2023-01-15",
    "options_level": 1,
    "phone_number": "+12125550123",
    "short_name": "TST-ACCOUNT-01",
    "status": "ACTIVE",
    "subtype": "MARGIN",
    "type": "CUSTOMER"
  },
  "error": null,
  "metadata": {
    "request_id": "b7e2d3f4-a1b2-4c3d-8e4f-5a6b7c8d9e0f"
  }
}
{
  "data": {
    "account_holder_entity_id": 987654322,
    "close_date": "2024-08-01",
    "country_of_tax_residency": null,
    "date_of_birth": null,
    "full_name": "Old Test Account",
    "id": 19817,
    "mailing_address": null,
    "open_date": "2021-05-20",
    "options_level": 0,
    "phone_number": null,
    "short_name": "TST-ACCOUNT-02-CLOSED",
    "status": "CLOSED",
    "subtype": "CASH",
    "type": "CUSTOMER"
  },
  "error": null,
  "metadata": {
    "request_id": "c8f3e4a5-b2c3-5d4e-9f0a-6b7c8d9e0f1a"
  }
}
{
  "error": {
    "code": 403,
    "message": "The caller does not have permission to execute the specified operation"
  },
  "metadata": {
    "request_id": "5518f0c6-58ff-4b4a-81a5-701556d41206"
  }
}
{
  "error": {
    "code": 404,
    "message": "Some requested entity was not found"
  },
  "metadata": {
    "request_id": "67e95eb4-93b9-4010-8c9b-7ada7c2be93f"
  }
}
Returns Examples
{
  "data": {
    "account_holder_entity_id": 987654321,
    "close_date": null,
    "country_of_tax_residency": "US",
    "date_of_birth": "1985-03-15",
    "full_name": "Test Trading Account",
    "id": 19816,
    "mailing_address": {
      "city": "New York",
      "country": "USA",
      "line1": "4 World Trade Center",
      "line2": "150 Greenwich Street, Floor 45",
      "postal_code": "10007",
      "state": "NY"
    },
    "open_date": "2023-01-15",
    "options_level": 1,
    "phone_number": "+12125550123",
    "short_name": "TST-ACCOUNT-01",
    "status": "ACTIVE",
    "subtype": "MARGIN",
    "type": "CUSTOMER"
  },
  "error": null,
  "metadata": {
    "request_id": "b7e2d3f4-a1b2-4c3d-8e4f-5a6b7c8d9e0f"
  }
}
{
  "data": {
    "account_holder_entity_id": 987654322,
    "close_date": "2024-08-01",
    "country_of_tax_residency": null,
    "date_of_birth": null,
    "full_name": "Old Test Account",
    "id": 19817,
    "mailing_address": null,
    "open_date": "2021-05-20",
    "options_level": 0,
    "phone_number": null,
    "short_name": "TST-ACCOUNT-02-CLOSED",
    "status": "CLOSED",
    "subtype": "CASH",
    "type": "CUSTOMER"
  },
  "error": null,
  "metadata": {
    "request_id": "c8f3e4a5-b2c3-5d4e-9f0a-6b7c8d9e0f1a"
  }
}
{
  "error": {
    "code": 403,
    "message": "The caller does not have permission to execute the specified operation"
  },
  "metadata": {
    "request_id": "5518f0c6-58ff-4b4a-81a5-701556d41206"
  }
}
{
  "error": {
    "code": 404,
    "message": "Some requested entity was not found"
  },
  "metadata": {
    "request_id": "67e95eb4-93b9-4010-8c9b-7ada7c2be93f"
  }
}