VirtuaBroker API (1.0.0)

Download OpenAPI specification:Download

The VirtuaBroker API documentation to interact with the platform. This API allows you to create orders, get balances, create deposits, and more. The API is secured with OAuth2.0.

Authentication

To access the API, you must authenticate using OAuth2.0. The access token can be obtained by making a POST request to the following URL:

https://auth2.virtuabroker.com/realms/cryptobot/protocol/openid-connect/token

Request Details

  • Content-Type: application/x-www-form-urlencoded
  • Request Body Parameters:
    • client_id: Your client identifier (provided by VirtuaBroker)
    • username: Your account's username (provided by VirtuaBroker)
    • password: Your account's password (provided by VirtuaBroker)
    • grant_type: Use password as the grant type

Upon successful authentication, you will receive an access_token which must be included in the Authorization header as a Bearer token for all subsequent API calls.

Example Code Snippet

Here's a simple example of how to request an access token using Node.js and axios:

import axios from 'axios';
import qs from 'qs';

const authUrl = 'https://auth2.virtuabroker.com/realms/cryptobot/protocol/openid-connect/token';
const clientId = 'your-client-id';
const username = 'your-username';
const password = 'your-password';

const requestToken = async () => {
  const requestBody = qs.stringify({
    client_id: clientId,
    username,
    password,
    grant_type: 'password'
  });

  try {
    const response = await axios.post(authUrl, requestBody, {
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    });
    
    const accessToken = response.data.access_token;
    console.log('Access Token:', accessToken);
    return accessToken;
  } catch (error) {
    console.error('Failed to fetch token', error);
    throw error;
  }
};

Integration Testing

For integration purposes, VirtuaBroker provides a staging environment at:

https://api-stage.virtuabroker.com

Here, you can simulate various operations such as deposits and trades. For example, to simulate a deposit and trigger the associated webhook, you can use the following endpoint:

POST https://simulateincomingtransfer-kmygxkfbpq-ew.a.run.app

Request Body Example

{
    "amount": 60,
    "reference": "unique-reference"
}

This will simulate a deposit of 60 units and trigger your configured webhook.

Further Assistance

If you are interested in integrating with the VirtuaBroker platform or need specific credentials for authentication, please contact our support team at daniel@virtuabroker.com. We are here to assist you with any questions or issues you may encounter during the integration process.

Webhook

Handle webhook events Webhook

This endpoint receives and processes webhook events related to deposits, trades, withdrawals, and order status updates. The event data is logged, and a confirmation response is returned.

Request Body schema: application/json
type
required
string
Enum: "deposit_completed" "deposit_partially_completed" "trade_completed" "withdrawal_completed" "order_status_updated"
id
required
string

ID of the webhook event

api_version
required
string

API version of the webhook event

apiKey
required
string

Provided API key by you so we can authenticate incoming requests coming to your webhook endpoint

required
object or object or object or object

Data associated with the webhook event

Responses

Request samples

Content type
application/json
{
  • "type": "deposit_partially_completed",
  • "id": "evt_123456",
  • "api_version": "v1",
  • "apiKey": "xxx",
  • "data": {
    }
}

Pairs

Get available pairs

This endpoint retrieves a list of available trading pairs.

Authorizations:
oauth2

Responses

Response samples

Content type
application/json
{
  • "pairs": [
    ]
}

Quotes

Create quotes

This endpoint creates new quotes for specified pairs.

Authorizations:
oauth2
Request Body schema: application/json
userEmail
string <email>

The email of the user making the quote

originCurrency
required
string
Value: "EUR"

The currency code of the origin currency

originNetwork
string
Enum: "MATIC" "ETH" "CELO" "TRON"

The network of the origin currency if it is crypto

originAmount
number > 0

The amount in the origin currency

destinationCurrency
required
string
Enum: "BRL" "COP" "VES" "MXN" "ARS" "USD" "USDC" "USDT" "ETH" "BTC" "PLASTIK" "POL" "SOL" "DOGE" "ADA" "XRP" "NEAR" "PEPE" "LINK" "AVAX" "DOT" "SHIB" "ALGO" "TRX" "GIGA" "FLOKI" "KAVA"

