Create Virtual Account
curl --request POST \
--url https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"request_id": "<string>",
"source": {
"banking_country": "<string>"
},
"destination": {
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
}
}
'import requests
url = "https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts"
payload = {
"request_id": "<string>",
"source": { "banking_country": "<string>" },
"destination": {
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_id: '<string>',
source: {banking_country: '<string>'},
destination: {account_id: '<string>', currency: 'USDC', chain: 'ETHEREUM_MAINNET'}
})
};
fetch('https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_id: '<string>',
source: {banking_country: '<string>'},
destination: {account_id: '<string>', currency: 'USDC', chain: 'ETHEREUM_MAINNET'}
})
};
fetch('https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts"
payload := strings.NewReader("{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}")
.asString();val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}")
val request = Request.Builder()
.url("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falseimport Foundation
let parameters = [
"request_id": "<string>",
"source": ["banking_country": "<string>"],
"destination": [
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
]
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"identity_id": "<string>",
"status": "VIRTUAL_ACCOUNT_STATUS_PENDING",
"source": {
"banking_country": "<string>"
},
"destination": {
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
},
"deposit_instructions": {
"amount": "<string>",
"currency": "USDC",
"bank_name": "<string>",
"bank_address": "<string>",
"payment_method": "BLOCKCHAIN",
"deposit_message": "<string>",
"bank_account_number": "<string>",
"bank_routing_number": "<string>",
"bank_beneficiary_name": "<string>",
"bank_beneficiary_address": "<string>"
},
"created_at": "<string>",
"updated_at": "<string>"
}Virtual Accounts
Create Virtual Account
Create a virtual account for an identity to receive fiat deposits and convert to crypto
POST
/
v2
/
identities
/
{identity_id}
/
virtual-accounts
Create Virtual Account
curl --request POST \
--url https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"request_id": "<string>",
"source": {
"banking_country": "<string>"
},
"destination": {
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
}
}
'import requests
url = "https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts"
payload = {
"request_id": "<string>",
"source": { "banking_country": "<string>" },
"destination": {
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_id: '<string>',
source: {banking_country: '<string>'},
destination: {account_id: '<string>', currency: 'USDC', chain: 'ETHEREUM_MAINNET'}
})
};
fetch('https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_id: '<string>',
source: {banking_country: '<string>'},
destination: {account_id: '<string>', currency: 'USDC', chain: 'ETHEREUM_MAINNET'}
})
};
fetch('https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts"
payload := strings.NewReader("{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}")
.asString();val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}")
val request = Request.Builder()
.url("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")
.post(body)
.addHeader("Authorization", "Bearer <token>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()falseimport Foundation
let parameters = [
"request_id": "<string>",
"source": ["banking_country": "<string>"],
"destination": [
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
]
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
require 'uri'
require 'net/http'
url = URI("https://api.prod.bastion.com/v2/identities/{identity_id}/virtual-accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_id\": \"<string>\",\n \"source\": {\n \"banking_country\": \"<string>\"\n },\n \"destination\": {\n \"account_id\": \"<string>\",\n \"currency\": \"USDC\",\n \"chain\": \"ETHEREUM_MAINNET\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"identity_id": "<string>",
"status": "VIRTUAL_ACCOUNT_STATUS_PENDING",
"source": {
"banking_country": "<string>"
},
"destination": {
"account_id": "<string>",
"currency": "USDC",
"chain": "ETHEREUM_MAINNET"
},
"deposit_instructions": {
"amount": "<string>",
"currency": "USDC",
"bank_name": "<string>",
"bank_address": "<string>",
"payment_method": "BLOCKCHAIN",
"deposit_message": "<string>",
"bank_account_number": "<string>",
"bank_routing_number": "<string>",
"bank_beneficiary_name": "<string>",
"bank_beneficiary_address": "<string>"
},
"created_at": "<string>",
"updated_at": "<string>"
}Authorizations
Bearer authentication with an API token
Path Parameters
Identity to create the virtual account for.
Body
application/json
Response
Success
Unique identifier for this virtual account.
Bastion identity that owns the account.
Current status.
Available options:
VIRTUAL_ACCOUNT_STATUS_UNSPECIFIED, VIRTUAL_ACCOUNT_STATUS_PENDING, VIRTUAL_ACCOUNT_STATUS_ACTIVE, VIRTUAL_ACCOUNT_STATUS_INACTIVE, VIRTUAL_ACCOUNT_STATUS_FAILED Example:
"VIRTUAL_ACCOUNT_STATUS_PENDING"
Source: fiat deposit configuration.
Show child attributes
Show child attributes
Destination: asset delivery configuration.
- destination
- destination
Show child attributes
Show child attributes
Deposit instructions (populated when status = ACTIVE). Returned synchronously by providers that support it (e.g. CRB/MT).
Show child attributes
Show child attributes
Time the virtual account was created, as an RFC 3339 timestamp.
Time the virtual account was last updated, as an RFC 3339 timestamp.