m8ty_client_custodyaccount
Custody Account information service covers all the aspects of custody accounts, transactions, and positions.
Before you start
Check the documentation of the m8ty_client_custodyaccount library to get an idea about the available models and their properties.
Import all needed libraries
import 'package:dio/dio.dart';
import 'package:m8ty_client_custodyaccount/m8ty_client_custodyaccount.dart';
import 'package:m8ty_client_common/m8ty_client_common.dart';
import 'package:built_collection/built_collection.dart';
Client Setup
final client = M8tyClientCustodyaccount();
client.setOAuthToken('ApiOAuth2', oauthToken);
API Surface
CustodyAccountsApi
Method | Description |
|---|
searchCustodyAccounts
| Search for the user's custody accounts |
fetchCustodyAccountById
| Retrieve a specific custody account |
CustodyPositionsApi
Method | Description |
|---|
searchCustodyPositions
| Search for all positions of a custody account |
fetchCustodyPositionById
| Get a specific custody account position |
getCustodyPositionsOverview
| Get positions overview for a single custody account |
CustodyTransactionsApi
Method | Description |
|---|
searchCustodyTransactions
| Search for all transactions of a custody account |
fetchCustodyTransactionById
| Get a specific custody account transaction |
Here some examples how the dart client can be used
Get list of all custody accounts
final client = M8tyClientCustodyaccount();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyAccountsApi();
final custodyAccountSearchRequestModel = CustodyAccountSearchRequestModel((b) => b
..customerId = "1234"
..portfolioId = "78");
final Response<CustodyAccountSearchResponseModel> response = await api.searchCustodyAccounts(
custodyAccountSearchRequestModel: custodyAccountSearchRequestModel,
page: 1,
size: 100,
);
Fetch custody account by id
final client = M8tyClientCustodyaccount();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyAccountsApi();
try {
final Response<CustodyAccountModel> response = await api.fetchCustodyAccountById(
custodyAccountId: "1234",
);
} on DioException catch (e) {
throw Exception(
'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}',
);
}
Get list of all positions
final client = M8tyClientCustodyaccount();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyPositionsApi();
final Response<CustodyPositionsSearchResponseModel> response = await api.searchCustodyPositions(
custodyAccountId: "123",
custodyPositionsSearchRequestModel: custodyPositionsSearchRequestModel,
);
Get a position by id
final client = M8tyClientCustodyaccount();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyPositionsApi();
final Response<CustodyPositionModel> response = await api.fetchCustodyPositionById(
custodyAccountId: "123",
custodyAccountTransactionId: "789",
);
Get list of all transactions
final custodyTransactionSearchRequestModel = CustodyTransactionSearchRequestModel((b) => b
..orderId = "123"
..positionId = "789",
);
final client = M8tyClientCustodyaccount();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyTransactionsApi();
final Response<CustodyTransactionSearchResponseModel> response = await api.searchCustodyTransactions(
custodyAccountId: "123",
custodyTransactionSearchRequestModel: custodyTransactionSearchRequestModel,
page: 1,
size: 100,
);
Fetch custody transaction by id
final client = M8tyClientCustodyaccount();
client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyTransactionsApi();
final Response<CustodyPositionModel> response = await api.fetchCustodyTransactionById(
custodyAccountId: "123",
custodyAccountTransactionId: "789",
);
03 June 2026