The currency code of the destination currency

destinationNetwork
string
Enum: "MATIC" "ETH" "CELO" "TRON"

The network of the destination currency if it is crypto

destinationAmount
number > 0

The amount in the destination currency

destinationTransferMethod
string
Enum: "virtuabroker" "cryptoWallet" "bankDepositBR" "pixDepositBR" "bankDepositMX" "debitCardMX" "mobileNumberMX" "bankDepositAR" "bankDepositVEN" "phonePaymentVEN" "bankDepositCOL" "wireUS"

The end user destination transfer method used for transferring to the destination. This field is only used when there is a userEmail being used in the request. This field also requires the destinationTransferData to be present in order to work as expected.

destinationTransferData
any or null

The details required for the end user destination transfer method. This field is only used when there is a userEmail being used in the request. This field also requires the destinationTransferMethod to be present in order to work as expected.

locale
string
Enum: "en" "es" "pt" "it" "fr" "de"

The locale of the user

discountCode
string

The discount code to apply

Responses

Request samples

Content type
application/json
{
  • "userEmail": "user@example.com",
  • "originCurrency": "EUR",
  • "originNetwork": "MATIC",
  • "originAmount": 100,
  • "destinationCurrency": "BRL",
  • "destinationNetwork": "MATIC",
  • "destinationAmount": 85,
  • "destinationTransferMethod": "bankDepositBR",
  • "destinationTransferData": null,
  • "locale": "en",
  • "discountCode": "string"
}

Response samples

Content type
application/json
{
  • "quoteId": "123e4567-e89b-12d3-a456-426614174000",
  • "originCurrency": "EUR",
  • "originNetwork": "MATIC",
  • "originAmount": 100,
  • "destinationCurrency": "BRL",
  • "destinationNetwork": "MATIC",
  • "destinationAmount": 85,
  • "price": 0.85,
  • "fee": 1.5,
  • "expectedGasFee": 1.5,
  • "feeCurrency": "EUR",
  • "expireAt": 1694291200
}

Balances

Get user balances

This endpoint returns the balances for different currencies associated with a user. The user can optionally filter by a specific currency or email.

Authorizations:
oauth2
query Parameters
currency
string
Value: "EUR"
Examples: currency=EUR

Currency code to filter the balances

userEmail
string <email>
Examples: userEmail=user@virtuabroker.com userEmail=john.doe@example.com userEmail=alice@crypto.io

User email to filter the balances

Responses

Response samples

Content type
application/json
{
  • "balances": [
    ]
}

Deposits

Create a deposit

This endpoint creates a new deposit request.

Authorizations:
oauth2
Request Body schema: application/json
required
object

User data for the deposit

amount
required
number > 0

Amount to be deposited

currency
required
string
Value: "EUR"

Currency of the deposit

network
string
Enum: "MATIC" "ETH" "CELO" "TRON"

Network for the deposit for crypto deposits

Responses

Request samples

Content type
application/json
{
  • "userData": {
    },
  • "amount": 100,
  • "currency": "EUR",
  • "network": "ETH"
}

Response samples

Content type
application/json
{
  • "depositId": "01CLFXMT67II",
  • "userData": {
    },
  • "createdAt": 1723027132,
  • "expectedAmount": 1000,
  • "amount": 1000,
  • "currency": "EUR",
  • "depositType": "SEPA",
  • "fee": 10,
  • "expectedFee": 10,
  • "feeCurrency": "EUR",
  • "status": "Success",
  • "depositInfo": {
    }
}

List deposits

This endpoint retrieves a list of deposits based on various filters.

Authorizations:
oauth2
query Parameters
currency
string
Value: "EUR"
Examples: currency=EUR

Optional currency code to filter the deposits

minAmount
number >= 0
maxAmount
number >= 0
from
integer >= 0
to
integer >= 0
userEmail
string <email>
Example: userEmail=user@example.com

Email of the user making the request

