# TransferzeroSdk.AccountsApi
All URIs are relative to *https://api-sandbox.transferzero.com/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**getAccount**](AccountsApi.md#getAccount) | **GET** /accounts/{Currency} | Fetches account balance for specified currrency
[**getAccounts**](AccountsApi.md#getAccounts) | **GET** /accounts | Fetches account balances for all currencies
# **getAccount**
> AccountResponse getAccount(currency)
Fetches account balance for specified currrency
Fetches account balance for specified currrency, and returns current balance and associated currency code
### Example
```javascript
import { AccountsApi } from 'transferzero-sdk';
// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
let apiInstance = new AccountsApi(apiClient);
apiInstance.getAccount(currency).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
if (error.isValidationError) {
let result = error.getResponseObject();
console.log(result);
console.error("WARN: Validation error occurred when calling the endpoint");
} else {
console.error("Exception when calling AccountsApi#getAccount");
throw error;
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**currency** | **String**| Currency code of account balance to fetch Example: `/v1/accounts/USD` |
### Return type
[**AccountResponse**](AccountResponse.md)
### Authorization
You can set the API Key and Secret by passing a config object when creating an ApiClient:
```js
const apiClient = new ApiClient({
apiKey: '',
apiSecret: '',
basePath: 'https://api-sandbox.transferzero.com/v1'
});
```
Or by setting the properties on an ApiClient instance:
```js
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
```
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
# **getAccounts**
> AccountListResponse getAccounts()
Fetches account balances for all currencies
Fetches account balances for all currencies, and returns an array of the current balances and associated currency codes.
### Example
```javascript
import { AccountsApi } from 'transferzero-sdk';
// Configure API key authorization
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
let apiInstance = new AccountsApi(apiClient);
apiInstance.getAccounts().then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
if (error.isValidationError) {
let result = error.getResponseObject();
console.log(result);
console.error("WARN: Validation error occurred when calling the endpoint");
} else {
console.error("Exception when calling AccountsApi#getAccounts");
throw error;
}
});
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**AccountListResponse**](AccountListResponse.md)
### Authorization
You can set the API Key and Secret by passing a config object when creating an ApiClient:
```js
const apiClient = new ApiClient({
apiKey: '',
apiSecret: '',
basePath: 'https://api-sandbox.transferzero.com/v1'
});
```
Or by setting the properties on an ApiClient instance:
```js
const apiClient = new ApiClient();
apiClient.apiKey = '';
apiClient.apiSecret = '';
apiClient.basePath = 'https://api-sandbox.transferzero.com/v1';
```
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json