Sandbox Create buy or sell order
curl --request POST \
--url https://api.openxswitch.com/v1/sandbox/trade/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"walletId": "wallet-12345",
"symbol": "BTCUSDT",
"orderType": "limit",
"side": "buy",
"quantity": "0.1",
"clientTxId": "txn-67890",
"price": 50000,
"requestWindow": "5000"
}
'import requests
url = "https://api.openxswitch.com/v1/sandbox/trade/order"
payload = {
"walletId": "wallet-12345",
"symbol": "BTCUSDT",
"orderType": "limit",
"side": "buy",
"quantity": "0.1",
"clientTxId": "txn-67890",
"price": 50000,
"requestWindow": "5000"
}
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({
walletId: 'wallet-12345',
symbol: 'BTCUSDT',
orderType: 'limit',
side: 'buy',
quantity: '0.1',
clientTxId: 'txn-67890',
price: 50000,
requestWindow: '5000'
})
};
fetch('https://api.openxswitch.com/v1/sandbox/trade/order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openxswitch.com/v1/sandbox/trade/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'walletId' => 'wallet-12345',
'symbol' => 'BTCUSDT',
'orderType' => 'limit',
'side' => 'buy',
'quantity' => '0.1',
'clientTxId' => 'txn-67890',
'price' => 50000,
'requestWindow' => '5000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openxswitch.com/v1/sandbox/trade/order"
payload := strings.NewReader("{\n \"walletId\": \"wallet-12345\",\n \"symbol\": \"BTCUSDT\",\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"quantity\": \"0.1\",\n \"clientTxId\": \"txn-67890\",\n \"price\": 50000,\n \"requestWindow\": \"5000\"\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.openxswitch.com/v1/sandbox/trade/order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"walletId\": \"wallet-12345\",\n \"symbol\": \"BTCUSDT\",\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"quantity\": \"0.1\",\n \"clientTxId\": \"txn-67890\",\n \"price\": 50000,\n \"requestWindow\": \"5000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openxswitch.com/v1/sandbox/trade/order")
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 \"walletId\": \"wallet-12345\",\n \"symbol\": \"BTCUSDT\",\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"quantity\": \"0.1\",\n \"clientTxId\": \"txn-67890\",\n \"price\": 50000,\n \"requestWindow\": \"5000\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "1234567890",
"clientTxId": "client-tx...-123",
"workspaceId": "656abf1e4b5f5e0012345678",
"walletId": "656abf1e4b5f5e0098765432",
"symbol": "BTCUSDT",
"price": 45000.5,
"quantity": 1.5,
"orderType": "limit",
"side": "buy",
"status": "live",
"priceAvg": 44999.75,
"base": {
"baseCoin": "USDT",
"baseVolume": 67500.75
},
"quote": {
"quoteCoin": "USDT",
"quoteVolume": 67500.75
},
"fee": {
"feeCoin": "USDT",
"totalFee": 0.02
},
"cancelReason": "Insufficient funds",
"createdAt": "2026-05-26T12:16:07.073Z",
"updatedAt": "2026-05-26T12:16:07.075Z",
"completedAt": "2026-05-26T12:16:07.075Z",
"requestWindow": "5000"
}
}{
"statusCode": 400,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}{
"statusCode": 404,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "Cannot GET /v1/..."
}{
"statusCode": 422,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": [
"param is required"
]
}{
"statusCode": 500,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}Trade Endpoints
Sandbox Create buy or sell order
Create a new trading order
POST
/
v1
/
sandbox
/
trade
/
order
Sandbox Create buy or sell order
curl --request POST \
--url https://api.openxswitch.com/v1/sandbox/trade/order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"walletId": "wallet-12345",
"symbol": "BTCUSDT",
"orderType": "limit",
"side": "buy",
"quantity": "0.1",
"clientTxId": "txn-67890",
"price": 50000,
"requestWindow": "5000"
}
'import requests
url = "https://api.openxswitch.com/v1/sandbox/trade/order"
payload = {
"walletId": "wallet-12345",
"symbol": "BTCUSDT",
"orderType": "limit",
"side": "buy",
"quantity": "0.1",
"clientTxId": "txn-67890",
"price": 50000,
"requestWindow": "5000"
}
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({
walletId: 'wallet-12345',
symbol: 'BTCUSDT',
orderType: 'limit',
side: 'buy',
quantity: '0.1',
clientTxId: 'txn-67890',
price: 50000,
requestWindow: '5000'
})
};
fetch('https://api.openxswitch.com/v1/sandbox/trade/order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.openxswitch.com/v1/sandbox/trade/order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'walletId' => 'wallet-12345',
'symbol' => 'BTCUSDT',
'orderType' => 'limit',
'side' => 'buy',
'quantity' => '0.1',
'clientTxId' => 'txn-67890',
'price' => 50000,
'requestWindow' => '5000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.openxswitch.com/v1/sandbox/trade/order"
payload := strings.NewReader("{\n \"walletId\": \"wallet-12345\",\n \"symbol\": \"BTCUSDT\",\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"quantity\": \"0.1\",\n \"clientTxId\": \"txn-67890\",\n \"price\": 50000,\n \"requestWindow\": \"5000\"\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.openxswitch.com/v1/sandbox/trade/order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"walletId\": \"wallet-12345\",\n \"symbol\": \"BTCUSDT\",\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"quantity\": \"0.1\",\n \"clientTxId\": \"txn-67890\",\n \"price\": 50000,\n \"requestWindow\": \"5000\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openxswitch.com/v1/sandbox/trade/order")
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 \"walletId\": \"wallet-12345\",\n \"symbol\": \"BTCUSDT\",\n \"orderType\": \"limit\",\n \"side\": \"buy\",\n \"quantity\": \"0.1\",\n \"clientTxId\": \"txn-67890\",\n \"price\": 50000,\n \"requestWindow\": \"5000\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "1234567890",
"clientTxId": "client-tx...-123",
"workspaceId": "656abf1e4b5f5e0012345678",
"walletId": "656abf1e4b5f5e0098765432",
"symbol": "BTCUSDT",
"price": 45000.5,
"quantity": 1.5,
"orderType": "limit",
"side": "buy",
"status": "live",
"priceAvg": 44999.75,
"base": {
"baseCoin": "USDT",
"baseVolume": 67500.75
},
"quote": {
"quoteCoin": "USDT",
"quoteVolume": 67500.75
},
"fee": {
"feeCoin": "USDT",
"totalFee": 0.02
},
"cancelReason": "Insufficient funds",
"createdAt": "2026-05-26T12:16:07.073Z",
"updatedAt": "2026-05-26T12:16:07.075Z",
"completedAt": "2026-05-26T12:16:07.075Z",
"requestWindow": "5000"
}
}{
"statusCode": 400,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}{
"statusCode": 404,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "Cannot GET /v1/..."
}{
"statusCode": 422,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": [
"param is required"
]
}{
"statusCode": 500,
"path": "/v1/...",
"timestamp": "2025-03-13T12:34:56.789Z",
"message": "......"
}Authorizations
Body
application/json
The trading pair symbol (e.g., BTCUSDT).
Refer to the Get Trading pairs endpoint for the list of pair symbol.
Example:
"BTCUSDT"
.png?fit=max&auto=format&n=ML35RDblT1Ol-zJb&q=85&s=062e79ad9c4540929eec204aff020178)
.png?fit=max&auto=format&n=ML35RDblT1Ol-zJb&q=85&s=f6328956931c9664a2a070c2edb6e9b3)