limit
number >= 0
page
number >= 0
status
string
Enum: "Pending" "PendingCancel" "Canceled" "Received" "Success" "Failed"
Examples: status=Pending status=Success status=Failed status=Received

Optional status to filter orders

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get deposit details

This endpoint retrieves details of a specific deposit.

Authorizations:
oauth2
path Parameters
depositId
required
string = 12 characters ^[A-Z0-9]+$
Examples: 01CLFXMT67II 2R7E5Y5KFXP8 4FWWRE3Y2URM

ID of the deposit

Responses

Response samples

Content type
application/json
{
  • "depositId": "01CLFXMT67II",
  • "userData": {
    },
  • "createdAt": 1723027132,
  • "expectedAmount": 1000,
  • "amount": 1000,
  • "currency": "EUR",
  • "depositType": "SEPA",
  • "fee": 10,
  • "expectedFee": 10,
  • "feeCurrency": "EUR",
  • "status": "Success",
  • "depositInfo": {
    }
}

Delete a deposit

This endpoint deletes a specific deposit.

Authorizations:
oauth2
path Parameters
depositId
required
string = 12 characters ^[A-Z0-9]+$
Examples: 01CLFXMT67II 2R7E5Y5KFXP8 4FWWRE3Y2URM

ID of the deposit

Responses

Response samples

Content type
application/json
{ }

Orders

Create an order

This endpoint creates a new order. The order follows a "specific" flow:

  1. Origin: The process begins with receiving a specified amount of money at the origin.

  2. Trade Execution: Once the origin amount is received, the trade is executed.

  3. Withdrawal: After successful execution, the final funds are sent to the specified withdrawal destination.

Note: This flow ensures a seamless process from fund reception to trade execution and final withdrawal.

Authorizations:
oauth2
Request Body schema: application/json
quoteId
required
string <uuid>

The unique identifier of the created quote

required
object

User data associated with the order

Responses

Request samples

Content type
application/json
{
  • "quoteId": "123e4567-e89b-12d3-a456-426614174000",
  • "userData": {
    }
}

Response samples

Content type
application/json
{
  • "orderId": "01CLFXMT67II",
  • "deposit": {
    },
  • "trade": {
    },
  • "withdraw": {
    },
  • "createdAt": 1723027132,
  • "updatedAt": 1723027132,
  • "status": "Pending",
  • "fee": 6.37,
  • "expectedFee": 6.88,
  • "expectedGasFee": 6.88,
  • "feeCurrency": "EUR"
}

List orders

This endpoint retrieves a list of orders based on various filters.

Authorizations:
oauth2
query Parameters
currency
string
Example: currency=EUR

Optional currency code to filter the items

minAmount
number >= 0
maxAmount
number >= 0
from
integer >= 0
to
integer >= 0
userEmail
string <email>
Example: userEmail=user@example.com

Email of the user making the request

limit
number >= 0
page
number >= 0
status
string
Enum: "Pending" "Processing" "Reviewing" "Completed" "Failed"
Examples: status=Pending status=Completed status=Failed status=Processing

Optional status to filter orders

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get order details

This endpoint retrieves details of a specific order.

Authorizations:
oauth2
path Parameters
orderId
required
string = 12 characters ^[A-Z0-9]+$
Examples: 01CLFXMT67II 2R7E5Y5KFXP8 4FWWRE3Y2URM

ID of the order

Responses

Response samples

Content type
application/json
{
  • "orderId": "01CLFXMT67II",
  • "deposit": {
    },
  • "trade": {
    },
  • "withdraw": {
    },
  • "createdAt": 1723027132,
  • "updatedAt": 1723027132,
  • "status": "Pending",
  • "fee": 6.37,
  • "expectedFee": 6.88,
  • "expectedGasFee": 6.88,
  • "feeCurrency": "EUR"
}

Delete an order

This endpoint deletes a specific order. The order must be in status PENDING.

Authorizations:
oauth2
path Parameters
orderId
required
string = 12 characters ^[A-Z0-9]+$
Examples: 01CLFXMT67II 2R7E5Y5KFXP8 4FWWRE3Y2URM

ID of the order

Responses

Response samples

Content type
application/json
{ }