> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.redpincompany.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.redpincompany.com/_mcp/server.

# View virtual accounts

GET https://sandbox.currenciesdirect.com/v1/customers/{customer_id}/virtual-accounts

Get details of all virtual accounts allocated to the customer.

**Authentication:** [Bearer token required](/api-guide/getting-started/authentication#oauth-20-authentication)


Reference: https://docs.redpincompany.com/api-reference/customers/api-integration/virtual-accounts/get-virtual-accounts

## Authentication

- `Authorization` header (bearer token, required) — OAuth 2.0 Bearer token authentication. This API uses OAuth 2.0 Client Credentials flow. Please refer to the [Authentication](/api-guide/getting-started/authentication#oauth-20-authentication) section for detailed information on how to obtain and use your OAuth credentials.

## Servers

- `https://sandbox.currenciesdirect.com` (Sandbox, default)
- `https://api.redpincompany.com` (Production)

## Request

### Path parameters

- `customer_id` (string, required) — Unique Customer Identifier

## Response

### 200

OK. Returns all virtual accounts allocated to the customer.

- `customer_id` (string, required) — Customer number.
- `customer_name` (string, required) — Name of the customer.
- `virtual_account_details` (list of VirtualAccountDetails, required) — Array of virtual accounts.

## Errors

### 400 Bad Request Error

Bad request - invalid parameters

- `code` (string, required)
- `description` (string, required) — Human-readable error description
- `type` (enum, optional) — Category or type of the error. - `VALIDATION_ERROR`: Error due to invalid input data or format - `AUTHORIZATION_ERROR`: Error related to insufficient permissions - `SYSTEM_ERROR`: Internal system or server errors - `RESOURCE_ERROR`: Error related to resource availability - `BUSINESS_ERROR`: Error related to business logic violations - `DATA_ERROR`: Error related to data inconsistencies or duplication
  - Allowed values: `VALIDATION_ERROR`, `AUTHORIZATION_ERROR`, `SYSTEM_ERROR`, `RESOURCE_ERROR`, `BUSINESS_ERROR`, `DATA_ERROR`
- `field` (string, optional)
- `details` (map from string to any, optional) — Additional details about the error
- `timestamp` (datetime, optional)

### 401 Unauthorized Error

Unauthorized - invalid authorization header

- `code` (string, required)
- `description` (string, required) — Human-readable error description
- `type` (enum, optional) — Category or type of the error. - `VALIDATION_ERROR`: Error due to invalid input data or format - `AUTHORIZATION_ERROR`: Error related to insufficient permissions - `SYSTEM_ERROR`: Internal system or server errors - `RESOURCE_ERROR`: Error related to resource availability - `BUSINESS_ERROR`: Error related to business logic violations - `DATA_ERROR`: Error related to data inconsistencies or duplication
  - Allowed values: `VALIDATION_ERROR`, `AUTHORIZATION_ERROR`, `SYSTEM_ERROR`, `RESOURCE_ERROR`, `BUSINESS_ERROR`, `DATA_ERROR`
- `field` (string, optional)
- `details` (map from string to any, optional) — Additional details about the error
- `timestamp` (datetime, optional)

### 404 Not Found Error

Virtual account not found

- `code` (string, required)
- `description` (string, required) — Human-readable error description
- `type` (enum, optional) — Category or type of the error. - `VALIDATION_ERROR`: Error due to invalid input data or format - `AUTHORIZATION_ERROR`: Error related to insufficient permissions - `SYSTEM_ERROR`: Internal system or server errors - `RESOURCE_ERROR`: Error related to resource availability - `BUSINESS_ERROR`: Error related to business logic violations - `DATA_ERROR`: Error related to data inconsistencies or duplication
  - Allowed values: `VALIDATION_ERROR`, `AUTHORIZATION_ERROR`, `SYSTEM_ERROR`, `RESOURCE_ERROR`, `BUSINESS_ERROR`, `DATA_ERROR`
- `field` (string, optional)
- `details` (map from string to any, optional) — Additional details about the error
- `timestamp` (datetime, optional)

### 500 Internal Server Error

Internal Server Error

- `code` (string, required)
- `description` (string, required) — Human-readable error description
- `type` (enum, optional) — Category or type of the error. - `VALIDATION_ERROR`: Error due to invalid input data or format - `AUTHORIZATION_ERROR`: Error related to insufficient permissions - `SYSTEM_ERROR`: Internal system or server errors - `RESOURCE_ERROR`: Error related to resource availability - `BUSINESS_ERROR`: Error related to business logic violations - `DATA_ERROR`: Error related to data inconsistencies or duplication
  - Allowed values: `VALIDATION_ERROR`, `AUTHORIZATION_ERROR`, `SYSTEM_ERROR`, `RESOURCE_ERROR`, `BUSINESS_ERROR`, `DATA_ERROR`
- `field` (string, optional)
- `details` (map from string to any, optional) — Additional details about the error
- `timestamp` (datetime, optional)

## Types

### VirtualAccountDetails

- `virtual_account_number` (string, required) — Account number of customer's virtual account.
- `virtual_account_type` (string, required) — Type of customer's virtual account.
- `financial_institution_name` (string, required) — Name of bank/financial institution.
- `address` (string, required) — Address of bank/financial institution.
- `status` (string, required) — Status of virtual account.
- `currency` (string, required) — Currency of virtual account in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) three-letter format (e.g., USD, GBP).
- `country` (string, required) — Country of virtual account in [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) format (e.g., USA, GBR).
- `country_specific_code` (string, optional) — Code of bank/financial institution.
- `country_specific_type` (string, optional) — Type of bank/financial institution's code.
- `country_specific_method` (string, optional) — Method/network to be used for money transfer.
- `country_specific_code2` (string, optional) — Second code of bank/financial institution.
- `country_specific_type2` (string, optional) — Type of bank/financial institution's second code.
- `country_specific_method2` (string, optional) — Method/network to be used for money transfer using second code.

## Examples

**Response**

```json
{
  "customer_id": "0201000010520648",
  "customer_name": "Trevor",
  "virtual_account_details": [
    {
      "virtual_account_number": "123456000000049",
      "virtual_account_type": "Checking",
      "financial_institution_name": "CFSB bank",
      "address": "CFSB US",
      "status": "ACTIVE",
      "currency": "USD",
      "country": "USA",
      "country_specific_code": "543212458",
      "country_specific_type": "ABA",
      "country_specific_method": "ACH",
      "country_specific_code2": "543212458",
      "country_specific_type2": "ABA",
      "country_specific_method2": "WIRE"
    }
  ]
}
```

**SDK Code**

```shell cURL (all accounts)
curl -X GET https://sandbox.currenciesdirect.com/v1/customers/{customerId}/virtual-accounts \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

```

```python All virtual accounts
import requests

url = "https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript All virtual accounts
const url = 'https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go All virtual accounts
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby All virtual accounts
require 'uri'
require 'net/http'

url = URI("https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java All virtual accounts
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php All virtual accounts
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp All virtual accounts
using RestSharp;

var client = new RestClient("https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift All virtual accounts
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.currenciesdirect.com/v1/customers/0201000010520648/virtual-accounts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```